]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mnt: Update fs_fully_visible to test for permanently empty directories
authorEric W. Biederman <ebiederm@xmission.com>
Thu, 14 May 2015 01:51:09 +0000 (20:51 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Jul 2015 17:10:01 +0000 (10:10 -0700)
commit8e7c56b6f14d1388d5aa2feb5b28dd6360199cef
treecde027e2f53420b61873dd60c80aceea4b3c3e0b
parent28dd1f346b2f0fc2ab8285046ed0bd91e9b808d3
mnt: Update fs_fully_visible to test for permanently empty directories

commit 7236c85e1be51a9e25ba0f6e087a66ca89605a49 upstream.

fs_fully_visible attempts to make fresh mounts of proc and sysfs give
the mounter no more access to proc and sysfs than if they could have
by creating a bind mount.  One aspect of proc and sysfs that makes
this particularly tricky is that there are other filesystems that
typically mount on top of proc and sysfs.  As those filesystems are
mounted on empty directories in practice it is safe to ignore them.
However testing to ensure filesystems are mounted on empty directories
has not been something the in kernel data structures have supported so
the current test for an empty directory which checks to see
if nlink <= 2 is a bit lacking.

proc and sysfs have recently been modified to use the new empty_dir
infrastructure to create all of their dedicated mount points.  Instead
of testing for S_ISDIR(inode->i_mode) && i_nlink <= 2 to see if a
directory is empty, test for is_empty_dir_inode(inode).  That small
change guaranteess mounts found on proc and sysfs really are safe to
ignore, because the directories are not only empty but nothing can
ever be added to them.  This guarantees there is nothing to worry
about when mounting proc and sysfs.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/namespace.c