From: sashiko-bot@kernel.org
To: "Günther Noack" <gnoack3000@gmail.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH 1/6] samples/landlock: Implement best-effort fallback for network rules.
Date: Sun, 30 Aug 2026 20:25:12 +0000 [thread overview]
Message-ID: <20260830202513.29C1F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260830201650.67050-2-gnoack3000@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The best-effort fallback logic introduces an early return that bypasses `unsetenv()`, leaking sandbox configuration environment variables to the child process.
--
commit 9984581b44a9424255f8b9ce2c25354f65e0816c
Author: Günther Noack <gnoack3000@gmail.com>
samples/landlock: Implement best-effort fallback for network rules.
This commit adds a best-effort fallback for network rules in the sandboxer
sample tool. If the Landlock ABI version does not support a requested network
feature, the operation is treated as a no-op instead of causing an error.
> diff --git a/samples/landlock/sandboxer.c b/samples/landlock/sandboxer.c
> index 030583273f3f7..1c514efecafbf 100644
> --- a/samples/landlock/sandboxer.c
> +++ b/samples/landlock/sandboxer.c
> @@ -198,6 +198,10 @@ static int populate_ruleset_net(const char *const env_var, const int ruleset_fd,
> .allowed_access = allowed_access,
> };
>
> + /* A rule without access rights and flags is a no-op. */
> + if (!allowed_access && !flags)
> + return 0;
> +
[Severity: Medium]
Does this early return bypass the cleanup of the environment variable?
Looking at populate_ruleset_net(), if the tool runs on an older kernel where
a network feature is not supported, the feature is masked out and
allowed_access becomes 0. Taking this early return avoids the unsetenv(env_var)
call further down in the function:
static int populate_ruleset_net(...)
{
...
if (!allowed_access && !flags)
return 0;
env_port_name = getenv(env_var);
if (!env_port_name)
return 0;
env_port_name = strdup(env_port_name);
unsetenv(env_var);
...
}
Will this inadvertently leak the sandbox configuration environment variables
(like LL_TCP_BIND) to the sandboxed child process?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260830201650.67050-1-gnoack3000@gmail.com?part=1
next prev parent reply other threads:[~2026-08-30 20:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-30 20:16 [PATCH 0/6] landlock: Support MPTCP bind and connect restrictions Günther Noack
2026-08-30 20:16 ` [PATCH 1/6] samples/landlock: Implement best-effort fallback for network rules Günther Noack
2026-08-30 20:25 ` sashiko-bot [this message]
2026-08-30 20:16 ` [PATCH 2/6] selftests/landlock: Generalize net test helpers for multiple socket types Günther Noack
2026-08-30 20:28 ` sashiko-bot
2026-08-30 20:16 ` [PATCH 3/6] landlock: Add MPTCP bind and connect access rights Günther Noack
2026-08-31 4:09 ` Geliang Tang
2026-08-30 20:16 ` [PATCH 4/6] selftests/landlock: Add MPTCP network access tests Günther Noack
2026-08-30 20:27 ` sashiko-bot
2026-08-30 20:16 ` [PATCH 5/6] samples/landlock: Support MPTCP access rights Günther Noack
2026-08-30 20:16 ` [PATCH 6/6] landlock: Document " Günther Noack
2026-08-30 21:06 ` [PATCH 0/6] landlock: Support MPTCP bind and connect restrictions MPTCP CI
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=20260830202513.29C1F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=gnoack3000@gmail.com \
--cc=mptcp@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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