[PATCH v5 3/9] samples/landlock: Add support for named UNIX domain socket restrictions
Mickaël Salaün
mic at digikod.net
Wed Feb 18 09:37:31 UTC 2026
On Sun, Feb 15, 2026 at 11:51:51AM +0100, Günther Noack wrote:
> The access right for UNIX domain socket lookups is grouped with the
> read-write rights in the sample tool. Rationale: In the general case,
> any operations are possible through a UNIX domain socket, including
> data-mutating operations.
>
> Cc: Justin Suess <utilityemal77 at gmail.com>
> Cc: Mickaël Salaün <mic at digikod.net>
> Signed-off-by: Günther Noack <gnoack3000 at gmail.com>
> ---
> samples/landlock/sandboxer.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/samples/landlock/sandboxer.c b/samples/landlock/sandboxer.c
> index e7af02f98208..0bbbc5c9ead6 100644
> --- a/samples/landlock/sandboxer.c
> +++ b/samples/landlock/sandboxer.c
> @@ -111,7 +111,8 @@ static int parse_path(char *env_path, const char ***const path_list)
> LANDLOCK_ACCESS_FS_WRITE_FILE | \
> LANDLOCK_ACCESS_FS_READ_FILE | \
> LANDLOCK_ACCESS_FS_TRUNCATE | \
> - LANDLOCK_ACCESS_FS_IOCTL_DEV)
> + LANDLOCK_ACCESS_FS_IOCTL_DEV | \
> + LANDLOCK_ACCESS_FS_RESOLVE_UNIX)
>
> /* clang-format on */
>
> @@ -295,11 +296,12 @@ static bool check_ruleset_scope(const char *const env_var,
> LANDLOCK_ACCESS_FS_MAKE_SYM | \
> LANDLOCK_ACCESS_FS_REFER | \
> LANDLOCK_ACCESS_FS_TRUNCATE | \
> - LANDLOCK_ACCESS_FS_IOCTL_DEV)
> + LANDLOCK_ACCESS_FS_IOCTL_DEV | \
> + LANDLOCK_ACCESS_FS_RESOLVE_UNIX)
>
> /* clang-format on */
>
> -#define LANDLOCK_ABI_LAST 7
> +#define LANDLOCK_ABI_LAST 9
>
> #define XSTR(s) #s
> #define STR(s) XSTR(s)
> @@ -444,6 +446,13 @@ int main(const int argc, char *const argv[], char *const *const envp)
> "provided by ABI version %d (instead of %d).\n",
> LANDLOCK_ABI_LAST, abi);
> __attribute__((fallthrough));
> + case 7:
> + __attribute__((fallthrough));
The current code should print the hint when ABI <= 7. Please send a
dedicated patch to fix the TSYNC-related changes.
> + case 8:
> + /* Removes LANDLOCK_ACCESS_FS_RESOLVE_UNIX for ABI < 9 */
> + ruleset_attr.handled_access_fs &=
> + ~LANDLOCK_ACCESS_FS_RESOLVE_UNIX;
> + __attribute__((fallthrough));
> case LANDLOCK_ABI_LAST:
> break;
> default:
> --
> 2.52.0
>
>
More information about the Linux-security-module-archive
mailing list