linux/drivers/usb/gadget
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 tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
Makefile usb: gadget: f_acm: convert to new function interface with backwards compatibility 2013-01-21 20:52:43 +02:00
acm_ms.c usb: gadget: acm_ms: use function framework for ACM 2013-01-21 20:52:44 +02:00
amd5536udc.c usb: gadget: patches for v3.9 merge window 2013-01-25 09:08:05 -08:00
amd5536udc.h usb: gadget: amd5536udc: convert to udc_start/udc_stop 2013-01-24 21:11:17 +02:00
at91_udc.c USB patches for 3.9-rc1 2013-02-21 12:20:00 -08:00
at91_udc.h
atmel_usba_udc.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
atmel_usba_udc.h
audio.c
bcm63xx_udc.c usb: Convert to devm_ioremap_resource() 2013-01-22 11:41:58 -08:00
cdc2.c usb: gadget: cdc2: use function framework for ACM 2013-01-21 20:52:45 +02:00
composite.c usb: gadget: f_acm: use usb_gstrings_attach() 2013-01-21 20:52:48 +02:00
config.c usb: gadget: always update HS/SS descriptors and create a copy of them 2012-10-31 15:09:44 +02:00
dbgp.c usb: gadget: allocate & giveback serial ports instead hard code them 2013-01-21 20:52:43 +02:00
dummy_hcd.c usb: gadget: dummy: fix enumeration with g_multi 2012-12-13 11:58:46 +02:00
epautoconf.c
ether.c
f_acm.c usb: gadget: f_acm: use usb_gstrings_attach() 2013-01-21 20:52:48 +02:00
f_ecm.c usb: gadget: let f_* use usb_string_ids_tab() where it makes sense 2012-10-31 15:11:47 +02:00
f_eem.c usb: gadget: always update HS/SS descriptors and create a copy of them 2012-10-31 15:09:44 +02:00
f_fs.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
f_hid.c usb: gadget: always update HS/SS descriptors and create a copy of them 2012-10-31 15:09:44 +02:00
f_loopback.c usb: gadget: convert source sink and loopback to new function interface 2013-01-21 20:52:40 +02:00
f_mass_storage.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
f_midi.c usb: gadget: always update HS/SS descriptors and create a copy of them 2012-10-31 15:09:44 +02:00
f_ncm.c usb: gadget: ncm: make global variable ndp*_opts read only 2013-01-10 12:25:12 +02:00
f_obex.c usb: gadget: allocate & giveback serial ports instead hard code them 2013-01-21 20:52:43 +02:00
f_phonet.c usb: gadget: always update HS/SS descriptors and create a copy of them 2012-10-31 15:09:44 +02:00
f_rndis.c usb: gadget: let f_* use usb_string_ids_tab() where it makes sense 2012-10-31 15:11:47 +02:00
f_serial.c usb: gadget: allocate & giveback serial ports instead hard code them 2013-01-21 20:52:43 +02:00
f_sourcesink.c usb: gadget: convert source sink and loopback to new function interface 2013-01-21 20:52:40 +02:00
f_subset.c usb: gadget: let f_* use usb_string_ids_tab() where it makes sense 2012-10-31 15:11:47 +02:00
f_uac1.c usb: gadget: always update HS/SS descriptors and create a copy of them 2012-10-31 15:09:44 +02:00
f_uac2.c usb: gadget: f_uac2: fix compile warning 2013-01-21 20:52:49 +02:00
f_uvc.c drivers/usb/gadget: using strlcpy instead of strncpy 2013-02-06 11:38:13 -08:00
f_uvc.h
fsl_mxc_udc.c usb: gadget: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap 2013-01-18 14:08:21 +02:00
fsl_qe_udc.c usb: gadget: constify all struct usb_gadget_ops 2013-01-24 21:11:35 +02:00
fsl_qe_udc.h
fsl_udc_core.c Merge 3.8-rc5 into usb-next 2013-01-25 12:41:02 -08:00
fsl_usb2_udc.h usb: gadget: fsl_mxc_udc: replace MX35_IO_ADDRESS to ioremap 2013-01-18 14:08:21 +02:00
functions.c usb: gadget: add a forward pointer from usb_function to its "instance" 2013-01-21 20:52:46 +02:00
fusb300_udc.c USB patches for 3.9-rc1 2013-02-21 12:20:00 -08:00
fusb300_udc.h usb: gadget: fusb300_udc: convert to udc_start/udc_stop 2013-01-24 21:11:28 +02:00
g_ffs.c
g_zero.h usb: gadget: convert source sink and loopback to new function interface 2013-01-21 20:52:40 +02:00
gadget_chips.h
gmidi.c usb: gadget: consider link speed for bMaxPower 2013-01-10 12:38:52 +02:00
goku_udc.c usb: gadget: goku_udc: convert to udc_start/udc_stop 2013-01-24 21:11:28 +02:00
goku_udc.h usb: gadget: goku_udc: convert to udc_start/udc_stop 2013-01-24 21:11:28 +02:00
hid.c usb: remove use of __devexit 2012-11-21 13:27:17 -08:00
imx_udc.c usb: converto drivers/usb/* to use module_platform_driver_probe() 2013-01-17 17:39:34 -08:00
imx_udc.h
inode.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
lpc32xx_udc.c usb: converto drivers/usb/* to use module_platform_driver_probe() 2013-01-17 17:39:34 -08:00
m66592-udc.c USB patches for 3.9-rc1 2013-02-21 12:20:00 -08:00
m66592-udc.h usb: gadget: m66592-udc: convert to udc_start/udc_stop 2013-01-24 21:11:29 +02:00
mass_storage.c
multi.c usb: gadget: multi: use function framework for ACM 2013-01-21 20:52:45 +02:00
mv_u3d.h
mv_u3d_core.c usb: remove use of __devexit 2012-11-21 13:27:17 -08:00
mv_udc.h
mv_udc_core.c usb: gadget: patches for v3.9 merge window 2013-01-25 09:08:05 -08:00
ncm.c
ndis.h
net2272.c usb: remove use of __devexit 2012-11-21 13:27:17 -08:00
net2272.h
net2280.c USB: GADGET: optionally force full-speed for net2280 UDC 2013-01-31 10:09:19 +01:00
net2280.h
nokia.c usb: gadget: f_acm: convert to new function interface with backwards compatibility 2013-01-21 20:52:43 +02:00
omap_udc.c usb: gadget: constify all struct usb_gadget_ops 2013-01-24 21:11:35 +02:00
omap_udc.h
pch_udc.c usb: gadget: pch_udc: convert to udc_start/udc_stop 2013-01-24 21:11:30 +02:00
printer.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
pxa25x_udc.c USB patches for 3.9-rc1 2013-02-21 12:20:00 -08:00
pxa25x_udc.h usb: gadget: pxa25x_udc: convert to udc_start/udc_stop 2013-01-24 21:11:31 +02:00
pxa27x_udc.c usb: gadget: pxa27x_udc: convert to udc_start/udc_stop 2013-01-24 21:11:31 +02:00
pxa27x_udc.h usb: gadget: pxa27x_udc: convert to udc_start/udc_stop 2013-01-24 21:11:31 +02:00
r8a66597-udc.c USB patches for 3.9-rc1 2013-02-21 12:20:00 -08:00
r8a66597-udc.h
rndis.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
rndis.h
s3c-hsotg.c USB patches for 3.9-rc1 2013-02-21 12:20:00 -08:00
s3c-hsotg.h
s3c-hsudc.c USB patches for 3.9-rc1 2013-02-21 12:20:00 -08:00
s3c2410_udc.c usb: gadget: s3c2410: convert to udc_start/udc_stop 2013-01-24 21:11:32 +02:00
s3c2410_udc.h usb: gadget: s3c2410: convert to udc_start/udc_stop 2013-01-24 21:11:32 +02:00
serial.c usb: gadget: f_acm: convert to new function interface with backwards compatibility 2013-01-21 20:52:43 +02:00
storage_common.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
tcm_usb_gadget.c usb: gadget: tcm_usb_gadge: fix to return error or 0 in tcm_usbg_drop_nexus() 2012-12-13 12:04:00 +02:00
tcm_usb_gadget.h
u_ether.c ethtool: fix drvinfo strings set in drivers 2013-01-06 21:06:31 -08:00
u_ether.h
u_phonet.h
u_serial.c tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
u_serial.h usb: gadget: f_acm: convert to new function interface with backwards compatibility 2013-01-21 20:52:43 +02:00
u_uac1.c
u_uac1.h
udc-core.c usb: gadget: completely remove ->start/->stop 2013-01-24 21:11:32 +02:00
usbstring.c
uvc.h
uvc_queue.c
uvc_queue.h
uvc_v4l2.c
uvc_video.c
webcam.c usb: gadget: consider link speed for bMaxPower 2013-01-10 12:38:52 +02:00
zero.c usb: gadget: fix two sparse warnings 2013-01-21 20:52:49 +02:00