[PATCH v2 5/6] selinux: Use security_capable_lsm() for CAP_MAC_ADMIN checks

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Nov 17 10:36:56 UTC 2026


> has_cap_mac_admin() checks CAP_MAC_ADMIN with cap_capable() and then
> with SELinux's own check, so that other stacked LSMs do not have to
> authorize it (see commit db59000ab760 ("selinux: only invoke
> capabilities and selinux for CAP_MAC_ADMIN checks")).  This also lets a
> process in a Landlock domain that denies CAP_MAC_ADMIN get or set
> security contexts unknown to the loaded policy.
> 
> Switch this check to security_capable_lsm(), as for AppArmor and Smack
> in the previous commits.  The cred_has_capability() check is kept.
> 
> Cc: Günther Noack <gnoack at google.com>
> Cc: Ondrej Mosnáček <omosnacek at gmail.com>
> Cc: Paul Moore <paul at paul-moore.com>
> Cc: Stephen Smalley <stephen.smalley.work at gmail.com>
> Fixes: 97c8386f1d74 ("landlock: Enforce capability restrictions")
> 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/20261117101845.2523770-1-mic@digikod.net?part=5




More information about the Linux-security-module-archive mailing list