Received: from smtp-42ad.mail.infomaniak.ch (smtp-42ad.mail.infomaniak.ch [84.16.66.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9328A33892C for ; Thu, 27 Nov 2025 16:57:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=84.16.66.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764262655; cv=none; b=LLAf1BI2zNSS2JHxOsJLt/qLhF65/Y9tzisB+UwSkG+KDCITu3CGAu0Nu8tK5anHftAAqvQ67HH4FGokfQuJpodMnDnzTe1IuYrjDEfZm9YjAK6MjgedR7EhwyZB0b6PTOEKntEA8nE6ybCR4D7Sc0M0yqBiBclpKIzpYlLFrhA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764262655; c=relaxed/simple; bh=yKfoAhUeNlemorcYxw4yL14VYNrcxGWoQXtJzYJZsZA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=N7gYW1zL5IAURmvBMYPzEEvlklBflWnUpua1+JmK4z+W/OkCEqNn14W3QnL7Z3/OS02zT+oUY6j08P3SLi0gG/WJcZSzfSc28No4AgU+6twb3BH/eyzd9Lrd4G2eyGPTb80CWu/bQ13LWwL4zc4fwFoNlIiZ+nfoHxfVrZomZZY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=digikod.net; spf=pass smtp.mailfrom=digikod.net; dkim=pass (1024-bit key) header.d=digikod.net header.i=@digikod.net header.b=nF4qk+Fn; arc=none smtp.client-ip=84.16.66.173 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.b="nF4qk+Fn" Received: from smtp-4-0001.mail.infomaniak.ch (unknown [IPv6:2001:1600:7:10::a6c]) by smtp-4-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4dHMqZ1YhfzGWS; Thu, 27 Nov 2025 17:50:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digikod.net; s=20191114; t=1764262218; bh=/joIQd3Z2tdeV5NEK5aDhgrlOaIXqRbtYcvTxLNMBZk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nF4qk+FnK9epBbjtFGhWFceXUdPA6r1gfu2cwUbFI0wMA2r8o6GPk/MAHr9njetj7 qWfss5FPqbYnxoIn0mZf4D4vGCJFUcFVVGAdLToxx9EvLdOZepFv+HCMXvhJuhVEe7 jNZp6NkfaI90eNFmxXlnPeudnghUDwnFoOU06c60= Received: from unknown by smtp-4-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4dHMqY0ZfpzXkx; Thu, 27 Nov 2025 17:50:16 +0100 (CET) Date: Thu, 27 Nov 2025 17:49:45 +0100 From: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= To: =?utf-8?Q?G=C3=BCnther?= Noack , Tingmao Wang Cc: Al Viro , Ben Scarlato , Christian Brauner , Jann Horn , Jeff Xu , Justin Suess , Mikhail Ivanov , Paul Moore , Song Liu , linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, Nicolas Bouchinet , Matthieu Buffet , NeilBrown Subject: Re: [PATCH v4 4/4] selftests/landlock: Add disconnected leafs and branch test suites Message-ID: <20251127.Zoogohsei6ie@digikod.net> References: <20251126191159.3530363-1-mic@digikod.net> <20251126191159.3530363-5-mic@digikod.net> Precedence: bulk X-Mailing-List: linux-security-module@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20251126191159.3530363-5-mic@digikod.net> X-Infomaniak-Routing: alpha On Wed, Nov 26, 2025 at 08:11:57PM +0100, Mickaël Salaün wrote: > Test disconnected directories with two test suites and 31 variants to > cover the main corner cases. > > These tests are complementary to the previous commit. > > Add test_renameat() and test_exchangeat() helpers. > > Test coverage for security/landlock is 92.1% of 1927 lines according to > LLVM 20. > > Cc: Günther Noack > Cc: Song Liu > Cc: Tingmao Wang > Signed-off-by: Mickaël Salaün > --- > > Changes since v3: > - Update tests to reflect the new approach: > * layout4_disconnected_leafs.s1d41_s1d42_disconnected: allow all > * layout4_disconnected_leafs.s3d1_s4d1_new_parent: allow all > * layout4_disconnected_leafs.f1_f2_f3: allow read > * layout5_disconnected_branch.s2d3_mount1_dst_parent: allow all > * layout5_disconnected_branch.s4d1_rename_parent: allow all > - Update test coverage. > > Changes since v2: > - Update test coverage. > > Changes since v1: > - Rename layout4_disconnected to layout4_disconnected_leafs. > - Fix variable names. > - Add layout5_disconnected_branch test suite with 19 variants to cover > potential implementation issues. > --- > tools/testing/selftests/landlock/fs_test.c | 912 +++++++++++++++++++++ > 1 file changed, 912 insertions(+) > +/* > + * layout5_disconnected_branch before rename: > + * > + * tmp > + * ├── s1d1 > + * │   └── s1d2 [source of the first bind mount] > + * │   └── s1d3 > + * │   ├── s1d41 > + * │   │   ├── f1 > + * │   │   └── f2 > + * │   └── s1d42 > + * │   ├── f3 > + * │   └── f4 > + * ├── s2d1 > + * │   └── s2d2 [source of the second bind mount] > + * │   └── s2d3 > + * │   └── s2d4 [first s1d2 bind mount] > + * │   └── s1d3 > + * │   ├── s1d41 > + * │   │   ├── f1 > + * │   │   └── f2 > + * │   └── s1d42 > + * │   ├── f3 > + * │   └── f4 > + * ├── s3d1 > + * │   └── s3d2 [second s2d2 bind mount] > + * │   └── s2d3 > + * │   └── s2d4 [first s1d2 bind mount] > + * │   └── s1d3 > + * │   ├── s1d41 > + * │   │   ├── f1 > + * │   │   └── f2 > + * │   └── s1d42 > + * │   ├── f3 > + * │   └── f4 > + * └── s4d1 > + * > + * After rename: > + * > + * tmp > + * ├── s1d1 > + * │   └── s1d2 [source of the first bind mount] > + * │   └── s1d3 > + * │   ├── s1d41 > + * │   │   ├── f1 > + * │   │   └── f2 > + * │   └── s1d42 > + * │   ├── f3 > + * │   └── f4 > + * ├── s2d1 > + * │   └── s2d2 [source of the second bind mount] > + * ├── s3d1 > + * │   └── s3d2 [second s2d2 bind mount] > + * └── s4d1 > + * └── s2d3 [renamed here] > + * └── s2d4 [first s1d2 bind mount] > + * └── s1d3 > + * ├── s1d41 > + * │   ├── f1 > + * │   └── f2 > + * └── s1d42 > + * ├── f3 > + * └── f4 > + * > + * Decision path: s1d3 -> s1d2 -> s2d2 -> s3d1 -> tmp > + * s2d3 is ignored, as well as the directories under the mount points. I didn't update this comment, here is the new one: * Decision path for access from the s3d1/s3d2/s2d3/s2d4/s1d3 file descriptor: * 1. first bind mount: s1d3 -> s1d2 * 2. second bind mount: s2d3 * 3. tmp mount: s4d1 -> tmp [disconnected branch] * 4. second bind mount: s2d2 * 5. tmp mount: s3d1 -> tmp * 6. parent mounts: [...] -> / * * The s4d1 directory is evaluated even if it is not in the s2d2 mount.