linux/arch/s390
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
..
appldata s390/time: rename tod clock access functions 2013-02-14 15:55:10 +01:00
boot s390: fix linker script for 31 bit builds 2012-10-18 17:50:10 +02:00
crypto s390/crypto: Don't panic after crypto instruction failures 2012-11-23 11:14:27 +01:00
hypfs fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
include s390/uaccess: remove pointless access_ok() checks 2013-02-28 09:37:09 +01:00
kernel Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-03-03 12:58:43 -08:00
kvm Merge tag 'kvm-3.9-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2013-02-24 13:07:18 -08:00
lib s390/uaccess: fix kernel ds access for page table walk 2013-02-28 09:37:12 +01:00
math-emu s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
mm s390/mm: ignore change bit for vmemmap 2013-02-28 09:37:06 +01:00
net s390/bpf,jit: add vlan tag support 2013-02-14 15:55:20 +01:00
oprofile s390/irq: remove split irq fields from /proc/stat 2013-01-08 10:57:07 +01:00
pci hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
Kbuild s390/pci: base support 2012-11-30 15:40:45 +01:00
Kconfig arch Kconfig: centralise CONFIG_ARCH_NO_VIRT_TO_BUS 2013-02-27 19:10:23 -08:00
Kconfig.debug s390/mm: add page table dumper 2012-10-09 14:16:58 +02:00
Makefile s390: use -fPIC for module compile 2013-01-12 18:49:26 +01:00
defconfig s390: update defconfig 2012-09-26 15:45:29 +02:00