SELinux Security Module development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
Cc: audit@vger.kernel.org, selinux@vger.kernel.org
Subject: Re: [PATCH v1 2/2] selftests/landlock: Check full ioctl commands in audit records
Date: Thu, 10 Sep 2026 15:02:31 +0000	[thread overview]
Message-ID: <20260910150232.680081F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260910144837.381855-3-mic@digikod.net>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incomplete application of the architecture-independent ioctl test update, leaving `audit_quiet_layout1_test_body()` still using the architecture-dependent `FIONREAD`.
--

commit e4cb547991b6b44a81dce30858992f55ca217a5f
Author: Mickaël Salaün <mic@digikod.net>

selftests/landlock: Check full ioctl commands in audit records

This commit updates the ioctl audit test to use a 32-bit
architecture-independent command instead of FIONREAD. This ensures the test
can detect if the kernel truncates the encoded direction and size bits in the
audit record.

> diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c
> index 86e08aa6e0a7e..92d2f720ab054 100644
> --- a/tools/testing/selftests/landlock/fs_test.c
> +++ b/tools/testing/selftests/landlock/fs_test.c

[ ... ]

> @@ -7702,10 +7706,10 @@ TEST_F(audit_layout1, ioctl_dev)
>  
>  	fd = open("/dev/null", O_RDONLY | O_CLOEXEC);
>  	ASSERT_LE(0, fd);
> -	EXPECT_EQ(EACCES, ioctl_error(_metadata, fd, FIONREAD));
> +	EXPECT_EQ(EACCES, ioctl_error(_metadata, fd, unknown_ioctl_cmd));
>  	EXPECT_EQ(0, matches_log_fs_extra(_metadata, self->audit_fd,
>  					  "fs\\.ioctl_dev", "/dev/null",
> -					  " ioctlcmd=0x541b"));
> +					  " ioctlcmd=0xc00ffeee"));

[Severity: Medium]
Should the audit_quiet_layout1_test_body() function receive this same update?

It appears that audit_quiet_layout1_test_body() still uses FIONREAD and
hardcodes the x86 16-bit value:

tools/testing/selftests/landlock/fs_test.c:audit_quiet_layout1_test_body() {
    ...
    ret = ioctl_error(_metadata, fd, FIONREAD);
    ...
    if (target->audit_ioctl)
        ASSERT_EQ(0, matches_log_fs_extra(_metadata, self->audit_fd,
                                          "fs\\.ioctl_dev", target->target,
                                          " ioctlcmd=0x541b\\+"));
    ...
}

Leaving this unchanged means the quiet audit tests will fail to verify the
32-bit truncation fix. It also leaves the test broken on non-x86 architectures
like Alpha and MIPS where FIONREAD has a different value.

>  
>  	EXPECT_EQ(0, audit_count_records(self->audit_fd, &records));
>  	EXPECT_EQ(0, records.access);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260910144837.381855-1-mic@digikod.net?part=2

  reply	other threads:[~2026-09-10 15:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 14:48 [PATCH v1 0/2] lsm: Preserve full ioctl commands in audit records Mickaël Salaün
2026-09-10 14:48 ` [PATCH v1 1/2] " Mickaël Salaün
2026-09-10 14:56   ` sashiko-bot
2026-09-10 14:48 ` [PATCH v1 2/2] selftests/landlock: Check " Mickaël Salaün
2026-09-10 15:02   ` sashiko-bot [this message]
2026-09-11 11:24   ` Günther Noack

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=20260910150232.680081F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=audit@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=selinux@vger.kernel.org \
    /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