Skip to content

noexec on proc and sysfs

Eric W. Biederman containers linux-api linux-fsdevel 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2vfs: Commit to never having exectuables on proc and sysfs.fs/exec.c fs/open.c fs/proc/root.c +6 more+23 -90 replies
2/2mnt: fs_fully_visible enforce noexec and nosuid if !SB_I_NOEXECfs/namespace.c+25 -80 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [REVIEW][PATCH 0/2] noexec on proc and sysfs

Given the code I have seen executables especially suid root executable appearing on proc or sysfs will break userspace because there are current applications that depend on nosuid and noexec on proc and sysfs being meaningless.

This patchset addes a new flag SB_I_NOEXEC to enforce that restriction, and to make it hard for a kernel developer to make the mistake of adding executables to sysfs or proc.

The first patch has been updated since last time to a super block flags instead of a file_system type flag based on Al's suggestion.

The code in fs_fully_visible to enforce nosuid and noexec when needed has also been added.

At a practical level this code is a no-op on a slow path, to guard against future mistakes and to make auditing the kernel for this class of problem trivial.

git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git for-testing

Eric W. Biederman (2):
vfs: Commit to never having exectuables on proc and sysfs.
mnt: fs_fully_visible enforce noexec and nosuid if !SB_I_NOEXEC

 fs/exec.c           | 10 ++++++++--
 fs/namespace.c      | 33 +++++++++++++++++++++++++--------
 fs/open.c           |  2 +-
 fs/proc/root.c      |  2 ++
 fs/sysfs/mount.c    |  4 ++++
 include/linux/fs.h  |  3 +++
 kernel/sys.c        |  3 +--
 mm/mmap.c           |  4 ++--
 mm/nommu.c          |  2 +-
 security/security.c |  2 +-
 10 files changed, 48 insertions(+), 17 deletions(-)