1 .\" Copyright © 2017-2020 Mickaël Salaün <mic@digikod.net>
2 .\" Copyright © 2019-2020 ANSSI
3 .\" Copyright © 2021 Microsoft Corporation
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .TH LANDLOCK_CREATE_RULESET 2 2022-09-09 "Linux man-pages (unreleased)"
9 landlock_create_ruleset \- create a new Landlock ruleset
12 .RI ( libc ", " \-lc )
15 .BR "#include <linux/landlock.h>" " /* Definition of " LANDLOCK_* " constants */"
16 .BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
18 .B int syscall(SYS_landlock_create_ruleset,
19 .BI " const struct landlock_ruleset_attr *" attr ,
20 .BI " size_t " size " , uint32_t " flags );
23 A Landlock ruleset identifies a set of rules (i.e., actions on objects).
25 .BR landlock_create_ruleset ()
26 system call enables creating a new file descriptor identifying a ruleset.
27 This file descriptor can then be used by
28 .BR landlock_add_rule (2)
30 .BR landlock_restrict_self (2).
33 for a global overview.
36 specifies the properties of the new ruleset.
37 It points to the following structure:
41 struct landlock_ruleset_attr {
42 __u64 handled_access_fs;
48 is a bitmask of actions that is handled by this ruleset and
49 should then be forbidden if no rule explicitly allows them
54 This enables simply restricting ambient rights
55 (e.g., global filesystem access) and is needed for compatibility reasons.
59 .I sizeof(struct landlock_ruleset_attr)
60 for compatibility reasons.
70 .B LANDLOCK_CREATE_RULESET_VERSION
75 is 0, then the returned value is the highest supported Landlock ABI version
77 This version can be used for a best-effort security approach,
78 which is encouraged when user space is not pinned to a specific kernel
80 All features documented in these man pages are available with the version
84 .BR landlock_create_ruleset ()
85 returns a new Landlock ruleset file descriptor,
86 or a Landlock ABI version,
90 .BR landlock_create_ruleset ()
91 can fail for the following reasons:
94 Landlock is supported by the kernel but disabled at boot time.
99 or unknown access, or too small
108 was not a valid address.
111 Empty accesses (i.e.,
112 .I attr->handled_access_fs
115 Landlock was added in Linux 5.13.
117 This system call is Linux-specific.
122 .BR landlock_add_rule (2),
123 .BR landlock_restrict_self (2),