[PATCH v2 5/6] selftests/landlock: Test capability checks outside the capable hook

sashiko-bot at kernel.org sashiko-bot at kernel.org
Tue Nov 17 10:20:57 UTC 2026


> Test the capability checks that commoncap makes from LSM hooks other
> than capable and that the previous commits make Landlock restrict:
> mapping below vm.mmap_min_addr (CAP_SYS_RAWIO) and adding inheritable
> capabilities outside of the permitted set (CAP_SETPCAP).
> 
> Each test first checks that the operation fails without the capability,
> so that it exercises the capability check, and then checks it with the
> capability effective in four variants: unsandboxed, in a domain that
> denies the capability, in a domain that allows it, and in a domain that
> does not handle capabilities.  The mmap_addr tests map the last page
> below vm.mmap_min_addr, and skip if the architecture rejects it before
> the mmap_addr hook (e.g. 32-bit ARM).
> 
> Audit tests check that these denials are logged, that the admin reserve
> check is not, and that allowed uses log nothing.  The admin reserve
> check has no functional test: it only has an effect with
> vm.overcommit_memory=2, a system-wide setting that a test cannot change
> without racing with other processes.
> 
> Add CAP_SETPCAP and CAP_SYS_RAWIO to the capabilities that the tests may
> raise, and drop the stale count from the comment of this list.
> 
> Without the mmap_addr and capset fixes, their denied variants and the
> denial audit test fail.
> 
> Cc: Günther Noack <gnoack at google.com>
> Cc: Paul Moore <paul at paul-moore.com>
> Cc: Serge Hallyn <serge at hallyn.com>
> Acked-by: Serge Hallyn (AMD) <sergeh at kernel.org>
> 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/20261117101157.2520463-1-mic@digikod.net?part=5




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