linux_dsm_epyc7002/fs/9p
Eric W. Biederman 7f78e03513 fs: Limit sys_mount to only request filesystem modules.
Modify the request_module to prefix the file system type with "fs-"
and add aliases to all of the filesystems that can be built as modules
to match.

A common practice is to build all of the kernel code and leave code
that is not commonly needed as modules, with the result that many
users are exposed to any bug anywhere in the kernel.

Looking for filesystems with a fs- prefix limits the pool of possible
modules that can be loaded by mount to just filesystems trivially
making things safer with no real cost.

Using aliases means user space can control the policy of which
filesystem modules are auto-loaded by editing /etc/modprobe.d/*.conf
with blacklist and alias directives.  Allowing simple, safe,
well understood work-arounds to known problematic software.

This also addresses a rare but unfortunate problem where the filesystem
name is not the same as it's module name and module auto-loading
would not work.  While writing this patch I saw a handful of such
cases.  The most significant being autofs that lives in the module
autofs4.

This is relevant to user namespaces because we can reach the request
module in get_fs_type() without having any special permissions, and
people get uncomfortable when a user specified string (in this case
the filesystem type) goes all of the way to request_module.

After having looked at this issue I don't think there is any
particular reason to perform any filtering or permission checks beyond
making it clear in the module request that we want a filesystem
module.  The common pattern in the kernel is to call request_module()
without regards to the users permissions.  In general all a filesystem
module does once loaded is call register_filesystem() and go to sleep.
Which means there is not much attack surface exposed by loading a
filesytem module unless the filesystem is mounted.  In a user
namespace filesystems are not mounted unless .fs_flags = FS_USERNS_MOUNT,
which most filesystems do not set today.

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Acked-by: Kees Cook <keescook@chromium.org>
Reported-by: Kees Cook <keescook@google.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2013-03-03 19:36:31 -08:00
..
acl.c 9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate() 2013-02-26 02:46:07 -05:00
acl.h 9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate() 2013-02-26 02:46:07 -05:00
cache.c 9p: Reduce object size with CONFIG_NET_9P_DEBUG 2012-01-05 10:51:44 -06:00
cache.h fs/9p: When doing inode lookup compare qid details and inode mode bits. 2011-07-23 09:32:48 -05:00
fid.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-03-03 13:23:03 -08:00
fid.h 9p: v9fs_fid_add() can't fail now 2013-02-28 01:18:14 -05:00
Kconfig fs/9p: remove depends on CONFIG_EXPERIMENTAL 2013-01-21 14:39:04 -08:00
Makefile fs/9p: Move dotl inode operations into a seperate file 2011-01-11 09:58:07 -06:00
v9fs_vfs.h 9p: propagate umode_t 2012-01-03 22:55:01 -05:00
v9fs.c 9p: Modify struct v9fs_session_info to use a kuids and kgids 2013-02-12 03:19:33 -08:00
v9fs.h 9p: Modify struct v9fs_session_info to use a kuids and kgids 2013-02-12 03:19:33 -08:00
vfs_addr.c 9p: Reduce object size with CONFIG_NET_9P_DEBUG 2012-01-05 10:51:44 -06:00
vfs_dentry.c v9fs: get rid of v9fs_dentry 2013-02-28 01:13:19 -05:00
vfs_dir.c locking in fs/9p ->readdir() 2013-02-10 16:29:33 -06:00
vfs_file.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
vfs_inode_dotl.c 9p: v9fs_fid_add() can't fail now 2013-02-28 01:18:14 -05:00
vfs_inode.c 9p: make sure ->lookup() adds fid to the right dentry 2013-02-28 01:29:48 -05:00
vfs_super.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
xattr_user.c fs/9p: Add support user. xattr 2010-08-02 14:28:35 -05:00
xattr.c 9p: add fid-based variant of v9fs_xattr_set() 2013-02-26 02:46:05 -05:00
xattr.h 9p: add fid-based variant of v9fs_xattr_set() 2013-02-26 02:46:05 -05:00