diff options
| author | Stephen Smalley <stephen.smalley.work@gmail.com> | 2026-09-11 12:37:35 -0400 |
|---|---|---|
| committer | Paul Moore <paul@paul-moore.com> | 2026-09-15 17:28:06 -0400 |
| commit | 8be71e1ba093cb3aee90c7cf6b403d1fd71a77e9 (patch) | |
| tree | a919095b479eaacb9f4c4b4f0e042d82d2aabae7 /scripts/Makefile.thinlto | |
| parent | 3b0744a6358624d46f7ee2573faca2b7d92cf32b (diff) | |
| download | linux-8be71e1ba093cb3aee90c7cf6b403d1fd71a77e9.tar.gz linux-8be71e1ba093cb3aee90c7cf6b403d1fd71a77e9.zip | |
selinux: mark status and policy inodes as immutable, drop status mmap write checks
The selinuxfs "status" and "policy" files are read-only interfaces
that are also mmap'd by userspace. They are created 0444 by
simple_fill_super() but a CAP_DAC_OVERRIDE caller can still open them
O_WRONLY/O_RDWR, open(O_RDONLY|O_TRUNC) them, or truncate(2) them.
Mark both inodes S_IMMUTABLE at fill_super time. inode_permission()
tests IS_IMMUTABLE before the DAC / capability checks, so all of the
above are rejected at the VFS layer without ever reaching the file
operations. Since a writable file can no longer exist, do_mmap() clear
VM_MAYWRITE for MAP_SHARED mappings on its own, and the
sel_mmap_handle_status() write/mprotect guards are dead; drop them.
MAP_PRIVATE writable mappings become permitted (they were previously
-EPERM) and CoW harmlessly to a private page, matching how
sel_mmap_policy() has always treated the private case.
The sel_mmap_policy() VM_SHARED guard becomes redundant for the same
reason; leave dropping it to the pending "selinux: reject writable
opens of policy file, drop mmap shared/write check" patch so that the
patches do not conflict.
Link: https://lore.kernel.org/selinux/aqPUqU3eZeFrykj3@gremlin/
cc: ljs@kernel.org
cc: jannh@google.com
cc: jack@suse.cz
cc: cgzones@googlemail.com
cc: brauner@kernel.org
Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Acked-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
