OpenCloudOS-Kernel/drivers/infiniband/hw/ipath
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 IB/ipath: Remove support for QLogic PCIe QLE devices 2010-05-23 22:14:25 -07:00
Makefile IB: Replace EXTRA_CFLAGS with ccflags-y 2010-10-23 13:45:03 -07:00
ipath_common.h IB/ipath: Update copyright dates for files changed in 2008 2008-04-16 21:09:32 -07:00
ipath_cq.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
ipath_debug.h IB/ipath: Prevent link-recovery code from negating admin disable 2008-04-16 21:09:26 -07:00
ipath_diag.c infiniband: add in export.h for files using EXPORT_SYMBOL/THIS_MODULE 2011-10-31 19:31:35 -04:00
ipath_dma.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
ipath_driver.c IB/ipath: convert to idr_alloc() 2013-02-27 19:10:17 -08:00
ipath_eeprom.c IB: Remove __constant_{endian} uses 2009-01-17 17:11:57 -08:00
ipath_file_ops.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
ipath_fs.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
ipath_iba6110.c IB/ipath: Replace open-coded ARRAY_SIZE with macro 2012-05-08 11:17:20 -07:00
ipath_init_chip.c IB/ipath: Remove unreachable code 2012-11-22 00:50:51 -08:00
ipath_intr.c IB/ipath: Replace open-coded ARRAY_SIZE with macro 2012-05-08 11:17:20 -07:00
ipath_kernel.h IB/ipath: Remove support for QLogic PCIe QLE devices 2010-05-23 22:14:25 -07:00
ipath_keys.c IB/ipath: Add locking for interrupt use of ipath_pd contexts vs free 2008-12-05 11:14:38 -08:00
ipath_mad.c IB/pma: Add include file for IBA performance counters definitions 2011-07-18 21:04:35 -07:00
ipath_mmap.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
ipath_mr.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
ipath_qp.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
ipath_rc.c IB: Remove __constant_{endian} uses 2009-01-17 17:11:57 -08:00
ipath_registers.h IB/ipath: Header file changes to support IBA7220 2008-04-16 21:09:30 -07:00
ipath_ruc.c headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
ipath_sdma.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
ipath_srq.c RDMA/core: Add SRQ type field 2011-10-13 09:13:26 -07:00
ipath_stats.c IB/ipath: Don't count IB symbol and link errors unless link is UP 2008-12-05 11:13:19 -08:00
ipath_sysfs.c infiniband: Fix up users implicitly relying on getting stat.h 2011-10-31 19:31:34 -04:00
ipath_uc.c IB: Remove __constant_{endian} uses 2009-01-17 17:11:57 -08:00
ipath_ud.c Fix common misspellings 2011-03-31 11:26:23 -03:00
ipath_user_pages.c mm: distinguish between mlocked and pinned pages 2011-10-31 17:30:46 -07:00
ipath_user_sdma.c Fix common misspellings 2011-03-31 11:26:23 -03:00
ipath_user_sdma.h IB/ipath: Fix many locking issues when switching to error state 2008-05-13 11:41:29 -07:00
ipath_verbs.c infiniband: Fix up module files that need to include module.h 2011-10-31 19:31:35 -04:00
ipath_verbs.h IB: Remove __constant_{endian} uses 2009-01-17 17:11:57 -08:00
ipath_verbs_mcast.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
ipath_wc_ppc64.c IB/ipath: Update copyright dates 2007-07-09 20:12:26 -07:00
ipath_wc_x86_64.c IB/ipath: Update copyright dates 2007-07-09 20:12:26 -07:00