mirror of https://gitee.com/openkylin/linux.git
7f78e03513
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> |
||
---|---|---|
.. | ||
android | ||
asus_oled | ||
bcm | ||
ccg | ||
ced1401 | ||
comedi | ||
cptm1217 | ||
crystalhd | ||
csr | ||
cxt1e1 | ||
dgrp | ||
echo | ||
et131x | ||
frontier | ||
ft1000 | ||
fwserial | ||
gdm72xx | ||
goldfish | ||
iio | ||
imx-drm | ||
keucr | ||
line6 | ||
media | ||
net | ||
nvec | ||
octeon | ||
olpc_dcon | ||
omap-thermal | ||
ozwpan | ||
panel | ||
phison | ||
quickstart | ||
rtl8187se | ||
rtl8192e | ||
rtl8192u | ||
rtl8712 | ||
rts5139 | ||
sb105x | ||
sbe-2t3e3 | ||
sep | ||
serqt_usb2 | ||
silicom | ||
slicoss | ||
sm7xxfb | ||
speakup | ||
ste_rmi4 | ||
tidspbridge | ||
usbip | ||
vme | ||
vt6655 | ||
vt6656 | ||
winbond | ||
wlags49_h2 | ||
wlags49_h25 | ||
wlan-ng | ||
xgifb | ||
zcache | ||
zram | ||
zsmalloc | ||
Kconfig | ||
Makefile | ||
staging.c |