From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.125.25.15 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796399572; b=L3UONgCen+Bih7mIV9yXbgQ1yiLFOU+mU+uhwp/pw+K4h6auLyQ/27SYIBwIzjjvysFc 8sP0hZXBlrn1VmDHB7F28ay6oCz4TGHodVMRXelJrNVwZ4scypYpOYLNMLVLMPsdJwHk8 4lx5nCpdq/fJWeJKXRRo6eRnS1sChluzWFvaD7H8l7uL4WuzF62uK38q9Ftvcc4DhwgCJ KE09HVrGEfJTi+KfXvUk9U+kDbuLQd64l1PFKyt/ZJKAqEFsKStL+B3dwVlOvkpy/g57q Lrcv9vziggDXn0+VpB8/bsr8I7ORdpPLOO+A7CyBW1lW5fKUpROYfIXO6h/EKwOqNKA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796399572; h=DMARC-Filter:Received:DKIM-Signature:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To: X-Infomaniak-Routing; bh=bf9XmwCKZfIsrfNBh9khcWnqlFZyY1LTax65oDJs8+w=; b=ylFDtmtirlQQgG0Mm8BWr10refvq7MNzKxKruDR2Zj9FNjYsLhN/wsoANgplVqPoBL6Y HkizFZFMbKg0ag3tyC79lcn4XUqu9i+Y/APQeXA+apgfOUrwwX16S4N4zgHjnPZDmLLmL q+TOk/eSnfkq0jWAQrUhACQdkH/7EvVsp9SPrhXlfcyD/xxBa78QJlBt682PU36+IJS98 vHR6Wmcghx2T6mkEvieEfufuI5W68siFT0SgBo8R4OeO+tZ4ntp4s6fRZc9sB+V9fzRf8 Fm4ML1EwpPW9SIzOT4Y5ddfP31jvfx3mzCXgRf+BJOoe/5A+AS9EEfcv3hRJphW5F+g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=digikod.net; spf=pass smtp.mailfrom=digikod.net; dkim=pass header.d=digikod.net header.i=@digikod.net header.a=rsa-sha256 header.s=20191114 header.b=N5P9uWAh; arc=none smtp.remote-ip=185.125.25.15 Received: from smtp-190f.mail.infomaniak.ch (smtp-190f.mail.infomaniak.ch [185.125.25.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 058BF606A322; Fri, 4 Dec 2026 15:52:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 058BF606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=digikod.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.a=rsa-sha256 header.s=20191114 header.b=N5P9uWAh Received: from smtp-3-0001.mail.infomaniak.ch (smtp-3-0001.mail.infomaniak.ch [10.4.36.108]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4jgwxS3Qd8zGhm; Fri, 4 Dec 2026 16:52:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digikod.net; s=20191114; t=1796399564; bh=bf9XmwCKZfIsrfNBh9khcWnqlFZyY1LTax65oDJs8+w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N5P9uWAh4wFofGzyA6imsrHXJWHOtUt7/zRwLfDYpK26jOiYP5dDOuynHY0DDh6PA ChymOf6ML6WXcKmWJD2uMQ1mP5+VZcLbjZoxYz8oo6RZMWGYYbZ6DMhVRH9b82Ow3Z k39oGCoQK9i7JRg0qseSUciWB+lr6maNM8wW3QmQ= Received: from unknown by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4jgwxR027zzDDg; Fri, 4 Dec 2026 16:52:42 +0100 (CET) Date: Fri, 4 Dec 2026 16:52:38 +0100 From: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= To: =?utf-8?Q?G=C3=BCnther?= Noack Cc: Paul Moore , James Morris , "Serge E. Hallyn" , Konstantin Meskhidze , Shuah Khan , Dwi Siswanto , linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v3 0/5] landlock: Fix REFER in layered domains Message-ID: <20261204.ip5Eughuphah@digikod.net> References: <20261113-b4-landlock-refer-nonfs-layer-v3-0-02d7e42bcdfd@gmail.com> X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20261113-b4-landlock-refer-nonfs-layer-v3-0-02d7e42bcdfd@gmail.com> X-Infomaniak-Routing: alpha Thanks, that is now in master: https://git.kernel.org/torvalds/c/eef2bc5a82c25d25c3082f5d86d97a300caeb678 On Fri, Nov 13, 2026 at 09:23:22PM +0100, Günther Noack wrote: > This patchset fixes a bug in Landlock layering, > reported by Dwi Siswanto in [1] and [2]. (Thanks!) > > The bug > ======= > > When Landlock initializes layer masks for path walk based checks, it > unconditionally adds the LANDLOCK_ACCESS_FS_REFER access right to the > handled access rights. > > This leads to a wrong layer composition, in cases where the following > layers are stacked: > > 1. A FS layer restricting REFER, but also allowing REFER in a rule > (e.g., handle REFER, but allow REFER on /) > 2. A non-FS layer (e.g., networking-only layer) > > When these rulesets are enforced **individually**, there are REFER > operations that are allowed in both rulesets -- the ones that 1 > allows. > > When these rulesets are enforced **on top of each other**, the non-FS > layer starts enforcing REFER implicitly as well, and all REFER > operations are denied. > > This patchset > ============= > > This patchset fixes the issue in five commits: > > 1) The fix, which should be backportable to older kernels > and which is CC'd to stable@. > 2) KUnit test. > 3) Regression selftests. > 4) A more elegant fix for newer kernels, > which is intentionally *not* CC'd to stable@, > because it would break on older kernels. > > In newer kernels, we already add the "REFER" access right to the > handled access rights when we merge the ruleset into the new > domain, so there is no additional calculation to do for it. > 5) A documentation update to clarify the situations where the *_REFER > right is implicit. > > Both the selftest and the KUnit test are built to fail before commit > 1, work after commit 1 and continue working after commit 4. > > Please let me know what you think! > > –Günther > > [1] https://github.com/landlock-lsm/go-landlock/issues/66 > [2] https://github.com/landlock-lsm/linux/issues/67 > > --- > Changes in v3: > - Add erratum 5 describing the issue > - Add KUnit test > - Selftests: Test the scenarios where layers are enforced in the other order > - access.h, fs_test.c: Update some remaining misdocumentation of the REFER right > - Link to v2: https://patch.msgid.link/20261108-b4-landlock-refer-nonfs-layer-v2-0-2b405fc1b3aa@gmail.com > > Changes in v2: > - Rebase on master and resolve conflicts > - Fixed documentation as pointed out by Dwi Siswanto in > https://lore.kernel.org/all/20261101125114.19009-1-me@dw1.io/ > - Link to v1: https://patch.msgid.link/20261030102411.12985-1-gnoack3000@gmail.com > > --- > Günther Noack (5): > landlock: Fix layer composition of LANDLOCK_ACCESS_FS_REFER > landlock: Add KUnit test for landlock_get_fs_access_mask() > selftests/landlock: Test that layering does not break refer > landlock: Simplify landlock_get_fs_access_mask() > landlock: Clarify implicit handling of LANDLOCK_ACCESS_FS_REFER > > include/uapi/linux/landlock.h | 17 +++++---- > security/landlock/access.h | 13 ++++--- > security/landlock/domain.c | 44 +++++++++++++++++++++ > security/landlock/domain.h | 9 +++-- > security/landlock/errata/abi-4.h | 21 ++++++++++ > tools/testing/selftests/landlock/fs_test.c | 61 ++++++++++++++++++++++++++++-- > 6 files changed, 145 insertions(+), 20 deletions(-) > --- > base-commit: fa4ad798f6f681031775266044ba1b0cf3c670bd > change-id: 20261108-b4-landlock-refer-nonfs-layer-fda8bcbe0b44 > > Best regards, > -- > Günther Noack > >