Skip to content

Commit 1ca9808

Browse files
tahifahimil0kod
authored andcommitted
landlock: Document LANDLOCK_SCOPE_SIGNAL
Extend documentation for Landlock ABI version 6 with signal scoping. Signed-off-by: Tahera Fahimi <[email protected]> Link: https://lore.kernel.org/r/dae0dbe1a78be2ce5506b90fc4ffd12c82fa1061.1725657728.git.fahimitahera@gmail.com [mic: Improve documentation] Signed-off-by: Mickaël Salaün <[email protected]>
1 parent f490e20 commit 1ca9808

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

Documentation/userspace-api/landlock.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ to be explicit about the denied-by-default access rights.
8282
LANDLOCK_ACCESS_NET_BIND_TCP |
8383
LANDLOCK_ACCESS_NET_CONNECT_TCP,
8484
.scoped =
85-
LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET,
85+
LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET |
86+
LANDLOCK_SCOPE_SIGNAL,
8687
};
8788
8889
Because we may not know on which kernel version an application will be
@@ -123,8 +124,9 @@ version, and only use the available subset of access rights:
123124
ruleset_attr.handled_access_fs &= ~LANDLOCK_ACCESS_FS_IOCTL_DEV;
124125
__attribute__((fallthrough));
125126
case 5:
126-
/* Removes LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET for ABI < 6 */
127-
ruleset_attr.scoped &= ~LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET;
127+
/* Removes LANDLOCK_SCOPE_* for ABI < 6 */
128+
ruleset_attr.scoped &= ~(LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET |
129+
LANDLOCK_SCOPE_SIGNAL);
128130
}
129131
130132
This enables to create an inclusive ruleset that will contain our rules.
@@ -321,10 +323,15 @@ for a set of actions by specifying it on a ruleset. For example, if a
321323
sandboxed process should not be able to :manpage:`connect(2)` to a
322324
non-sandboxed process through abstract :manpage:`unix(7)` sockets, we can
323325
specify such restriction with ``LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET``.
326+
Moreover, if a sandboxed process should not be able to send a signal to a
327+
non-sandboxed process, we can specify this restriction with
328+
``LANDLOCK_SCOPE_SIGNAL``.
324329

325330
A sandboxed process can connect to a non-sandboxed process when its domain is
326331
not scoped. If a process's domain is scoped, it can only connect to sockets
327332
created by processes in the same scope.
333+
Moreover, If a process is scoped to send signal to a non-scoped process, it can
334+
only send signals to processes in the same scope.
328335

329336
A connected datagram socket behaves like a stream socket when its domain is
330337
scoped, meaning if the domain is scoped after the socket is connected , it can
@@ -581,6 +588,13 @@ Starting with the Landlock ABI version 6, it is possible to restrict
581588
connections to an abstract :manpage:`unix(7)` socket by setting
582589
``LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET`` to the ``scoped`` ruleset attribute.
583590

591+
Signal scoping (ABI < 6)
592+
------------------------
593+
594+
Starting with the Landlock ABI version 6, it is possible to restrict
595+
:manpage:`signal(7)` sending by setting ``LANDLOCK_SCOPE_SIGNAL`` to the
596+
``scoped`` ruleset attribute.
597+
584598
.. _kernel_support:
585599

586600
Kernel support

0 commit comments

Comments
 (0)