android_kernel_google_msm/fs/gfs2
Eric W. Biederman 5c1997410b 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.

Change-Id: I623b13dbdb44bb9ba7481f29575e1ca4ad8102f4
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>
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2017-09-22 19:12:20 +03:00
..
acl.c BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2017-06-26 20:26:17 +03:00
acl.h
aops.c GFS2: Allow caching of rindex glock 2012-04-10 13:49:53 +01:00
bmap.c GFS2: Make sure rindex is uptodate before starting transactions 2012-04-05 10:20:10 +01:00
bmap.h
dentry.c
dir.c GFS2: Make sure rindex is uptodate before starting transactions 2012-04-05 10:20:10 +01:00
dir.h
export.c
file.c get rid of pointless includes of ext2_fs.h 2012-03-31 16:03:15 -04:00
gfs2.h
glock.c GFS2: glock statistics gathering 2012-02-28 17:09:42 +00:00
glock.h GFS2: dlm based recovery coordination 2012-01-11 09:23:05 +00:00
glops.c
glops.h
incore.h GFS2: Eliminate sd_rindex_mutex 2012-03-05 15:06:56 +00:00
inode.c GFS2: Make sure rindex is uptodate before starting transactions 2012-04-05 10:20:10 +01:00
inode.h
Kconfig GFS2: use depends instead of select in kconfig 2012-03-26 09:18:02 +01:00
lock_dlm.c GFS2: Instruct DLM to avoid queue convert slowdown 2012-04-24 13:26:50 +01:00
log.c GFS2: Clean up log flush header writing 2012-03-09 14:07:06 +00:00
log.h GFS2: Move two functions from log.c to lops.c 2012-02-28 17:09:59 +00:00
lops.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw 2012-03-21 18:00:03 -07:00
lops.h
main.c GFS2: Remove a __GFP_NOFAIL allocation 2012-03-08 12:10:23 +00:00
Makefile
meta_io.c
meta_io.h
ops_fstype.c fs: Limit sys_mount to only request filesystem modules. 2017-09-22 19:12:20 +03:00
quota.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw 2012-03-21 18:00:03 -07:00
quota.h
recovery.c GFS2: fail mount if journal recovery fails 2012-01-11 09:24:48 +00:00
recovery.h
rgrp.c GFS2: Make sure rindex is uptodate before starting transactions 2012-04-05 10:20:10 +01:00
rgrp.h GFS2: FITRIM ioctl support 2012-02-28 17:10:21 +00:00
super.c GFS2: Flush pending glock work when evicting an inode 2012-03-07 10:43:02 +00:00
super.h
sys.c GFS2: dlm based recovery coordination 2012-01-11 09:23:05 +00:00
sys.h GFS2: dlm based recovery coordination 2012-01-11 09:23:05 +00:00
trace_gfs2.h GFS2: glock statistics gathering 2012-02-28 17:09:42 +00:00
trans.c
trans.h
util.c GFS2: Remove a __GFP_NOFAIL allocation 2012-03-08 12:10:23 +00:00
util.h GFS2: Remove a __GFP_NOFAIL allocation 2012-03-08 12:10:23 +00:00
xattr.c GFS2: Make sure rindex is uptodate before starting transactions 2012-04-05 10:20:10 +01:00
xattr.h