Linux Overlay Filesystem development
 help / color / mirror / Atom feed
* [PATCH v3 0/2] selinux: fix nested backing-file mprotect checks
@ 2026-08-29 21:32 Karl Mehltretter
  2026-08-29 21:32 ` [PATCH v3 1/2] selinux: preserve user SID across nested backing files Karl Mehltretter
  2026-08-29 21:32 ` [PATCH v3 2/2] selinux: recheck intermediate backing files on mprotect Karl Mehltretter
  0 siblings, 2 replies; 5+ messages in thread
From: Karl Mehltretter @ 2026-08-29 21:32 UTC (permalink / raw)
  To: selinux
  Cc: Karl Mehltretter, Paul Moore, Stephen Smalley, Ondrej Mosnacek,
	Miklos Szeredi, Amir Goldstein, Christian Brauner, Baokun Li,
	linux-fsdevel, linux-unionfs, linux-kernel, stable

Patch 1 preserves the top-level user file SID across nested backing files.
Patch 2 preserves and rechecks each intermediate path, mounter SID, and
file-description SID during mprotect(), including execmod checks.

The series is based on cf72cbb39da8, which contains
commit f2381b546e7e ("fs: fix user path of nested backing files"). Neither
patch needs that fix to apply or build, but without it the top-level check
still resolves to the intermediate inode. It is already marked for stable.

The intermediate list is allocated only for nested backing files. It is
captured at backing-file allocation time and remains immutable afterwards.
Capturing it in the mmap hook would require synchronization between
concurrent mappings of the same file.

Tested on arm64 QEMU with a small BusyBox initramfs, SELinux enforcing, and
two nested overlayfs mounts. The original SID propagation test passes.
Direct mmap(PROT_EXEC) and mmap(PROT_NONE) followed by mprotect(PROT_EXEC)
are both denied against the intermediate inode when that permission is
omitted. /proc/self/maps reports the top-level path.

Changes in v3:
- Add the intermediate-mounter fix as patch 2.
- Allocate intermediate state only for nested backing files.
- Rebase and retest on mainline containing f2381b546e7e.
- Document the BusyBox test environment.

Changes in v2:
- Add selinux_file_user_sid() instead of open-coding the lookup (Amir).

v2: https://lore.kernel.org/selinux/20260820175832.44512-1-kmehltretter@gmail.com/

Karl Mehltretter (2):
  selinux: preserve user SID across nested backing files
  selinux: recheck intermediate backing files on mprotect

 security/selinux/hooks.c          | 150 ++++++++++++++++++++++++++----
 security/selinux/include/objsec.h |  10 +-
 2 files changed, 142 insertions(+), 18 deletions(-)


base-commit: cf72cbb39da84b6f02f90c07f33b102fc10b16f0
-- 
2.53.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-31 13:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-29 21:32 [PATCH v3 0/2] selinux: fix nested backing-file mprotect checks Karl Mehltretter
2026-08-29 21:32 ` [PATCH v3 1/2] selinux: preserve user SID across nested backing files Karl Mehltretter
2026-08-31 13:47   ` Stephen Smalley
2026-08-29 21:32 ` [PATCH v3 2/2] selinux: recheck intermediate backing files on mprotect Karl Mehltretter
2026-08-31 13:47   ` Stephen Smalley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox