linux/fs/afs
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
..
afs_cm.h
afs_fs.h
afs_vl.h AFS: Fix silly characters in a comment 2011-07-20 20:48:03 -04:00
afs.h afs: Support interacting with multiple user namespaces 2013-02-13 06:00:51 -08:00
cache.c Fix common misspellings 2011-03-31 11:26:23 -03:00
callback.c workqueue: use mod_delayed_work() instead of cancel + queue 2012-08-13 16:27:37 -07:00
cell.c Fix common misspellings 2011-03-31 11:26:23 -03:00
cmservice.c afs: add afs_wq and use it instead of the system workqueue 2011-01-14 09:25:11 -08:00
dir.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
file.c AFS: checking wrong bit in afs_readpages() 2012-03-20 11:14:38 -07:00
flock.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
fsclient.c afs: Support interacting with multiple user namespaces 2013-02-13 06:00:51 -08:00
inode.c afs: Support interacting with multiple user namespaces 2013-02-13 06:00:51 -08:00
internal.h afs: Read of file returns EBADMSG 2012-03-16 17:01:41 -07:00
Kconfig fs/afs: remove depends on CONFIG_EXPERIMENTAL 2013-01-21 14:39:04 -08:00
main.c afs: add afs_wq and use it instead of the system workqueue 2011-01-14 09:25:11 -08:00
Makefile
misc.c
mntpt.c stop passing nameidata to ->lookup() 2012-07-14 16:34:32 +04:00
netdevices.c
proc.c AFS: Implement an autocell mount capability [ver #2] 2010-08-11 17:11:29 +00:00
rxrpc.c afs: Remote abort can cause BUG in rxrpc code 2012-03-16 17:01:41 -07:00
security.c ->permission() sanitizing: don't pass flags to ->permission() 2011-07-20 01:43:24 -04:00
server.c workqueue: use mod_delayed_work() instead of cancel + queue 2012-08-13 16:27:37 -07:00
super.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
vlclient.c
vlocation.c workqueue: use mod_delayed_work() instead of cancel + queue 2012-08-13 16:27:37 -07:00
vnode.c
volume.c afs: add bdi backing to mount session. 2010-04-22 11:58:18 +02:00
write.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00