From: sashiko-bot@kernel.org
To: "Daniel Borkmann" <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 2/3] selftests/bpf: Add bpffs xattr API coverage test
Date: Fri, 22 May 2026 14:59:53 +0000 [thread overview]
Message-ID: <20260522145953.863311F00ADE@smtp.kernel.org> (raw)
In-Reply-To: <20260522135626.120732-2-daniel@iogearbox.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The test `test_umount_lifetime` attempts to verify that root directory xattrs are cleared upon umount, but trivially succeeds because the xattr was never actually set on the root directory.
--
commit eee62f5b4a9e13a37724984ba00f475e46c7075f
Author: Daniel Borkmann <daniel@iogearbox.net>
selftests/bpf: Add bpffs xattr API coverage test
This commit adds basic bpffs xattr API coverage tests, including validation
of supported namespaces, flag semantics, inode types, and mount-scoped
lifetimes.
> diff --git a/tools/testing/selftests/bpf/prog_tests/bpffs_xattr.c b/tools/testing/selftests/bpf/prog_tests/bpffs_xattr.c
> new file mode 100644
> index 0000000000000..3d02e30da338e
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/bpffs_xattr.c
[ ... ]
> +static void test_umount_lifetime(void)
> +{
> + char dir[64], path[128], buf[16];
> + int map_fd = -1, err;
> +
> + if (!ASSERT_OK(mount_bpffs(dir), "mount"))
> + return;
> + snprintf(path, sizeof(path), "%s/m", dir);
> +
> + map_fd = bpf_map_create(BPF_MAP_TYPE_ARRAY, "x", 4, 4, 1, NULL);
> + if (!ASSERT_GE(map_fd, 0, "map_create"))
> + goto out;
> + if (!ASSERT_OK(bpf_obj_pin(map_fd, path), "pin"))
> + goto out;
> + ASSERT_OK(setxattr(path, "user.k", val_a, sizeof(val_a), XATTR_CREATE),
> + "set");
> +
> + close(map_fd);
> + map_fd = -1;
> +
> + if (!ASSERT_OK(umount(dir), "umount"))
> + goto out;
> + if (!ASSERT_OK(mount("bpf", dir, "bpf", 0, NULL), "mount_fresh"))
> + goto out;
> +
> + err = access(path, F_OK);
> + ASSERT_EQ(err, -1, "path_gone_ret");
> + ASSERT_EQ(errno, ENOENT, "path_gone_errno");
> +
> + err = getxattr(dir, "user.k", buf, sizeof(buf));
[Severity: Medium]
Does this test actually verify the root directory's xattr lifetime?
It looks like the user.k xattr is set on the pinned map file (path) earlier
in the function, but after remounting, this check looks for the xattr on the
mount root (dir).
Because user.k was never set on dir initially, won't this check trivially
succeed with ENODATA?
> + ASSERT_EQ(err, -1, "root_xattr_gone_ret");
> + ASSERT_EQ(errno, ENODATA, "root_xattr_gone_errno");
> +out:
> + if (map_fd >= 0)
> + close(map_fd);
> + umount(dir);
> + rmdir(dir);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260522135626.120732-1-daniel@iogearbox.net?part=2
next prev parent reply other threads:[~2026-05-22 15:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 13:56 [PATCH bpf-next 1/3] bpf: Add simple xattr support to bpffs Daniel Borkmann
2026-05-22 13:56 ` [PATCH bpf-next 2/3] selftests/bpf: Add bpffs xattr API coverage test Daniel Borkmann
2026-05-22 14:59 ` sashiko-bot [this message]
2026-05-22 13:56 ` [PATCH bpf-next 3/3] selftests/bpf: Add xattr label test with BPF LSM Daniel Borkmann
2026-05-22 15:19 ` sashiko-bot
2026-05-22 14:48 ` [PATCH bpf-next 1/3] bpf: Add simple xattr support to bpffs sashiko-bot
2026-05-22 15:09 ` Daniel Borkmann
2026-05-22 22:21 ` Daniel Borkmann
2026-05-27 12:19 ` Christian Brauner
2026-05-27 12:36 ` Daniel Borkmann
2026-05-28 12:54 ` Christian Brauner
2026-05-29 7:39 ` Daniel Borkmann
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=20260522145953.863311F00ADE@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--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.