landlock: Prepare to use credential instead of domain for filesystem
authorMickaël Salaün <mic@digikod.net>
Thu, 20 Mar 2025 19:06:53 +0000 (20:06 +0100)
committerMickaël Salaün <mic@digikod.net>
Wed, 26 Mar 2025 12:59:35 +0000 (13:59 +0100)
commitae2483a26017d24f505caa87935fb8f17117bbfa
tree8940a00274c45f21b89eb5c8e6f5ee7aa967700c
parent5b95b329befaf18020a0d3cd0223a90bd230eeb9
landlock: Prepare to use credential instead of domain for filesystem

This cosmetic change is needed for audit support, specifically to be
able to filter according to cross-execution boundaries.

Add landlock_get_applicable_subject(), mainly a copy of
landlock_get_applicable_domain(), which will fully replace it in a
following commit.

Optimize current_check_access_path() to only handle the access request.

Partially replace get_current_fs_domain() with explicit calls to
landlock_get_applicable_subject().  The remaining ones will follow with
more changes.

Remove explicit domain->num_layers check which is now part of the
landlock_get_applicable_subject() call.

Cc: Günther Noack <gnoack@google.com>
Link: https://lore.kernel.org/r/20250320190717.2287696-5-mic@digikod.net
Signed-off-by: Mickaël Salaün <mic@digikod.net>
security/landlock/cred.h
security/landlock/fs.c