Skip to content

Commit 50492f9

Browse files
committed
landlock: Fix documentation for landlock_create_ruleset(2)
Move and fix the flags documentation, and improve formatting. It makes more sense and it eases maintenance to document syscall flags in landlock.h, where they are defined. This is already the case for landlock_restrict_self(2)'s flags. The flags are now rendered like the syscall's parameters and description. Cc: Günther Noack <gnoack@google.com> Cc: Paul Moore <paul@paul-moore.com> Link: https://lore.kernel.org/r/20250416154716.1799902-1-mic@digikod.net Signed-off-by: Mickaël Salaün <mic@digikod.net>
1 parent 6b45664 commit 50492f9

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

include/uapi/linux/landlock.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@ struct landlock_ruleset_attr {
5353
__u64 scoped;
5454
};
5555

56-
/*
57-
* sys_landlock_create_ruleset() flags:
56+
/**
57+
* DOC: landlock_create_ruleset_flags
58+
*
59+
* **Flags**
60+
*
61+
* %LANDLOCK_CREATE_RULESET_VERSION
62+
* Get the highest supported Landlock ABI version (starting at 1).
5863
*
59-
* - %LANDLOCK_CREATE_RULESET_VERSION: Get the highest supported Landlock ABI
60-
* version.
61-
* - %LANDLOCK_CREATE_RULESET_ERRATA: Get a bitmask of fixed issues.
64+
* %LANDLOCK_CREATE_RULESET_ERRATA
65+
* Get a bitmask of fixed issues for the current Landlock ABI version.
6266
*/
6367
/* clang-format off */
6468
#define LANDLOCK_CREATE_RULESET_VERSION (1U << 0)

security/landlock/syscalls.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,16 @@ const int landlock_abi_version = 7;
169169
* the new ruleset.
170170
* @size: Size of the pointed &struct landlock_ruleset_attr (needed for
171171
* backward and forward compatibility).
172-
* @flags: Supported value:
172+
* @flags: Supported values:
173+
*
173174
* - %LANDLOCK_CREATE_RULESET_VERSION
174175
* - %LANDLOCK_CREATE_RULESET_ERRATA
175176
*
176177
* This system call enables to create a new Landlock ruleset, and returns the
177178
* related file descriptor on success.
178179
*
179-
* If @flags is %LANDLOCK_CREATE_RULESET_VERSION and @attr is NULL and @size is
180-
* 0, then the returned value is the highest supported Landlock ABI version
181-
* (starting at 1).
182-
*
183-
* If @flags is %LANDLOCK_CREATE_RULESET_ERRATA and @attr is NULL and @size is
184-
* 0, then the returned value is a bitmask of fixed issues for the current
185-
* Landlock ABI version.
180+
* If %LANDLOCK_CREATE_RULESET_VERSION or %LANDLOCK_CREATE_RULESET_ERRATA is
181+
* set, then @attr must be NULL and @size must be 0.
186182
*
187183
* Possible returned errors are:
188184
*
@@ -191,6 +187,9 @@ const int landlock_abi_version = 7;
191187
* - %E2BIG: @attr or @size inconsistencies;
192188
* - %EFAULT: @attr or @size inconsistencies;
193189
* - %ENOMSG: empty &landlock_ruleset_attr.handled_access_fs.
190+
*
191+
* .. kernel-doc:: include/uapi/linux/landlock.h
192+
* :identifiers: landlock_create_ruleset_flags
194193
*/
195194
SYSCALL_DEFINE3(landlock_create_ruleset,
196195
const struct landlock_ruleset_attr __user *const, attr,

0 commit comments

Comments
 (0)