Re: [PATCH v1] lsm: Set PF_SUPERPRIV only when all mmap_addr hooks allow a mapping

From
sashiko-bot@kernel.org
Date
2026-11-18 17:03:31
Reply to
Mickaël Salaün, 2026-11-18
cap_mmap_addr() sets PF_SUPERPRIV when commoncap grants CAP_SYS_RAWIO
for a mapping below vm.mmap_min_addr, before the other LSMs' mmap_addr
hooks run.  If one of them then denies the mapping (e.g. SELinux's
mmap_zero check), process accounting still reports a use of privileges.

Set the flag in security_mmap_addr() once all hooks allowed the mapping,
as ns_capable() does after security_capable().  commoncap runs first and
denies such a mapping without CAP_SYS_RAWIO, so a successful hook chain
means that the capability was used.

Cc: Paul Moore <paul@paul-moore.com>
Cc: Serge Hallyn <serge@hallyn.com>
Cc: Stephen Smalley <stephen.smalley.work@gmail.com>
Reported-by: Günther Noack <gnoack@google.com>
Closes: https://patch.msgid.link/avxjfHybQBcATFKV@google.com (local)
Fixes: 9c0d90103c7e ("Capabilities: move cap_file_mmap to commoncap.c")
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118165603.2573289-1-mic@digikod.net?part=1
Thread (3 messages) 3 messages, 3 authors, last reply 6h ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help