From: sashiko-bot@kernel.org
To: "David Windsor" <dwindsor@gmail.com>
Cc: selinux@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH v6 bpf-next 4/4] selftests/bpf: add tests for bpf_init_inode_xattr kfunc
Date: Thu, 30 Jul 2026 23:55:32 +0000 [thread overview]
Message-ID: <20260730235532.B02691F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260730234533.1912709-5-dwindsor@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Silent test skipping if the testfile exists from a previous aborted run.
- [Low] Multi-line comment does not follow the required BPF subsystem style.
--
--- Patch [4]: [PATCH v6 bpf-next 4/4] selftests/bpf: add tests for bpf_init_inode_xattr kfunc ---
commit a299ac47c44a77d98dbdf43f3ba7c981f13fd930
Author: David Windsor <dwindsor@gmail.com>
selftests/bpf: add tests for bpf_init_inode_xattr kfunc
This commit adds selftests for BPF atomic inode xattr labeling in
the inode_init_security hook.
> --- a/tools/testing/selftests/bpf/prog_tests/fs_kfuncs.c
> +++ b/tools/testing/selftests/bpf/prog_tests/fs_kfuncs.c
[ ... ]
> @@ -268,6 +269,155 @@ static void test_fsverity(void)
> remove(testfile);
> }
>
> +static void test_init_inode_xattr(void)
> +{
> + struct test_init_inode_xattr *skel = NULL;
> + int fd = -1, err;
> + char value_out[64];
> +
> + /* This test must be run from a fs that calls
> + * security_inode_init_security().
> + */
[Severity: Low]
This isn't a bug, but does this multi-line comment violate the BPF subsystem
style guidelines? The guidelines prefer the opening /* on its own line:
/*
* This test must be run from a fs that calls
* security_inode_init_security().
*/
> + const char *testfile_new = "/dev/shm/test_progs_fs_kfuncs_new";
> +
> + skel = test_init_inode_xattr__open_and_load();
> + if (!ASSERT_OK_PTR(skel, "test_init_inode_xattr__open_and_load"))
> + return;
> +
> + skel->bss->monitored_pid = getpid();
> + err = test_init_inode_xattr__attach(skel);
> + if (!ASSERT_OK(err, "test_init_inode_xattr__attach"))
> + goto out;
> +
> + /* Trigger inode_init_security */
> + fd = open(testfile_new, O_CREAT | O_RDWR, 0644);
[Severity: Medium]
Could this result in silently skipping the test if the file already exists
from a previous aborted run?
By omitting O_EXCL, if the test file is already present, open() will not
create a new inode. This means the inode_init_security hook won't trigger,
and the test will hit the skip condition below. Should we use
O_CREAT | O_EXCL | O_RDWR here to ensure we always create a new inode?
> + if (!ASSERT_GE(fd, 0, "create_file"))
> + goto out;
> +
> + /*
> + * Probably should not be needed as we will be labeling a file
> + * in /dev/shm, but just in case we check if the hook was actually
> + * called.
> + */
> + if (!skel->bss->hook_ran) {
> + printf("%s:SKIP:inode_init_security hook was not invoked\n",
> + __func__);
> + test__skip();
> + goto out;
> + }
[ ... ]
> +static void test_init_inode_xattr_slot_limit(void)
> +{
[ ... ]
> + /* Trigger inode_init_security once with all programs attached. */
> + fd = open(testfile_slot, O_CREAT | O_RDWR, 0644);
[Severity: Medium]
Does this face the same issue where a pre-existing file from a previous
aborted run could cause the test to silently skip?
Adding O_EXCL would guarantee the inode is created and the hook is
triggered.
> + if (!ASSERT_GE(fd, 0, "create_file"))
> + goto out;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260730234533.1912709-1-dwindsor@gmail.com?part=4
prev parent reply other threads:[~2026-07-30 23:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 23:45 [PATCH v6 bpf-next 0/4] bpf: add bpf_init_inode_xattr kfunc for atomic inode labeling David Windsor
2026-07-30 23:45 ` [PATCH v6 bpf-next 1/4] security: introduce struct lsm_xattrs David Windsor
2026-07-30 23:53 ` sashiko-bot
2026-07-30 23:45 ` [PATCH v6 bpf-next 2/4] security: add security_lsmxattr_add() David Windsor
2026-07-31 0:00 ` sashiko-bot
2026-07-31 0:30 ` David Windsor
2026-07-30 23:45 ` [PATCH v6 bpf-next 3/4] bpf: add bpf_init_inode_xattr kfunc for atomic inode labeling David Windsor
2026-07-30 23:53 ` Paul Moore
2026-07-31 0:01 ` David Windsor
2026-07-31 0:04 ` sashiko-bot
2026-07-30 23:45 ` [PATCH v6 bpf-next 4/4] selftests/bpf: add tests for bpf_init_inode_xattr kfunc David Windsor
2026-07-30 23:55 ` sashiko-bot [this message]
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=20260730235532.B02691F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dwindsor@gmail.com \
--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