linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Justin Suess <utilityemal77@gmail.com>
To: m@maowtm.org
Cc: gnoack@google.com, jack@suse.cz,
	linux-security-module@vger.kernel.org, mic@digikod.net,
	utilityemal77@gmail.com, xandfury@gmail.com
Subject: Re: [PATCH v5 07/10] selftests/landlock: add tests for quiet flag with fs rules
Date: Mon, 24 Nov 2025 09:36:39 -0500	[thread overview]
Message-ID: <20251124143639.3321365-1-utilityemal77@gmail.com> (raw)
In-Reply-To: <a839025f9ce9facee60ff8238ee350b5e780b777.1763931318.git.m@maowtm.org>

Good morning,

Great job on the patch.

Small suggestion on the tests and samples. I saw you
added a bool quiet to some methods for the quiet flag.

> diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c
> index 943b6e2ac53d..6aa65d344c72 100644
> --- a/tools/testing/selftests/landlock/fs_test.c
> +++ b/tools/testing/selftests/landlock/fs_test.c
> @@ -718,11 +718,15 @@ TEST_F_FORK(layout1, rule_with_unhandled_access)
>  
>  static void add_path_beneath(struct __test_metadata *const _metadata,
>  			     const int ruleset_fd, const __u64 allowed_access,
> -			     const char *const path)
> +			     const char *const path, bool quiet)
>  {
>  	struct landlock_path_beneath_attr path_beneath = {
>  		.allowed_access = allowed_access,
>  	};
> +	__u32 flags = 0;
> +
> +	if (quiet)
> +		flags |= LANDLOCK_ADD_RULE_QUIET;
>  
>  	path_beneath.parent_fd = open(path, O_PATH | O_CLOEXEC);
>  	ASSERT_LE(0, path_beneath.parent_fd)


I think that the bool quiet could be replaced with a flags field
so it can support other flags.

diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c
index 6aa65d344c72..5c38a11f1a05 100644
--- a/tools/testing/selftests/landlock/fs_test.c
+++ b/tools/testing/selftests/landlock/fs_test.c
@@ -717,16 +717,12 @@ TEST_F_FORK(layout1, rule_with_unhandled_access)
 }
 
 static void add_path_beneath(struct __test_metadata *const _metadata,
-			     const int ruleset_fd, const __u64 allowed_access,
-			     const char *const path, bool quiet)
+			 const int ruleset_fd, const __u64 allowed_access,
+			 const char *const path, __u32 flags)
 {
 	struct landlock_path_beneath_attr path_beneath = {
 		.allowed_access = allowed_access,
 	};
-	__u32 flags = 0;
-
-	if (quiet)
-		flags |= LANDLOCK_ADD_RULE_QUIET;
 
 	path_beneath.parent_fd = open(path, O_PATH | O_CLOEXEC);
 	ASSERT_LE(0, path_beneath.parent_fd)

And then update the tests to account for the changed
function signature. 

I think the bool quiet in the landlock-sandboxer methods 
populate_ruleset_fs and populate_ruleset_net (in 
samples/landlock/sandboxer.c) should be updated as well, 
replacing the bool quiet with a general flags field. 

I have change this in my patch but it might make more sense in 
your patch since this is the first patch to add flags and would
make it easier if anyone else decides to add flags rebased on
your patch.

Great work and thank you for your help.

Kind Regards,
Justin Suess

  reply	other threads:[~2025-11-24 14:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-23 20:57 [PATCH v5 00/10] Implement LANDLOCK_ADD_RULE_QUIET Tingmao Wang
2025-11-23 20:57 ` [PATCH v5 01/10] landlock: Add a place for flags to layer rules Tingmao Wang
2025-11-23 20:57 ` [PATCH v5 02/10] landlock: Add API support and docs for the quiet flags Tingmao Wang
2025-11-23 21:37   ` Tingmao Wang
2025-11-23 20:57 ` [PATCH v5 03/10] landlock: Suppress logging when quiet flag is present Tingmao Wang
2025-11-23 20:57 ` [PATCH v5 04/10] landlock: Fix wrong type usage Tingmao Wang
2025-11-23 20:57 ` [PATCH v5 05/10] samples/landlock: Add quiet flag support to sandboxer Tingmao Wang
2025-11-23 20:57 ` [PATCH v5 06/10] selftests/landlock: Replace hard-coded 16 with a constant Tingmao Wang
2025-11-23 20:57 ` [PATCH v5 07/10] selftests/landlock: add tests for quiet flag with fs rules Tingmao Wang
2025-11-24 14:36   ` Justin Suess [this message]
2025-11-25  0:57     ` Tingmao Wang
2025-11-23 20:57 ` [PATCH v5 08/10] selftests/landlock: add tests for quiet flag with net rules Tingmao Wang
2025-11-23 20:57 ` [PATCH v5 09/10] selftests/landlock: Add tests for quiet flag with scope Tingmao Wang
2025-11-23 20:57 ` [PATCH v5 10/10] selftests/landlock: Add tests for invalid use of quiet flag Tingmao Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251124143639.3321365-1-utilityemal77@gmail.com \
    --to=utilityemal77@gmail.com \
    --cc=gnoack@google.com \
    --cc=jack@suse.cz \
    --cc=linux-security-module@vger.kernel.org \
    --cc=m@maowtm.org \
    --cc=mic@digikod.net \
    --cc=xandfury@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).