All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Qiliang Yuan" <odys.yuan@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 2/2] selftests/bpf: Unmount the bpffs that cgroup_hierarchical_stats mounted
Date: Fri, 09 Oct 2026 02:14:16 +0000	[thread overview]
Message-ID: <sashiko-outbox-164722@kernel.org> (raw)
In-Reply-To: <20261009-selftests-bpf-cgroup-stats-bpffs-v2-2-f93a111da992@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] bpf: unconditional rmdir in cleanup_bpffs triggers spurious assertion failures
--

commit 34f23b53e236bfae8b2ad74d5d89f8806c601dbb
Author: Qiliang Yuan <odys.yuan@gmail.com>

selftests/bpf: Unmount the bpffs that cgroup_hierarchical_stats mounted

This commit fixes a logic error in cleanup_bpffs() where a locally mounted
bpffs was not correctly unmounted. By inverting the check on mounted_bpffs,
the test ensures it cleans up its own mounts rather than leaking them.

> diff --git a/tools/testing/selftests/bpf/prog_tests/cgroup_hierarchical_stats.c b/tools/testing/selftests/bpf/prog_tests/cgroup_hierarchical_stats.c
> index ad19d6d41918a..cc6ab2c263da1 100644
> --- a/tools/testing/selftests/bpf/prog_tests/cgroup_hierarchical_stats.c
> +++ b/tools/testing/selftests/bpf/prog_tests/cgroup_hierarchical_stats.c
> @@ -110,7 +110,7 @@ static void cleanup_bpffs(void)
>  	ASSERT_OK(rmdir(BPFFS_ATTACH_COUNTERS), "rmdir "BPFFS_ATTACH_COUNTERS);

[Severity: Low]
In cleanup_bpffs() within
tools/testing/selftests/bpf/prog_tests/cgroup_hierarchical_stats.c, does this
unconditional rmdir() trigger spurious assertion failures during early setup
error paths?

When setup fails (e.g., in setup_cgroups() or the initial mount() call), the
BPFFS_ATTACH_COUNTERS directory is never created. During the teardown path
(hierarchy_cleanup() -> destroy_hierarchy() -> cleanup_bpffs()), rmdir() is
unconditionally called and wrapped in ASSERT_OK().

If the directory does not exist, rmdir() returns -ENOENT, triggering a
secondary assertion failure. This clutters the test output and masks the
original setup failure.

>  
>  	/* Unmount bpffs, if it wasn't already mounted when we started */
> -	if (mounted_bpffs)
> +	if (!mounted_bpffs)
>  		return;
>  
>  	ASSERT_OK(umount(BPFFS_ROOT), "unmount bpffs");

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-selftests-bpf-cgroup-stats-bpffs-v2-0-f93a111da992@gmail.com?part=2

      reply	other threads:[~2026-10-09  2:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09  2:04 [PATCH bpf-next v2 0/2] selftests/bpf: Fix the bpffs handling of cgroup_hierarchical_stats Qiliang Yuan
2026-10-09  2:04 ` [PATCH bpf-next v2 1/2] selftests/bpf: Keep the bpffs of cgroup_hierarchical_stats private Qiliang Yuan
2026-10-09  2:12   ` sashiko-bot
2026-10-09  2:04 ` [PATCH bpf-next v2 2/2] selftests/bpf: Unmount the bpffs that cgroup_hierarchical_stats mounted Qiliang Yuan
2026-10-09  2:14   ` 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=sashiko-outbox-164722@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=odys.yuan@gmail.com \
    --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.