]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
landlock: Demonstrate best-effort allowed_access filtering
authorMickaël Salaün <mic@digikod.net>
Wed, 13 May 2026 15:18:53 +0000 (17:18 +0200)
committerMickaël Salaün <mic@digikod.net>
Sat, 13 Jun 2026 21:14:59 +0000 (23:14 +0200)
commit143c656e2588b60e69df4287131413dab93ff53c
tree597003731c3cf4dde424de88da5fc19dbcc50fd4
parentb232bd12789fa57405b5092f28788be97aae9999
landlock: Demonstrate best-effort allowed_access filtering

Landlock provides best-effort sandboxing across ABI versions:
applications request the rights they need, and on older kernels the
unsupported rights are silently dropped from handled_access_* by the
documented compatibility switch.  The recommended pattern for
landlock_add_rule(2) calls is to mirror this filtering at the rule
level, which wasn't explicitly described in the exemple.

Show the pattern explicitly in the filesystem and network rule examples
by masking each rule's allowed_access against the ruleset's
handled_access_* and adding the rule only when at least one bit remains
set.  This makes the recommended best-effort pattern self-documenting.

Reviewed-by: Günther Noack <gnoack3000@gmail.com>
Link: https://patch.msgid.link/20260513151856.148423-1-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Documentation/userspace-api/landlock.rst