Skip to contentSkip to conversation

Enable Landlock by default

PATCH In review Mickaël Salaün 1 participant 3 messages Dec 3, 2021 – Dec 22, 2021 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

cover Enable Landlock by default

Hi,

The Landlock security feature is built in Ubuntu kernel since 5.13 which is great! However, it is not enough to enable the CONFIG_SECURITY_LANDLOCK option as described in the related help. The CONFIG_LSM option needs to be prepended by "landlock," to make Landlock system calls available without modifying the kernel boot arguments.

Could you please apply the attached patch to make this feature more broadly available?

This can be validated with the tests provided by the kernel sources:

fakeroot make -C tools/testing/selftests TARGETS=landlock gen_tar tar -xf tools/testing/selftests/kselftest_install/kselftest-packages/kselftest.tar.gz

# as root:
./run_kselftest.sh

If Yama is enabled, half of the ptrace tests may failed, which is OK.

Regards,

Mickaël Salaün (1):
UBUNTU: [Config] Enable Landlock by default

 debian.master/config/config.common.ubuntu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

base-commit: 86d5f4d4ce66d96657de67b735dacb25b8ab8a1b

Signature · 1 line
2.33.1
#1 lore raw

PATCH 1/1 UBUNTU: [Config] Enable Landlock by default

Landlock is a feature to create security sandboxes thanks to 3 new dedicated system calls. They are designed to be safe to used by any processes, which can only drop their privileges, similarly to seccomp.

The new Landlock LSM is build in the kernel (CONFIG_SECURITY_LANDLOCK=y) but it is not enough to make it usable by default. As a stackable LSM, it is required to enable it at boot time, either with the "lsm=" boot argument, or with the CONFIG_LSM list (as described in the kernel documentation).

As for other stackable LSMs, prepending Landlock to the default LSM list enables users to potentially get more protection by default by letting applications sandbox themselves.

---
 debian.master/config/config.common.ubuntu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
debian.master/config/config.common.ubuntu +1 -1
index 912871ce8fde..0e26e7846024 100644
@@ -5702,7 +5702,7 @@ CONFIG_LPARCFG=y
 # CONFIG_LP_CONSOLE is not set
 CONFIG_LRU_CACHE=m
 CONFIG_LSI_ET1011C_PHY=m
-CONFIG_LSM="lockdown,yama,integrity,apparmor"
+CONFIG_LSM="landlock,lockdown,yama,integrity,apparmor"
 CONFIG_LSM_MMAP_MIN_ADDR=0
 CONFIG_LS_EXTIRQ=y
 CONFIG_LS_SCFG_MSI=y
Signature · 1 line
2.33.1

A message that is not in the archive (sent off-list or not yet received): YboEZixLVr2BnUX5@arighi-desktop

#3 lore raw

Re: APPLIED[J]: [PATCH v1 0/1] Enable Landlock by default

Quoted 27 lines · Andrea Righi
Quoted 19 lines · Mickaël Salaün

Hi,

The Landlock security feature is built in Ubuntu kernel since 5.13 which is great! However, it is not enough to enable the CONFIG_SECURITY_LANDLOCK option as described in the related help. The CONFIG_LSM option needs to be prepended by "landlock," to make Landlock system calls available without modifying the kernel boot arguments.

Could you please apply the attached patch to make this feature more broadly available?

This can be validated with the tests provided by the kernel sources:

fakeroot make -C tools/testing/selftests TARGETS=landlock gen_tar tar -xf tools/testing/selftests/kselftest_install/kselftest-packages/kselftest.tar.gz

# as root:
./run_kselftest.sh
Quoted 6 lines

If Yama is enabled, half of the ptrace tests may failed, which is OK.

Regards,

Mickaël Salaün (1):
UBUNTU: [Config] Enable Landlock by default

Quoted 9 lines

It makes sense to enable this security feature by default to me, it's also what upstream is doing.

Applied to jammy:linux (with an additional change to update CONFIG_LSM in debian.master/config/annotations).

Thanks,
-Andrea

Thanks Andrea!