diff -NurpP --minimal linux-2.6.19.7-vs2.2.0-rc19/fs/proc/base.c linux-2.6.19.7-vs2.2.0-rc19.2/fs/proc/base.c --- linux-2.6.19.7-vs2.2.0-rc19/fs/proc/base.c 2007-02-25 21:34:37 +0100 +++ linux-2.6.19.7-vs2.2.0-rc19.2/fs/proc/base.c 2007-03-24 15:26:14 +0100 @@ -1028,13 +1028,19 @@ static int pid_revalidate(struct dentry { struct inode *inode = dentry->d_inode; struct task_struct *task = get_proc_task(inode); - int ret = 0; - if (task) { - if (!vx_proc_task_visible(task)) - goto out_put; + int evil_hack = (dentry->d_name.len == 1) && + (dentry->d_name.name[0] == '1') && + (!vx_is_init(task)); - ret = 1; + if (!vx_proc_task_visible(task) || evil_hack) { + shrink_dcache_parent(dentry); + d_drop(dentry); + dput(dentry); + put_task_struct(task); + return 0; + } + if ((inode->i_mode == (S_IFDIR|S_IRUGO|S_IXUGO)) || task_dumpable(task)) { inode->i_uid = task->euid; @@ -1045,12 +1051,11 @@ static int pid_revalidate(struct dentry } inode->i_mode &= ~(S_ISUID | S_ISGID); security_task_to_inode(task, inode); - out_put: put_task_struct(task); + return 1; } - if (!ret) - d_drop(dentry); - return ret; + d_drop(dentry); + return 0; } static int pid_delete_dentry(struct dentry * dentry) diff -NurpP --minimal linux-2.6.19.7-vs2.2.0-rc19/include/linux/vserver/base.h linux-2.6.19.7-vs2.2.0-rc19.2/include/linux/vserver/base.h --- linux-2.6.19.7-vs2.2.0-rc19/include/linux/vserver/base.h 2006-11-30 19:29:45 +0100 +++ linux-2.6.19.7-vs2.2.0-rc19.2/include/linux/vserver/base.h 2007-03-24 15:24:02 +0100 @@ -224,6 +224,10 @@ static inline int __vs_check(int cid, in (current->vx_info && \ (current->vx_info->vx_initpid == (n))) +#define vx_is_init(t) \ + ((!(t)->xid && ((t)->pid == 1)) \ + || vx_current_initpid((t)->pid)) + #define __vx_state(v) ((v) ? ((v)->vx_state) : 0)