revert "proc: fix the threaded proc self"
authorAndrew Morton <akpm@linux-foundation.org>
Fri, 8 Feb 2008 23:00:43 +0000 (15:00 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 8 Feb 2008 23:33:32 +0000 (15:33 -0800)
Revert commit c6caeb7c4544608e8ae62731334661fc396c7f85 ("proc: fix the
threaded /proc/self"), since Eric says "The patch really is wrong.
There is at least one corner case in procps that cares."

Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "Guillaume Chazarain" <guichaz@yahoo.fr>
Cc: "Pavel Emelyanov" <xemul@openvz.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/base.c

index a0c4ba6c6e578f83c6ee70dd4dbf73a78bd5f002..7c6b4ec83cb7eb8ea25858c8e161a428ca95aa61 100644 (file)
@@ -2102,22 +2102,22 @@ static int proc_self_readlink(struct dentry *dentry, char __user *buffer,
                              int buflen)
 {
        struct pid_namespace *ns = dentry->d_sb->s_fs_info;
-       pid_t pid = task_pid_nr_ns(current, ns);
+       pid_t tgid = task_tgid_nr_ns(current, ns);
        char tmp[PROC_NUMBUF];
-       if (!pid)
+       if (!tgid)
                return -ENOENT;
-       sprintf(tmp, "%d", pid);
+       sprintf(tmp, "%d", tgid);
        return vfs_readlink(dentry,buffer,buflen,tmp);
 }
 
 static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
        struct pid_namespace *ns = dentry->d_sb->s_fs_info;
-       pid_t pid = task_pid_nr_ns(current, ns);
+       pid_t tgid = task_tgid_nr_ns(current, ns);
        char tmp[PROC_NUMBUF];
-       if (!pid)
+       if (!tgid)
                return ERR_PTR(-ENOENT);
-       sprintf(tmp, "%d", pid);
+       sprintf(tmp, "%d", task_tgid_nr_ns(current, ns));
        return ERR_PTR(vfs_follow_link(nd,tmp));
 }