From 57493c3b7f449a60d1c43322158671b98684f9b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Noack?= Date: Fri, 13 Nov 2026 21:23:27 +0100 Subject: landlock: Clarify implicit handling of LANDLOCK_ACCESS_FS_REFER MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The LANDLOCK_ACCESS_FS_REFER right is handled implicitly in a ruleset, but only if any other filesystem access right is declared as handled in the given ruleset. The old documentation was still a remnant from the times when filesystem access rights were the only access rights that existed in Landlock, but it became misleading when we introduced additional types of access rights. Fixes: fff69fb03dde ("landlock: Support network rules with TCP bind and connect") Signed-off-by: Günther Noack Link: https://patch.msgid.link/20261113-b4-landlock-refer-nonfs-layer-v3-5-02d7e42bcdfd@gmail.com [mic: Reword _LANDLOCK_ACCESS_FS_INITIALLY_DENIED comment, fix comment wrapping, and include erratum 5 in userspace-api/landlock.rst] Signed-off-by: Mickaël Salaün --- include/uapi/linux/landlock.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'include/uapi/linux') diff --git a/include/uapi/linux/landlock.h b/include/uapi/linux/landlock.h index 24510e5d8479..7e38b9d1bf12 100644 --- a/include/uapi/linux/landlock.h +++ b/include/uapi/linux/landlock.h @@ -22,10 +22,10 @@ * enacted. Vice versa, access rights that are not specifically listed here are * not going to be denied by this ruleset when it is enacted. * - * For historical reasons, the %LANDLOCK_ACCESS_FS_REFER right is always denied - * by default, even when its bit is not set in @handled_access_fs. In order to - * add new rules with this access right, the bit must still be set explicitly - * (cf. `Filesystem flags`_). + * For historical reasons, as soon as any filesystem access right is handled in + * @handled_access_fs, the %LANDLOCK_ACCESS_FS_REFER right is always denied as + * well. In order to add new rules with this access right, the bit must still + * be set explicitly (cf. `Filesystem flags`_). * * The explicit listing of *handled access rights* is required for backwards * compatibility reasons. In most use cases, processes that use Landlock will @@ -462,10 +462,11 @@ struct landlock_capability_attr { * This access right is available since the second version of the Landlock * ABI. * - * This is the only access right which is denied by default by any ruleset, - * even if the right is not specified as handled at ruleset creation time. - * The only way to make a ruleset grant this right is to explicitly allow it - * for a specific directory by adding a matching rule to the ruleset. + * This is the only access right which is denied by default by any ruleset + * that handles filesystem access rights, even if the right is not specified + * as handled at ruleset creation time. The only way to make a ruleset grant + * this right is to explicitly allow it for a specific directory by adding a + * matching rule to the ruleset. * * In particular, when using the first Landlock ABI version, Landlock will * always deny attempts to reparent files between different directories. -- cgit v1.2.3 From c0aa8acdd94e9ec0ea2fefe8fa5b31c03c271c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= Date: Wed, 18 Nov 2026 15:52:10 +0100 Subject: landlock: Fix capability restriction documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some documented claims about LANDLOCK_PERMISSION_CAPABILITY_USE do not hold for every capability check. Remove them instead of listing their exceptions, and stop calling this permission a hook. Cc: Günther Noack Cc: Paul Moore Cc: Serge Hallyn Acked-by: Serge Hallyn (AMD) Reviewed-by: Günther Noack Fixes: 97c8386f1d74 ("landlock: Enforce capability restrictions") Link: https://patch.msgid.link/20261118145217.2551053-7-mic@digikod.net Signed-off-by: Mickaël Salaün --- include/uapi/linux/landlock.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'include/uapi/linux') diff --git a/include/uapi/linux/landlock.h b/include/uapi/linux/landlock.h index 7e38b9d1bf12..8ce0406ba543 100644 --- a/include/uapi/linux/landlock.h +++ b/include/uapi/linux/landlock.h @@ -623,10 +623,9 @@ struct landlock_capability_attr { * - %LANDLOCK_PERMISSION_CAPABILITY_USE: Restrict the use of specific Linux * capabilities. A process in a Landlock domain that handles this permission * is denied from exercising capabilities that are not explicitly allowed by a - * %LANDLOCK_RULE_CAPABILITY rule. This hook is purely restrictive: it can - * deny capabilities that the kernel would otherwise grant, but it can never - * grant capabilities that the kernel already denied. Support added in - * Landlock ABI version 12. + * %LANDLOCK_RULE_CAPABILITY rule. Landlock only reduces the capabilities + * that processes can use: it does not let them use capabilities that they + * would not have without Landlock. Support added in Landlock ABI version 12. */ #define LANDLOCK_PERMISSION_NAMESPACE_USE (1ULL << 0) #define LANDLOCK_PERMISSION_CAPABILITY_USE (1ULL << 1) -- cgit v1.2.3