2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-16 01:04:08 +08:00
linux-next/drivers/oprofile
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
..
buffer_sync.c mm: use mm->exe_file instead of first VM_EXECUTABLE vma->vm_file 2012-10-09 16:22:18 +09:00
buffer_sync.h cpumask: modifiy oprofile initialization 2009-01-22 14:37:06 +01:00
cpu_buffer.c oprofile: Remove 'WQ on CPUx, prefer CPUy' warning 2012-08-27 14:49:39 +02:00
cpu_buffer.h oprofile: Remove deprecated use of flush_scheduled_work() 2010-10-29 11:54:18 +02:00
event_buffer.c locking, oprofile: Annotate oprofilefs lock as raw 2011-09-13 11:12:05 +02:00
event_buffer.h oprofile: Use linux/mutex.h 2011-05-24 12:45:59 +02:00
nmi_timer_int.c oprofile, x86: Reimplement nmi timer mode using perf event 2011-11-04 16:27:18 +01:00
oprof.c oprofile, x86: Reimplement nmi timer mode using perf event 2011-11-04 16:27:18 +01:00
oprof.h oprofile: Fix oprofile_timer_exit() breakage 2011-12-07 11:16:38 +01:00
oprofile_files.c oprofile: Fix uninitialized memory access when writing to writing to oprofilefs 2011-12-19 17:18:43 +01:00
oprofile_perf.c oprofile, perf: Use per-cpu framework 2012-06-22 16:31:20 +02:00
oprofile_stats.c percpu: make percpu symbols in oprofile unique 2009-10-29 22:34:13 +09:00
oprofile_stats.h atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
oprofilefs.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
timer_int.c oprofile: Remove exit function for timer mode 2011-11-04 15:04:35 +01:00