[PATCH v2 6/6] selftests/landlock: Test capabilities guarding other LSMs' policies

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Nov 17 10:44:01 UTC 2026


> Check that a domain denying CAP_MAC_ADMIN prevents a process from
> changing a file's Smack label and from loading AppArmor policy.  Also
> check that denying CAP_MAC_OVERRIDE prevents a process from bypassing
> Smack rules between sockets with distinct labels.  The allowed,
> unhandled and unsandboxed variants retain each capability, and an audit
> test checks both Smack denials.
> 
> Smack and AppArmor are optional and are not added to the test
> configuration: each test is skipped if its LSM is not active according
> to lsm_list_modules(2), and fails if this syscall fails.  The default
> test configuration has no other LSM, so these tests skip there and the
> capable_lsm hook is not exercised.
> 
> The cap_other_hooks fixture now covers more than commoncap's checks, so
> update its description, and add CAP_MAC_ADMIN and CAP_MAC_OVERRIDE to
> the capabilities that the tests may raise.
> 
> Without the previous commits, the denied variants and the audit test
> fail with Smack (boot with lsm=landlock,smack), and the denied variants
> fail with AppArmor (lsm=landlock,apparmor).
> 
> Cc: Casey Schaufler <casey at schaufler-ca.com>
> Cc: Christian Brauner <brauner at kernel.org>
> Cc: Günther Noack <gnoack at google.com>
> Cc: John Johansen <john.johansen at canonical.com>
> Cc: Paul Moore <paul at paul-moore.com>
> 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=6




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