All of lore.kernel.org
 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 v1 bpf-next 3/3] selftests/bpf: Test xattr kfuncs on the new sleepable inode hooks
Date: Thu, 03 Dec 2026 13:45:00 +0000	[thread overview]
Message-ID: <sashiko-outbox-247879@kernel.org> (raw)
In-Reply-To: <20261203134411.1092433-4-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() fails on missing ACL or
  fileattr support
--

commit 4210eebb6e4c6f13c9f673ce6c5fcebebb0b66cb
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 exercise
bpf_get_inode_xattr(), bpf_set_dentry_xattr(), and
bpf_remove_dentry_xattr() on the new sleepable inode LSM hooks, along
with verifier accept and reject 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)
>  	remove(testfile);
>  }

[ ... ]

> +	/* 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 when POSIX ACLs or
FS_IOC_GETFLAGS/FS_IOC_SETFLAGS are not supported on /tmp, instead of
failing?

tools/testing/selftests/bpf/config enables CONFIG_TMPFS and
CONFIG_TMPFS_XATTR without CONFIG_TMPFS_POSIX_ACL, so on a tmpfs /tmp
the initial xattr probe passes and setting system.posix_acl_access
fails with EOPNOTSUPP.

With CONFIG_FS_POSIX_ACL=y on a filesystem without POSIX ACL support,
vfs_set_acl() calls security_inode_set_acl() before set_posix_acl()
returns -EOPNOTSUPP. That leaves security.bpf.bar set on file when the
if block is skipped, leaking into the FS_IOC_SETFLAGS has_bar() check.

Similarly, xattr-capable filesystems without fileattr_get/fileattr_set
(such as 9p) return ENOTTY or EOPNOTSUPP from FS_IOC_GETFLAGS, failing
ASSERT_OK() instead of calling test__skip().

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

  reply	other threads:[~2026-12-03 13:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 13:44 [PATCH v1 bpf-next 0/3] bpf: Use the xattr kfuncs on six more inode hooks Anton Protopopov
2026-12-03 13:44 ` [PATCH v1 bpf-next 1/3] bpf: Let sleepable LSM programs attach to " Anton Protopopov
2026-12-03 13:54   ` sashiko-bot
2026-12-03 15:34     ` Anton Protopopov
2026-12-03 18:46       ` Anton Protopopov
2026-12-03 13:44 ` [PATCH v1 bpf-next 2/3] bpf: Add a bpf_get_inode_xattr kfunc Anton Protopopov
2026-12-03 14:01   ` sashiko-bot
2026-12-03 14:42     ` Anton Protopopov
2026-12-03 13:44 ` [PATCH v1 bpf-next 3/3] selftests/bpf: Test xattr kfuncs on the new sleepable inode hooks Anton Protopopov
2026-12-03 13:45   ` sashiko-bot [this message]
2026-12-03 14:25     ` 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-247879@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.