linux-sg2042/fs/ntfs
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 fs/Kconfig: move ntfs out 2009-01-22 13:15:55 +03:00
Makefile fs: change to new flag variable 2011-03-17 14:02:57 +01:00
aops.c ntfs: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:25 +08:00
aops.h
attrib.c ntfs: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:25 +08:00
attrib.h
bitmap.c
bitmap.h
collate.c
collate.h
compress.c Fix common misspellings 2011-03-31 11:26:23 -03:00
debug.c
debug.h treewide: use __printf not __attribute__((format(printf,...))) 2011-10-31 17:30:54 -07:00
dir.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
dir.h
endian.h
file.c ntfs: drop vmtruncate 2012-12-20 18:40:55 -05:00
index.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
index.h
inode.c ntfs: drop vmtruncate 2012-12-20 18:40:55 -05:00
inode.h ntfs: drop vmtruncate 2012-12-20 18:40:55 -05:00
layout.h Typos: change aditional to additional. 2012-02-21 11:40:36 +01:00
lcnalloc.c
lcnalloc.h
logfile.c Fix common misspellings 2011-03-31 11:26:23 -03:00
logfile.h Fix common misspellings 2011-03-31 11:26:23 -03:00
malloc.h mm: replace various uses of num_physpages by totalram_pages 2009-09-22 07:17:38 -07:00
mft.c NTFS: Correct two spelling errors "dealocate" to "deallocate" in mft.c. 2012-02-24 09:17:09 +00:00
mft.h
mst.c
namei.c stop passing nameidata to ->lookup() 2012-07-14 16:34:32 +04:00
ntfs.h
quota.c
quota.h
runlist.c Fix common misspellings 2011-03-31 11:26:23 -03:00
runlist.h
super.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
sysctl.c sysctl: Drop & in front of every proc_handler. 2009-11-18 08:37:40 -08:00
sysctl.h
time.h
types.h
unistr.c
upcase.c
usnjrnl.c
usnjrnl.h ntfs: remove private wrapper of endian helpers 2009-04-01 08:59:18 -07:00
volume.h userns: Convert ntfs to use kuid and kgid where appropriate 2012-09-21 03:13:15 -07:00