From: sashiko-bot@kernel.org
Cc: linux-security-module@vger.kernel.org
Subject: Re: [PATCH v5 6/8] selftests/landlock: Add capability restriction tests
Date: Wed, 07 Oct 2026 10:13:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-162847@kernel.org> (raw)
In-Reply-To: <20261007100255.1333386-7-mic@digikod.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] selftests/landlock: uninitialized read of records if audit_count_records() fails
--
commit 0b24b77e1134932d1209607c6e9bc067e8fb747d
Author: Mickaël Salaün <mic@digikod.net>
selftests/landlock: Add capability restriction tests
This commit adds tests to exercise LANDLOCK_PERMISSION_CAPABILITY_USE
enforcement. It covers stacking combinations, non-standard capability
contexts, and audit and trace scenarios.
> diff --git a/tools/testing/selftests/landlock/cap_test.c b/tools/testing/selftests/landlock/cap_test.c
> new file mode 100644
> index 0000000000000..07976854ec5a8
> --- /dev/null
> +++ b/tools/testing/selftests/landlock/cap_test.c
> @@ -0,0 +1,1373 @@
[ ... ]
> +TEST_F(cap_audit, denied)
> +{
> + struct audit_records records;
> + int ruleset_fd;
> + __u64 domain_id;
[ ... ]
> + EXPECT_EQ(0, audit_count_records(self->audit_fd, &records));
> + EXPECT_EQ(0, records.access);
> + EXPECT_EQ(0, records.domain);
[Severity: Low]
Does this code read uninitialized stack memory in TEST_F(cap_audit, denied)
if audit_count_records() fails?
The records structure is declared on the stack without initialization.
If audit_count_records() returns early with an error, for instance if
regcomp() fails with -ENOMEM in tools/testing/selftests/landlock/audit.h,
records.access and records.domain will remain uninitialized.
Because EXPECT_EQ() does not abort test execution upon failure like
ASSERT_EQ() would, the test will continue and evaluate the uninitialized
records.access and records.domain fields.
Consider either zero-initializing the records struct upon declaration,
or replacing EXPECT_EQ with ASSERT_EQ for the audit_count_records() call.
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261007100255.1333386-1-mic@digikod.net?part=6
next prev parent reply other threads:[~2026-10-07 10:13 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 10:02 [PATCH v5 0/8] Landlock: Namespace and capability control Mickaël Salaün
2026-10-07 10:02 ` [PATCH v5 1/8] landlock: Rename quiet_masks to quiet_access Mickaël Salaün
2026-10-07 10:09 ` sashiko-bot
2026-10-07 10:02 ` [PATCH v5 2/8] landlock: Wrap per-layer access masks in struct layer_config Mickaël Salaün
2026-10-07 10:10 ` sashiko-bot
2026-10-07 10:02 ` [PATCH v5 3/8] landlock: Enforce namespace use restrictions Mickaël Salaün
2026-10-07 10:15 ` sashiko-bot
2026-10-07 10:02 ` [PATCH v5 4/8] landlock: Enforce capability restrictions Mickaël Salaün
2026-10-07 10:11 ` sashiko-bot
2026-10-07 10:02 ` [PATCH v5 5/8] selftests/landlock: Add namespace restriction tests Mickaël Salaün
2026-10-07 10:23 ` sashiko-bot
2026-10-07 10:02 ` [PATCH v5 6/8] selftests/landlock: Add capability " Mickaël Salaün
2026-10-07 10:13 ` sashiko-bot [this message]
2026-10-07 10:02 ` [PATCH v5 7/8] samples/landlock: Add capability and namespace restriction support Mickaël Salaün
2026-10-07 10:11 ` sashiko-bot
2026-10-07 10:02 ` [PATCH v5 8/8] landlock: Add documentation for capability and namespace restrictions Mickaël Salaün
2026-10-07 10:10 ` sashiko-bot
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=sashiko-outbox-162847@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-security-module@vger.kernel.org \
--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