kernel-ark/fs/btrfs
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 Btrfs: skip adding an acl attribute if we don't have to 2012-12-16 20:46:15 -05:00
async-thread.c
async-thread.h
backref.c Btrfs: fix backref walking race with tree deletions 2013-02-26 11:00:50 -05:00
backref.h Btrfs: move fs/btrfs/ioctl.h to include/uapi/linux/btrfs.h 2013-02-20 09:37:28 -05:00
btrfs_inode.h Btrfs: serialize unlocked dio reads with truncate 2013-02-20 12:59:47 -05:00
check-integrity.c btrfs: define BTRFS_MAGIC as a u64 value 2013-02-20 13:00:01 -05:00
check-integrity.h
compat.h
compression.c Btrfs: add rw argument to merge_bio_hook() 2013-02-01 11:49:47 -05:00
compression.h
ctree.c btrfs: remove cache only arguments from defrag path 2013-02-20 12:59:36 -05:00
ctree.h Btrfs: fix wrong reserved space in qgroup during snap/subv creation 2013-02-28 13:33:54 -05:00
delayed-inode.c btrfs: remove unused "item" in btrfs_insert_delayed_item() 2013-02-20 12:59:23 -05:00
delayed-inode.h Btrfs: fix lots of orphan inodes when the space is not enough 2013-02-20 09:36:39 -05:00
delayed-ref.c Btrfs: make delayed ref lock logic more readable 2013-02-20 09:36:41 -05:00
delayed-ref.h Merge branch 'raid56-experimental' into for-linus-3.9 2013-02-20 14:06:05 -05:00
dev-replace.c Btrfs: check the return value of btrfs_start_delalloc_inodes() 2013-02-20 09:37:21 -05:00
dev-replace.h Btrfs: add new sources for device replace code 2012-12-12 17:15:41 -05:00
dir-item.c Btrfs: fix hash overflow handling 2012-12-17 14:48:21 -05:00
disk-io.c btrfs: try harder to allocate raid56 stripe cache 2013-03-01 10:13:05 -05:00
disk-io.h Btrfs: RAID5 and RAID6 2013-02-01 14:24:23 -05:00
export.c fs: encode_fh: return FILEID_INVALID if invalid fid_type 2013-02-26 02:46:10 -05:00
export.h
extent_io.c btrfs: fixup/remove module.h usage as required 2013-03-01 15:01:01 -05:00
extent_io.h btrfs: use only inline_pages from extent buffer 2013-02-28 13:33:56 -05:00
extent_map.c btrfs: fixup/remove module.h usage as required 2013-03-01 15:01:01 -05:00
extent_map.h Btrfs: do not allow logged extents to be merged or removed 2013-01-24 12:49:48 -05:00
extent-tree.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs 2013-03-02 16:41:54 -08:00
file-item.c Btrfs: extend the checksum item as much as possible 2013-02-20 12:59:37 -05:00
file.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs 2013-03-02 16:41:54 -08:00
free-space-cache.c Merge branch 'raid56-experimental' into for-linus-3.9 2013-02-20 14:06:05 -05:00
free-space-cache.h
hash.h
inode-item.c
inode-map.c
inode-map.h
inode.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs 2013-03-02 16:41:54 -08:00
ioctl.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs 2013-03-02 16:41:54 -08:00
Kconfig Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs 2013-03-02 16:41:54 -08:00
locking.c Btrfs: save us a read_lock 2013-02-20 09:37:17 -05:00
locking.h
lzo.c
Makefile Btrfs: RAID5 and RAID6 2013-02-01 14:24:23 -05:00
math.h
ordered-data.c Btrfs: place ordered operations on a per transaction list 2013-02-20 12:59:57 -05:00
ordered-data.h Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next into for-linus-3.9 2013-02-20 14:05:45 -05:00
orphan.c
print-tree.c btrfs: add missing break in btrfs_print_leaf() 2013-02-20 12:59:20 -05:00
print-tree.h
qgroup.c Btrfs: remove reduplicate check about root in the function btrfs_clean_quota_tree 2013-03-01 10:13:04 -05:00
raid56.c btrfs/raid56: Add missing #include <linux/vmalloc.h> 2013-03-03 06:53:41 -05:00
raid56.h Btrfs: RAID5 and RAID6 2013-02-01 14:24:23 -05:00
rcu-string.h
reada.c Btrfs: introduce GET_READ_MIRRORS functionality for btrfs_map_block() 2012-12-12 17:15:43 -05:00
relocation.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs 2013-03-02 16:41:54 -08:00
root-tree.c Btrfs: rename root_times_lock to root_item_lock 2012-12-16 20:46:21 -05:00
scrub.c Merge branch 'raid56-experimental' into for-linus-3.9 2013-02-20 14:06:05 -05:00
send.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs 2013-03-02 16:41:54 -08:00
send.h btrfs: add "no file data" flag to btrfs send ioctl 2013-02-20 12:59:39 -05:00
struct-funcs.c
super.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
sysfs.c btrfs: fixup/remove module.h usage as required 2013-03-01 15:01:01 -05:00
transaction.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs 2013-03-02 16:41:54 -08:00
transaction.h Btrfs: fix wrong reserved space in qgroup during snap/subv creation 2013-02-28 13:33:54 -05:00
tree-defrag.c btrfs: remove cache only arguments from defrag path 2013-02-20 12:59:36 -05:00
tree-log.c Btrfs: delete inline extents when we find them during logging 2013-03-01 11:47:21 -05:00
tree-log.h
ulist.c btrfs: fixup/remove module.h usage as required 2013-03-01 15:01:01 -05:00
ulist.h
version.h
volumes.c btrfs: remove a printk from scan_one_device 2013-02-28 13:33:52 -05:00
volumes.h Merge branch 'raid56-experimental' into for-linus-3.9 2013-02-20 14:06:05 -05:00
xattr.c Btrfs: only log the inode item if we can get away with it 2012-12-16 20:46:21 -05:00
xattr.h
zlib.c