diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2008-02-08 07:18:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:24 -0500 |
commit | c6caeb7c4544608e8ae62731334661fc396c7f85 (patch) | |
tree | 3afabe64dedd7bf7d0f88f7612e5f468c8d55c1d /fs/proc/base.c | |
parent | 488e5bc4560d0b510c1ddc451c51a6cc14e3a930 (diff) |
proc: fix the threaded /proc/self
Long ago when the CLONE_THREAD support first went it someone thought it
would be wise to point /proc/self at /proc/<tgid> instead of /proc/<pid>.
Given that /proc/<tgid> can return information about a very different task
(if enough things have been unshared) then our current process /proc/<tgid>
seems blatantly wrong. So far I have yet to think up an example where the
current behavior would be advantageous, and I can see several places where
it is seriously non-intuitive.
We may be stuck with the current broken behavior for backwards
compatibility reasons but lets try fixing our ancient bug for the 2.6.25
time frame and see if anyone screams.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: 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>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 75b1979749a5..de07e959ff2f 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -2102,22 +2102,22 @@ static int proc_self_readlink(struct dentry *dentry, char __user *buffer, | |||
2102 | int buflen) | 2102 | int buflen) |
2103 | { | 2103 | { |
2104 | struct pid_namespace *ns = dentry->d_sb->s_fs_info; | 2104 | struct pid_namespace *ns = dentry->d_sb->s_fs_info; |
2105 | pid_t tgid = task_tgid_nr_ns(current, ns); | 2105 | pid_t pid = task_pid_nr_ns(current, ns); |
2106 | char tmp[PROC_NUMBUF]; | 2106 | char tmp[PROC_NUMBUF]; |
2107 | if (!tgid) | 2107 | if (!pid) |
2108 | return -ENOENT; | 2108 | return -ENOENT; |
2109 | sprintf(tmp, "%d", tgid); | 2109 | sprintf(tmp, "%d", pid); |
2110 | return vfs_readlink(dentry,buffer,buflen,tmp); | 2110 | return vfs_readlink(dentry,buffer,buflen,tmp); |
2111 | } | 2111 | } |
2112 | 2112 | ||
2113 | static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) | 2113 | static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd) |
2114 | { | 2114 | { |
2115 | struct pid_namespace *ns = dentry->d_sb->s_fs_info; | 2115 | struct pid_namespace *ns = dentry->d_sb->s_fs_info; |
2116 | pid_t tgid = task_tgid_nr_ns(current, ns); | 2116 | pid_t pid = task_pid_nr_ns(current, ns); |
2117 | char tmp[PROC_NUMBUF]; | 2117 | char tmp[PROC_NUMBUF]; |
2118 | if (!tgid) | 2118 | if (!pid) |
2119 | return ERR_PTR(-ENOENT); | 2119 | return ERR_PTR(-ENOENT); |
2120 | sprintf(tmp, "%d", task_tgid_nr_ns(current, ns)); | 2120 | sprintf(tmp, "%d", pid); |
2121 | return ERR_PTR(vfs_follow_link(nd,tmp)); | 2121 | return ERR_PTR(vfs_follow_link(nd,tmp)); |
2122 | } | 2122 | } |
2123 | 2123 | ||