Skip to content

Commit 33c97e7

Browse files
gnoackl0kod
authored andcommitted
landlock: Clarify documentation for struct landlock_ruleset_attr
The explanation for @handled_access_fs and @handled_access_net has significant overlap and is better explained together. * Explain the commonalities in structure-level documentation. * Clarify some wording and break up longer sentences. * Put emphasis on the word "handled" to make it clearer that "handled" is a term with special meaning in the context of Landlock. I'd like to transfer this wording into the man pages as well. Signed-off-by: Günther Noack <gnoack@google.com> Cc: Alejandro Colomar <alx@kernel.org> Cc: Konstantin Meskhidze <konstantin.meskhidze@huawei.com> Cc: linux-security-module@vger.kernel.org Link: https://lore.kernel.org/r/20240711165456.2148590-2-gnoack@google.com [mic: Format commit message] Signed-off-by: Mickaël Salaün <mic@digikod.net>
1 parent 395a02d commit 33c97e7

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

include/uapi/linux/landlock.h

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,36 @@
1212
#include <linux/types.h>
1313

1414
/**
15-
* struct landlock_ruleset_attr - Ruleset definition
15+
* struct landlock_ruleset_attr - Ruleset definition.
1616
*
17-
* Argument of sys_landlock_create_ruleset(). This structure can grow in
18-
* future versions.
17+
* Argument of sys_landlock_create_ruleset().
18+
*
19+
* This structure defines a set of *handled access rights*, a set of actions on
20+
* different object types, which should be denied by default when the ruleset is
21+
* enacted. Vice versa, access rights that are not specifically listed here are
22+
* not going to be denied by this ruleset when it is enacted.
23+
*
24+
* For historical reasons, the %LANDLOCK_ACCESS_FS_REFER right is always denied
25+
* by default, even when its bit is not set in @handled_access_fs. In order to
26+
* add new rules with this access right, the bit must still be set explicitly
27+
* (cf. `Filesystem flags`_).
28+
*
29+
* The explicit listing of *handled access rights* is required for backwards
30+
* compatibility reasons. In most use cases, processes that use Landlock will
31+
* *handle* a wide range or all access rights that they know about at build time
32+
* (and that they have tested with a kernel that supported them all).
33+
*
34+
* This structure can grow in future Landlock versions.
1935
*/
2036
struct landlock_ruleset_attr {
2137
/**
22-
* @handled_access_fs: Bitmask of actions (cf. `Filesystem flags`_)
23-
* that is handled by this ruleset and should then be forbidden if no
24-
* rule explicitly allow them: it is a deny-by-default list that should
25-
* contain as much Landlock access rights as possible. Indeed, all
26-
* Landlock filesystem access rights that are not part of
27-
* handled_access_fs are allowed. This is needed for backward
28-
* compatibility reasons. One exception is the
29-
* %LANDLOCK_ACCESS_FS_REFER access right, which is always implicitly
30-
* handled, but must still be explicitly handled to add new rules with
31-
* this access right.
38+
* @handled_access_fs: Bitmask of handled filesystem actions
39+
* (cf. `Filesystem flags`_).
3240
*/
3341
__u64 handled_access_fs;
3442
/**
35-
* @handled_access_net: Bitmask of actions (cf. `Network flags`_)
36-
* that is handled by this ruleset and should then be forbidden if no
37-
* rule explicitly allow them.
43+
* @handled_access_net: Bitmask of handled network actions (cf. `Network
44+
* flags`_).
3845
*/
3946
__u64 handled_access_net;
4047
};

0 commit comments

Comments
 (0)