linux/fs/ext3
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
..
Kconfig ext3: default to ordered mode 2010-07-23 12:50:55 +02:00
Makefile
acl.c userns: Convert extN to support kuids and kgids in posix acls 2012-09-18 01:01:36 -07:00
acl.h fs: take the ACL checks to common code 2011-07-25 14:30:23 -04:00
balloc.c ext3: Avoid underflow of in ext3_trim_fs() 2012-11-19 21:36:12 +01:00
bitmap.c ext3: use memweight() 2012-07-30 17:25:16 -07:00
dir.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
ext3.h Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs 2012-05-25 08:14:59 -07:00
ext3_jbd.c ext3: move headers to fs/ext3/ 2012-03-31 16:03:16 -04:00
file.c ext3: move headers to fs/ext3/ 2012-03-31 16:03:16 -04:00
fsync.c ext3: Check return value of blkdev_issue_flush() 2012-07-09 23:40:46 +02:00
hash.c ext3: return 32/64-bit dir name hash according to usage type 2012-05-15 23:34:39 +02:00
ialloc.c ext3: remove max_debt in find_group_orlov() 2012-04-11 11:12:44 +02:00
inode.c Ext3: return ENOMEM rather than EIO if sb_getblk fails 2013-01-21 11:19:57 +01:00
ioctl.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
namei.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
namei.h ext3: ext3_bread usage audit 2012-10-09 23:21:42 +02:00
resize.c Ext3: return ENOMEM rather than EIO if sb_getblk fails 2013-01-21 11:19:57 +01:00
super.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
symlink.c ext3: move headers to fs/ext3/ 2012-03-31 16:03:16 -04:00
xattr.c Ext3: return ENOMEM rather than EIO if sb_getblk fails 2013-01-21 11:19:57 +01:00
xattr.h fs/vfs/security: pass last path component to LSM on inode creation 2011-02-01 11:12:29 -05:00
xattr_security.c ext3: move headers to fs/ext3/ 2012-03-31 16:03:16 -04:00
xattr_trusted.c ext3: move headers to fs/ext3/ 2012-03-31 16:03:16 -04:00
xattr_user.c ext3: move headers to fs/ext3/ 2012-03-31 16:03:16 -04:00