Commit b55fcb22 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

revert "proc: fix the threaded proc self"

Revert commit c6caeb7c ("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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0cf975e1
...@@ -2102,22 +2102,22 @@ static int proc_self_readlink(struct dentry *dentry, char __user *buffer, ...@@ -2102,22 +2102,22 @@ static int proc_self_readlink(struct dentry *dentry, char __user *buffer,
int buflen) int buflen)
{ {
struct pid_namespace *ns = dentry->d_sb->s_fs_info; 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]; char tmp[PROC_NUMBUF];
if (!pid) if (!tgid)
return -ENOENT; return -ENOENT;
sprintf(tmp, "%d", pid); sprintf(tmp, "%d", tgid);
return vfs_readlink(dentry,buffer,buflen,tmp); return vfs_readlink(dentry,buffer,buflen,tmp);
} }
static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
{ {
struct pid_namespace *ns = dentry->d_sb->s_fs_info; 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]; char tmp[PROC_NUMBUF];
if (!pid) if (!tgid)
return ERR_PTR(-ENOENT); 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)); return ERR_PTR(vfs_follow_link(nd,tmp));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment