diff options
| author | Mickaël Salaün <mic@digikod.net> | 2026-10-07 12:02:48 +0200 |
|---|---|---|
| committer | Mickaël Salaün <mic@digikod.net> | 2026-10-07 12:04:10 +0200 |
| commit | 886ee9a20b2813ef070b5cd0926924b786988fe7 (patch) | |
| tree | 482d4933c7d608781068a57e3812c6808bdebecd /tools/perf/python/stackcollapse.py | |
| parent | b6a56b30b9d5a0225aaa1676997913c63d9dc8a4 (diff) | |
| download | linux-next-886ee9a20b2813ef070b5cd0926924b786988fe7.tar.gz linux-next-886ee9a20b2813ef070b5cd0926924b786988fe7.zip | |
selftests/landlock: Add namespace restriction tests
Add tests covering LANDLOCK_PERMISSION_NAMESPACE_USE (namespace creation
via unshare/clone and namespace entry via setns) and its interaction
with LANDLOCK_PERMISSION_CAPABILITY_USE.
Rule validation covers the forward-compatibility contract: unknown
CLONE_NEW* bits, including holes, upper-range bits and bit 63, are
accepted at rule-add time yet have no runtime effect, because
deny-by-default still applies once the domain is enforced. Empty masks,
invalid permission selectors and non-zero flags are rejected.
Creation tests use FIXTURE_VARIANT to exercise all eight namespace types
across allowed/denied and privileged/unprivileged combinations, so every
type is shown to reach security_namespace_init(). Stacking tests cover
the three per-layer allow/deny combinations that exercise distinct
walker paths, and one domain handles both permissions at once.
Entry tests subject setns to the same type-based check through
security_namespace_install(), across processes, and require both
permissions to allow a non-user namespace.
The four open_tree(2) and fsmount(2) variants, anonymous and not, all
create a mount namespace: they converge in security_namespace_init()
with CLONE_NEWNS through different alloc_mnt_ns() paths. A
CLONE_NEWUSER | CLONE_NEWUTS unshare under partial-allow rules shows
that creation is sequential, so a denial on either type rolls the whole
syscall back with EPERM.
Audit tests cover allowed and denied creation and entry, per-member
quiet masks and the youngest-denying-layer rule. Trace tests cover
handled permissions, successful and rejected rules, version history,
namespace IDs, and quiet denials, including repeated and unknown-only
effective no-ops.
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/20260726161400.3010511-10-mic@digikod.net
Link: https://patch.msgid.link/20261007100255.1333386-6-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
