Skip to content

Commit 41301ae

Browse files
committed
vfs: Fix a regression in mounting proc
Gao feng <gaofeng@cn.fujitsu.com> reported that commit e51db73 userns: Better restrictions on when proc and sysfs can be mounted caused a regression on mounting a new instance of proc in a mount namespace created with user namespace privileges, when binfmt_misc is mounted on /proc/sys/fs/binfmt_misc. This is an unintended regression caused by the absolutely bogus empty directory check in fs_fully_visible. The check fs_fully_visible replaced didn't even bother to attempt to verify proc was fully visible and hiding proc files with any kind of mount is rare. So for now fix the userspace regression by allowing directory with nlink == 1 as /proc/sys/fs/binfmt_misc has. I will have a better patch but it is not stable material, or last minute kernel material. So it will have to wait. Cc: stable@vger.kernel.org Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Acked-by: Gao feng <gaofeng@cn.fujitsu.com> Tested-by: Gao feng <gaofeng@cn.fujitsu.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
1 parent 1f7f4dd commit 41301ae

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎fs/namespace.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2886,7 +2886,7 @@ bool fs_fully_visible(struct file_system_type *type)
28862886
struct inode *inode = child->mnt_mountpoint->d_inode;
28872887
if (!S_ISDIR(inode->i_mode))
28882888
goto next;
2889-
if (inode->i_nlink != 2)
2889+
if (inode->i_nlink > 2)
28902890
goto next;
28912891
}
28922892
visible = true;

0 commit comments

Comments
 (0)