Skip to content

Commit d1b2ab2

Browse files
gnoackl0kod
authored andcommitted
landlock: Document FS access right for pathname UNIX sockets
Add LANDLOCK_ACCESS_FS_RESOLVE_UNIX to the example code, and explain it in the section about previous limitations. The bulk of the interesting flag documentation lives in the kernel header and is included in the Sphinx rendering. Cc: Justin Suess <utilityemal77@gmail.com> Cc: Mickaël Salaün <mic@digikod.net> Signed-off-by: Günther Noack <gnoack3000@gmail.com> Link: https://lore.kernel.org/r/20260327164838.38231-13-gnoack3000@gmail.com Signed-off-by: Mickaël Salaün <mic@digikod.net>
1 parent dc75f89 commit d1b2ab2

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

Documentation/userspace-api/landlock.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ to be explicit about the denied-by-default access rights.
7777
LANDLOCK_ACCESS_FS_MAKE_SYM |
7878
LANDLOCK_ACCESS_FS_REFER |
7979
LANDLOCK_ACCESS_FS_TRUNCATE |
80-
LANDLOCK_ACCESS_FS_IOCTL_DEV,
80+
LANDLOCK_ACCESS_FS_IOCTL_DEV |
81+
LANDLOCK_ACCESS_FS_RESOLVE_UNIX,
8182
.handled_access_net =
8283
LANDLOCK_ACCESS_NET_BIND_TCP |
8384
LANDLOCK_ACCESS_NET_CONNECT_TCP,
@@ -127,6 +128,10 @@ version, and only use the available subset of access rights:
127128
/* Removes LANDLOCK_SCOPE_* for ABI < 6 */
128129
ruleset_attr.scoped &= ~(LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET |
129130
LANDLOCK_SCOPE_SIGNAL);
131+
__attribute__((fallthrough));
132+
case 6 ... 8:
133+
/* Removes LANDLOCK_ACCESS_FS_RESOLVE_UNIX for ABI < 9 */
134+
ruleset_attr.handled_access_fs &= ~LANDLOCK_ACCESS_FS_RESOLVE_UNIX;
130135
}
131136
132137
This enables the creation of an inclusive ruleset that will contain our rules.
@@ -700,6 +705,13 @@ enforce Landlock rulesets across all threads of the calling process
700705
using the ``LANDLOCK_RESTRICT_SELF_TSYNC`` flag passed to
701706
sys_landlock_restrict_self().
702707

708+
Pathname UNIX sockets (ABI < 9)
709+
-------------------------------
710+
711+
Starting with the Landlock ABI version 9, it is possible to restrict
712+
connections to pathname UNIX domain sockets (:manpage:`unix(7)`) using
713+
the new ``LANDLOCK_ACCESS_FS_RESOLVE_UNIX`` right.
714+
703715
.. _kernel_support:
704716

705717
Kernel support

0 commit comments

Comments
 (0)