Skip to content

Commit 5e46982

Browse files
committed
landlock: Explain how to support Landlock
Let's help users by documenting how to enable and check for Landlock in the kernel and the running system. The userspace-api section may not be the best place for this but it still makes sense to put all the user documentation at the same place. Signed-off-by: Mickaël Salaün <mic@digikod.net> Link: https://lore.kernel.org/r/20220513112743.156414-1-mic@digikod.net Reviewed-by: Paul Moore <paul@paul-moore.com>
1 parent 9e0c76b commit 5e46982

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

Documentation/userspace-api/landlock.rst

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. SPDX-License-Identifier: GPL-2.0
22
.. Copyright © 2017-2020 Mickaël Salaün <mic@digikod.net>
33
.. Copyright © 2019-2020 ANSSI
4-
.. Copyright © 2021 Microsoft Corporation
4+
.. Copyright © 2021-2022 Microsoft Corporation
55
66
=====================================
77
Landlock: unprivileged access control
@@ -18,6 +18,13 @@ is expected to help mitigate the security impact of bugs or
1818
unexpected/malicious behaviors in user space applications. Landlock empowers
1919
any process, including unprivileged ones, to securely restrict themselves.
2020

21+
We can quickly make sure that Landlock is enabled in the running system by
22+
looking for "landlock: Up and running" in kernel logs (as root): ``dmesg | grep
23+
landlock || journalctl -kg landlock`` . Developers can also easily check for
24+
Landlock support with a :ref:`related system call <landlock_abi_versions>`. If
25+
Landlock is not currently supported, we need to :ref:`configure the kernel
26+
appropriately <kernel_support>`.
27+
2128
Landlock rules
2229
==============
2330

@@ -264,6 +271,8 @@ users, and because they may use different kernel versions, it is strongly
264271
encouraged to follow a best-effort security approach by checking the Landlock
265272
ABI version at runtime and only enforcing the supported features.
266273

274+
.. _landlock_abi_versions:
275+
267276
Landlock ABI versions
268277
---------------------
269278

@@ -388,6 +397,24 @@ Starting with the Landlock ABI version 2, it is now possible to securely
388397
control renaming and linking thanks to the new `LANDLOCK_ACCESS_FS_REFER`
389398
access right.
390399

400+
.. _kernel_support:
401+
402+
Kernel support
403+
==============
404+
405+
Landlock was first introduced in Linux 5.13 but it must be configured at build
406+
time with `CONFIG_SECURITY_LANDLOCK=y`. Landlock must also be enabled at boot
407+
time as the other security modules. The list of security modules enabled by
408+
default is set with `CONFIG_LSM`. The kernel configuration should then
409+
contains `CONFIG_LSM=landlock,[...]` with `[...]` as the list of other
410+
potentially useful security modules for the running system (see the
411+
`CONFIG_LSM` help).
412+
413+
If the running kernel doesn't have `landlock` in `CONFIG_LSM`, then we can
414+
still enable it by adding ``lsm=landlock,[...]`` to
415+
Documentation/admin-guide/kernel-parameters.rst thanks to the bootloader
416+
configuration.
417+
391418
Questions and answers
392419
=====================
393420

0 commit comments

Comments
 (0)