summaryrefslogtreecommitdiff
path: root/tools/perf/python/stackcollapse.py
diff options
context:
space:
mode:
authorMickaël Salaün <mic@digikod.net>2026-10-07 12:02:47 +0200
committerMickaël Salaün <mic@digikod.net>2026-10-07 12:04:10 +0200
commitb6a56b30b9d5a0225aaa1676997913c63d9dc8a4 (patch)
treec2f2e265caf844627cf8d31fab3e58d47da90add /tools/perf/python/stackcollapse.py
parent3efe2f87c5005ec64ae75b4b8cc02f88128d64af (diff)
downloadlinux-next-b6a56b30b9d5a0225aaa1676997913c63d9dc8a4.tar.gz
linux-next-b6a56b30b9d5a0225aaa1676997913c63d9dc8a4.zip
landlock: Enforce capability restrictions
Add Landlock enforcement for capability use via the LSM capable hook. This lets a sandboxed process restrict which Linux capabilities it can exercise, using LANDLOCK_PERMISSION_CAPABILITY_USE and per-capability rules. The check is a flat per-layer allowed-capabilities test, with no domain-ancestry bypass, no cross-namespace discriminant, and no dependency on the target user namespace. These categorical denials return -EPERM, like the namespace permission introduced by the previous commit, and they mirror its per-capability allowed and quiet masks, so LANDLOCK_ADD_RULE_QUIET stays rejected for this rule type. Successful capability rules and denials are traced as the previous commit describes. Enforce only at capability exercise time rather than modifying the credential's capability sets. Modifying them would give capget(2) an accurate view of usable capabilities, but no LSM other than commoncap does so; Landlock follows that convention. A sandboxed process inside a user namespace therefore sees all capabilities via capget(2) but receives -EPERM when attempting to use one that is denied. An earlier design bypassed this hook for namespace management through a domain-ancestry comparison with the namespace creator's stored Landlock domain. That made a Landlock decision depend on kernel namespace state, and the ns != cred->user_ns heuristic did not accurately identify namespace-management operations. The flat, namespace-agnostic check instead enforces capability and namespace restrictions independently; creating a non-user namespace requires an allowed CAP_SYS_ADMIN even when combined with CLONE_NEWUSER in one unshare(). Cc: Christian Brauner <brauner@kernel.org> Cc: Günther Noack <gnoack@google.com> Cc: Paul Moore <paul@paul-moore.com> Cc: Serge E. Hallyn <serge@hallyn.com> Link: https://patch.msgid.link/20261007100255.1333386-5-mic@digikod.net Signed-off-by: Mickaël Salaün <mic@digikod.net>
Diffstat (limited to 'tools/perf/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions