[PATCH v1] lsm: Set PF_SUPERPRIV only when all mmap_addr hooks allow a mapping
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Wed Nov 18 17:03:31 UTC 2026
> 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 at paul-moore.com>
> Cc: Serge Hallyn <serge at hallyn.com>
> Cc: Stephen Smalley <stephen.smalley.work at gmail.com>
> Reported-by: Günther Noack <gnoack at google.com>
> Closes: https://patch.msgid.link/avxjfHybQBcATFKV@google.com
> Fixes: 9c0d90103c7e ("Capabilities: move cap_file_mmap to commoncap.c")
> Signed-off-by: Mickaël Salaün <mic at 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
More information about the Linux-security-module-archive
mailing list