BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anton Protopopov" <a.s.protopopov@gmail.com>, bpf@vger.kernel.org
Subject: Re: [PATCH v2 bpf-next 6/6] selftests/bpf: Test xattr kfuncs on the new sleepable inode hooks
Date: Fri, 04 Dec 2026 16:09:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-250161@kernel.org> (raw)
In-Reply-To: <20261204155438.1413411-7-a.s.protopopov@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] selftests/bpf: test_inode_xattr() lacks ACL and fileattr skip
  handling
--

commit ce364c49218b9ec40886dd37424d160ba972d101
Author: Anton Protopopov <a.s.protopopov@gmail.com>

selftests/bpf: Test xattr kfuncs on the new sleepable inode hooks

This commit adds the inode_xattr subtest to fs_kfuncs to test reading,
setting, and removing xattrs on the new sleepable inode LSM hooks, and
adds positive and negative verifier tests for inode_copy_up.

> diff --git a/tools/testing/selftests/bpf/prog_tests/fs_kfuncs.c b/tools/testing/selftests/bpf/prog_tests/fs_kfuncs.c
> index 43a26ec69a8e3..ad467c7663808 100644
> --- a/tools/testing/selftests/bpf/prog_tests/fs_kfuncs.c
> +++ b/tools/testing/selftests/bpf/prog_tests/fs_kfuncs.c

[ ... ]

> @@ -194,6 +202,102 @@ static void test_set_remove_xattr(void)

[ ... ]

> +static void test_inode_xattr(void)
> +{

[ ... ]

> +	/* inode_set_acl, inode_remove_acl and inode_file_setattr change xattrs */
> +	err = setxattr(file, "system.posix_acl_access", &acl, sizeof(acl), 0);
> +	if (ASSERT_OK(err, "set acl")) {
> +		ASSERT_EQ(skel->data->set_acl_ret, 0, "set_acl_ret");
> +		ASSERT_TRUE(has_bar(skel, file), "bar after set acl");
> +
> +		ASSERT_OK(removexattr(file, "system.posix_acl_access"), "remove acl");
> +		ASSERT_EQ(skel->data->remove_acl_ret, 0, "remove_acl_ret");
> +		err = getxattr(file, skel->rodata->xattr_bar, NULL, 0);
> +		ASSERT_TRUE(err == -1 && errno == ENODATA, "bar after remove acl");
> +	}
> +
> +	if (ASSERT_OK(ioctl(fd, FS_IOC_GETFLAGS, &flags), "FS_IOC_GETFLAGS") &&
> +	    ASSERT_OK(ioctl(fd, FS_IOC_SETFLAGS, &flags), "FS_IOC_SETFLAGS")) {
> +		ASSERT_EQ(skel->data->file_setattr_ret, 0, "file_setattr_ret");
> +		ASSERT_TRUE(has_bar(skel, file), "bar after file setattr");
> +	}

[Severity: Medium]
Should test_inode_xattr() skip on EOPNOTSUPP for system.posix_acl_access
and on ENOTTY/EOPNOTSUPP for FS_IOC_GETFLAGS and FS_IOC_SETFLAGS?

The base tools/testing/selftests/bpf/config enables CONFIG_TMPFS_XATTR
without CONFIG_TMPFS_POSIX_ACL, so a tmpfs /tmp passes the initial
security.bpf.foo probe and then fails setxattr() on
system.posix_acl_access with EOPNOTSUPP instead of skipping.

Under CONFIG_FS_POSIX_ACL=y without SB_POSIXACL, vfs_set_acl() calls
security_inode_set_acl() before set_posix_acl() returns -EOPNOTSUPP.
Skipping the removexattr() block then leaves security.bpf.bar on file
for the subsequent FS_IOC_SETFLAGS has_bar() check.

Similarly, filesystems that support xattrs without fileattr_get or
fileattr_set (such as 9p or NFS) return ENOTTY from FS_IOC_GETFLAGS or
FS_IOC_SETFLAGS, causing the subtest to fail instead of skipping.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204155438.1413411-1-a.s.protopopov@gmail.com?part=6

  reply	other threads:[~2026-12-04 16:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 15:54 [PATCH v2 bpf-next 0/6] bpf: Use the xattr kfuncs on six more inode hooks Anton Protopopov
2026-12-04 15:54 ` [PATCH v2 bpf-next 1/6] bpf: Add path_chmod and path_chown to d_inode_locked_hooks Anton Protopopov
2026-12-04 15:54 ` [PATCH v2 bpf-next 2/6] bpf: Don't allow the IMA helpers on inode_getxattr and inode_getattr Anton Protopopov
2026-12-04 16:07   ` sashiko-bot
2026-12-04 16:15   ` bot+bpf-ci
2026-12-04 15:54 ` [PATCH v2 bpf-next 3/6] bpf: Don't allow the IMA hash helpers on hooks with the inode locked Anton Protopopov
2026-12-04 16:15   ` bot+bpf-ci
2026-12-04 15:54 ` [PATCH v2 bpf-next 4/6] bpf: Let sleepable LSM programs attach to six more inode hooks Anton Protopopov
2026-12-04 16:13   ` sashiko-bot
2026-12-04 15:54 ` [PATCH v2 bpf-next 5/6] bpf: Add a bpf_get_inode_xattr kfunc Anton Protopopov
2026-12-04 15:54 ` [PATCH v2 bpf-next 6/6] selftests/bpf: Test xattr kfuncs on the new sleepable inode hooks Anton Protopopov
2026-12-04 16:09   ` sashiko-bot [this message]
2026-12-04 19:48 ` [PATCH v2 bpf-next 0/6] bpf: Use the xattr kfuncs on six more " Alexei Starovoitov
2026-12-04 19:59   ` Anton Protopopov

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-250161@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=a.s.protopopov@gmail.com \
    --cc=bpf@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