OpenCloudOS-Kernel/fs/jfs
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 jfs: needs crc32_le 2009-02-02 13:43:28 -06:00
Makefile fs/jfs: TRIM support for JFS Filesystem 2012-09-17 11:58:19 -05:00
acl.c userns: Pass a userns parameter into posix_acl_to_xattr and posix_acl_from_xattr 2012-09-18 01:01:35 -07:00
endian24.h JFS: Whitespace cleanup and remove some dead code 2007-06-06 15:28:35 -05:00
file.c jfs: drop vmtruncate 2012-12-20 18:40:52 -05:00
inode.c jfs: drop vmtruncate 2012-12-20 18:40:52 -05:00
ioctl.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
jfs_acl.h fs: take the ACL checks to common code 2011-07-25 14:30:23 -04:00
jfs_btree.h
jfs_debug.c proc 2/2: remove struct proc_dir_entry::owner 2009-03-31 01:14:44 +04:00
jfs_debug.h JFS: switch to seq_files 2008-05-13 08:22:10 -05:00
jfs_dinode.h BKL-removal: Implement a compat_ioctl handler for JFS 2008-02-07 13:45:29 -06:00
jfs_discard.c jfs: Fix FITRIM argument handling 2012-10-17 09:18:38 -05:00
jfs_discard.h fs/jfs: TRIM support for JFS Filesystem 2012-09-17 11:58:19 -05:00
jfs_dmap.c jfs: Fix do_div precision in commit b40c2e66 2012-09-18 11:27:22 -05:00
jfs_dmap.h fs/jfs: TRIM support for JFS Filesystem 2012-09-17 11:58:19 -05:00
jfs_dtree.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
jfs_dtree.h jfs: remove DIRENTSIZ 2008-06-10 15:12:58 -05:00
jfs_extent.c Fix common misspellings 2011-03-31 11:26:23 -03:00
jfs_extent.h
jfs_filsys.h fs/jfs: TRIM support for JFS Filesystem 2012-09-17 11:58:19 -05:00
jfs_imap.c userns: Convert jfs to use kuid/kgid where appropriate 2012-09-21 03:13:33 -07:00
jfs_imap.h JFS: Whitespace cleanup and remove some dead code 2007-06-06 15:28:35 -05:00
jfs_incore.h JFS TRIM support and some minor fixes 2012-10-03 08:48:21 -07:00
jfs_inode.c filesystems: add missing nlink wrappers 2011-11-02 12:53:43 +01:00
jfs_inode.h fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers 2011-07-20 20:47:59 -04:00
jfs_lock.h
jfs_logmgr.c freezer: unexport refrigerator() and update try_to_freeze() slightly 2011-11-21 12:32:22 -08:00
jfs_logmgr.h Fix common misspellings 2011-03-31 11:26:23 -03:00
jfs_metapage.c block: remove per-queue plugging 2011-03-10 08:52:07 +01:00
jfs_metapage.h Fix common misspellings 2011-03-31 11:26:23 -03:00
jfs_mount.c fix printk typo 'faild' 2010-08-09 11:25:17 +02:00
jfs_superblock.h
jfs_txnmgr.c JFS: use list_move instead of list_del/list_add 2012-09-17 12:00:17 -05:00
jfs_txnmgr.h JFS: Whitespace cleanup and remove some dead code 2007-06-06 15:28:35 -05:00
jfs_types.h jfs: remove xtLookupList() 2009-01-09 15:42:04 -06:00
jfs_umount.c jfs: flush journal completely before releasing metadata inodes 2011-08-01 12:41:00 -05:00
jfs_unicode.c
jfs_unicode.h 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
jfs_uniupr.c
jfs_xattr.h fs/vfs/security: pass last path component to LSM on inode creation 2011-02-01 11:12:29 -05:00
jfs_xtree.c dquot: cleanup space allocation / freeing routines 2010-03-05 00:20:28 +01:00
jfs_xtree.h jfs: remove xtLookupList() 2009-01-09 15:42:04 -06:00
namei.c don't expose I_NEW inodes via dentry->d_inode 2012-07-23 00:00:58 +04:00
resize.c jfs: old_agsize should be 64 bits in jfs_extendfs 2011-06-20 10:30:04 -05:00
super.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
symlink.c jfs: add jfs specific ->setattr call 2010-04-16 08:05:50 -05:00
xattr.c userns: Pass a userns parameter into posix_acl_to_xattr and posix_acl_from_xattr 2012-09-18 01:01:35 -07:00