OpenCloudOS-Kernel/drivers/infiniband/hw/qib
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 RDMA: Add netlink infrastructure 2011-05-20 11:46:11 -07:00
Makefile IB/qib: Use request_firmware() to load SD7220 firmware 2010-07-08 13:27:05 -07:00
qib.h make drivers with pci error handlers const 2012-09-07 16:35:00 -06:00
qib_6120_regs.h IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters 2010-05-23 21:44:54 -07:00
qib_7220.h IB/qib: Eliminate 64-bit jiffies use 2012-01-03 20:52:12 -08:00
qib_7220_regs.h IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters 2010-05-23 21:44:54 -07:00
qib_7322_regs.h IB/qib: Mask hardware error during link reset 2010-07-06 14:13:20 -07:00
qib_common.h IB/qib: Add a qib driver version 2012-09-30 20:36:29 -07:00
qib_cq.c IB/qib: Generate completion callback on errors 2011-01-10 17:42:19 -08:00
qib_diag.c IB/qib: checkpatch fixes 2012-07-19 11:20:04 -07:00
qib_dma.c IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters 2010-05-23 21:44:54 -07:00
qib_driver.c IB/qib: Add a qib driver version 2012-09-30 20:36:29 -07:00
qib_eeprom.c IB/qib: checkpatch fixes 2012-07-19 11:20:04 -07:00
qib_file_ops.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
qib_fs.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
qib_iba6120.c IB/qib: checkpatch fixes 2012-07-19 11:20:04 -07:00
qib_iba7220.c IB/qib: checkpatch fixes 2012-07-19 11:20:04 -07:00
qib_iba7322.c IB/qib: Fix error return code in qib_init_7322_variables() 2012-08-15 11:58:21 -07:00
qib_init.c IB/qib: convert to idr_alloc() 2013-02-27 19:10:17 -08:00
qib_intr.c IB/qib: checkpatch fixes 2012-07-19 11:20:04 -07:00
qib_keys.c IB/qib: Fix local access validation for user MRs 2012-10-01 09:59:26 -07:00
qib_mad.c IB/qib: Fix failure of compliance test C14-024#06_LocalPortNum 2012-09-14 10:42:32 -07:00
qib_mad.h IB/qib: Add congestion control agent implementation 2012-07-19 11:20:04 -07:00
qib_mmap.c IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters 2010-05-23 21:44:54 -07:00
qib_mr.c IB/qib: RCU locking for MR validation 2012-07-08 18:05:19 -07:00
qib_pcie.c Merge branch 'pci/stephen-const' into next 2012-09-12 13:54:10 -06:00
qib_pio_copy.c IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters 2010-05-23 21:44:54 -07:00
qib_qp.c IB/qib: Fix QP locate/remove race 2013-02-14 17:04:18 -08:00
qib_qsfp.c IB/qib: Fix over-scheduling of QSFP work 2011-11-28 12:17:33 -08:00
qib_qsfp.h IB/qib: Eliminate 64-bit jiffies use 2012-01-03 20:52:12 -08:00
qib_rc.c IB/qib: Avoid returning EBUSY from MR deregister 2012-07-08 18:05:19 -07:00
qib_ruc.c IB/qib: Avoid returning EBUSY from MR deregister 2012-07-08 18:05:19 -07:00
qib_sd7220.c IB: Fix typos in infiniband drivers 2012-08-15 11:56:19 -07:00
qib_sdma.c IB/qib: checkpatch fixes 2012-07-19 11:20:04 -07:00
qib_srq.c RDMA/core: Add SRQ type field 2011-10-13 09:13:26 -07:00
qib_sysfs.c IB/qib: checkpatch fixes 2012-07-19 11:20:04 -07:00
qib_twsi.c IB/qib: checkpatch fixes 2012-07-19 11:20:04 -07:00
qib_tx.c IB/qib: Optimize pio ack buffer allocation 2012-05-14 12:37:03 -07:00
qib_uc.c IB/qib: Avoid returning EBUSY from MR deregister 2012-07-08 18:05:19 -07:00
qib_ud.c IB/qib: Avoid returning EBUSY from MR deregister 2012-07-08 18:05:19 -07:00
qib_user_pages.c mm: distinguish between mlocked and pinned pages 2011-10-31 17:30:46 -07:00
qib_user_sdma.c Fix common misspellings 2011-03-31 11:26:23 -03:00
qib_user_sdma.h IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters 2010-05-23 21:44:54 -07:00
qib_verbs.c IB/qib: Add a qib driver version 2012-09-30 20:36:29 -07:00
qib_verbs.h IB/qib: Reduce sdma_lock contention 2012-07-19 11:19:58 -07:00
qib_verbs_mcast.c IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters 2010-05-23 21:44:54 -07:00
qib_wc_ppc64.c IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters 2010-05-23 21:44:54 -07:00
qib_wc_x86_64.c IB/qib: checkpatch fixes 2012-07-19 11:20:04 -07:00