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
..
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 usb: gadget: Update at91_udc to use usb_endpoint_descriptor inside the struct usb_ep 2012-05-04 15:52:53 +03:00
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 usb: gadget: Update atmel_usba_udc to use usb_endpoint_descriptor inside the struct usb_ep 2012-05-04 15:52:53 +03:00
audio.c usb: gadget: remove usb_gadget_controller_number() 2012-09-10 16:43:24 +03:00
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 usb: gadget: libcomposite: add epautoconf.c to libcomposite 2012-09-10 15:37:51 +03:00
ether.c usb: gadget: remove usb_gadget_controller_number() 2012-09-10 16:43:24 +03:00
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 usb: gadget: uvc: Add super-speed support to UVC webcam gadget 2012-06-04 18:12:36 +03:00
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 usb: gadget: Complete fsl qe/udc driver conversion 2012-06-12 13:32:29 +03:00
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 usb: gadget: libcomposite: move composite.c into libcomposite 2012-09-10 16:13:03 +03:00
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 usb: gadget: remove usb_gadget_controller_number() 2012-09-10 16:43:24 +03:00
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
Kconfig tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -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
Makefile usb: gadget: f_acm: convert to new function interface with backwards compatibility 2013-01-21 20:52:43 +02:00
mass_storage.c usb: gadget: libcomposite: move composite.c into libcomposite 2012-09-10 16:13:03 +03:00
multi.c usb: gadget: multi: use function framework for ACM 2013-01-21 20:52:45 +02:00
mv_u3d_core.c usb: remove use of __devexit 2012-11-21 13:27:17 -08:00
mv_u3d.h usb: gadget: mv: Add USB 3.0 device driver for Marvell PXA2128 chip. 2012-06-22 13:08:21 +03:00
mv_udc_core.c usb: gadget: patches for v3.9 merge window 2013-01-25 09:08:05 -08:00
mv_udc.h usb: gadget: Update mv_udc to use usb_endpoint_descriptor inside the struct usb_ep 2012-05-04 15:52:57 +03:00
ncm.c usb: gadget: remove usb_gadget_controller_number() 2012-09-10 16:43:24 +03:00
ndis.h usb/net: rndis: break out <linux/rndis.h> defines 2012-05-12 15:02:22 -04:00
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 usb: gadget: Update omap_udc to use usb_endpoint_descriptor inside the struct usb_ep 2012-05-04 15:52:57 +03:00
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 gadget/r8a66597: remove conditional compilation of clk code 2012-07-30 17:25:12 -07:00
rndis.c new helper: file_inode(file) 2013-02-22 23:31:31 -05:00
rndis.h usb/net: rndis: break out <linux/rndis.h> defines 2012-05-12 15:02:22 -04: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
s3c-hsotg.c USB patches for 3.9-rc1 2013-02-21 12:20:00 -08:00
s3c-hsotg.h usb:hsotg:samsung: Remove the S3C_ prefix from registers definition. 2012-05-04 15:53:17 +03:00
s3c-hsudc.c USB patches for 3.9-rc1 2013-02-21 12:20:00 -08: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 usb: gadget: make sure each gadget is using same index for Product, Serial,… 2012-09-10 16:13:00 +03:00
u_ether.c ethtool: fix drvinfo strings set in drivers 2013-01-06 21:06:31 -08:00
u_ether.h usb: gadget: f_rndis: Set rndis vendor parameters 2012-05-10 12:27:58 -07:00
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 gadgetfs: clean up 2012-07-29 21:24:21 +04:00
u_uac1.h
udc-core.c usb: gadget: completely remove ->start/->stop 2013-01-24 21:11:32 +02:00
usbstring.c usb: gadget: libcomposite: move MODULE_VERSION to composite.c 2012-09-10 16:13:03 +03:00
uvc_queue.c [media] usb: gadget/uvc: Remove non-required locking from 'uvc_queue_next_buffer' routine 2012-04-10 15:46:02 -03:00
uvc_queue.h
uvc_v4l2.c Merge remote-tracking branch 'linus/master' into staging/for_v3.5 2012-05-15 08:39:25 -03:00
uvc_video.c
uvc.h usb: gadget: uvc: Add super-speed support to UVC webcam gadget 2012-06-04 18:12:36 +03:00
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