X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fproc%2Fbase.c;h=6dc5b01752c164a9e3423009ea88251379c98521;hb=8e8ece46a861c84343256819eaec77e608ff9217;hp=28e49e94a6ea03bb60252c283f2ed083c9b435dd;hpb=6a77f38946aaee1cd85eeec6cf4229b204c15071;p=linux-2.6.git diff --git a/fs/proc/base.c b/fs/proc/base.c index 28e49e94a..6dc5b0175 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -1112,7 +1112,7 @@ static int pid_revalidate(struct dentry *dentry, struct nameidata *nd) struct inode *inode = dentry->d_inode; struct task_struct *task = proc_task(inode); - if (!vx_check(vx_task_xid(task), VX_WATCH|VX_IDENT)) + if (!vx_check(vx_task_xid(task), VX_IDENT)) goto out_drop; /* discard wrong fakeinit */ @@ -1702,6 +1702,20 @@ void proc_pid_flush(struct dentry *proc_dentry) } } +#define VXF_FAKE_INIT (VXF_INFO_INIT|VXF_STATE_INIT) + +static inline int proc_pid_visible(struct task_struct *task, int pid) +{ + if ((pid == 1) && + !vx_flags(VXF_FAKE_INIT, VXF_FAKE_INIT)) + goto visible; + if (vx_check(vx_task_xid(task), VX_WATCH|VX_IDENT)) + goto visible; + return 0; +visible: + return 1; +} + /* SMP-safe */ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd) { @@ -1738,7 +1752,8 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct if (!task) goto out; - if (!vx_check(vx_task_xid(task), VX_WATCH|VX_IDENT)) + /* check for context visibility */ + if (!proc_pid_visible(task, tgid)) goto out_drop_task; inode = proc_pid_make_inode(dir->i_sb, task, PROC_TGID_INO); @@ -1799,7 +1814,8 @@ static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry if (leader->tgid != task->tgid) goto out_drop_task; - if (!vx_check(vx_task_xid(task), VX_WATCH|VX_IDENT)) + /* check for context visibility */ + if (!proc_pid_visible(task, tid)) goto out_drop_task; inode = proc_pid_make_inode(dir->i_sb, task, PROC_TID_INO); @@ -1856,7 +1872,8 @@ static int get_tgid_list(int index, unsigned long version, unsigned int *tgids) if (!pid_alive(p)) continue; - if (!vx_check(vx_task_xid(p), VX_WATCH|VX_IDENT)) + /* check for context visibility */ + if (!proc_pid_visible(p, tgid)) continue; if (--index >= 0) continue; @@ -1890,7 +1907,8 @@ static int get_tid_list(int index, unsigned int *tids, struct inode *dir) if (pid_alive(task)) do { int tid = task->pid; - if (!vx_check(vx_task_xid(task), VX_WATCH|VX_IDENT)) + /* check for context visibility */ + if (!proc_pid_visible(task, tid)) continue; if (--index >= 0) continue;