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 */
}
}
+#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)
{
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);
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);
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;
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;