BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Puranjay Mohan" <puranjay@kernel.org>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 2/4] selftests/bpf: Add tests for bpf_call_rcu()
Date: Mon, 07 Sep 2026 13:58:05 +0000	[thread overview]
Message-ID: <20260907135806.02FE41F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907134552.1772405-3-puranjay@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incomplete test validation in `test_call_rcu_teardown`.
--

commit 7d7060669166bdbb9948b95d35813ccc322df204
Author: Puranjay Mohan <puranjay@kernel.org>

selftests/bpf: Add tests for bpf_call_rcu()

This commit adds tests for bpf_call_rcu() to cover the callback running
after a grace period, checking -EBUSY on second arm, head reuse, and
teardown. It also includes negative tests for invalid map types and
verifier rejections.

> diff --git a/tools/testing/selftests/bpf/prog_tests/call_rcu.c b/tools/testing/selftests/bpf/prog_tests/call_rcu.c
> new file mode 100644
> index 0000000000000..ccbfa9965d511
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/call_rcu.c

[ ... ]

> +/* Tear down the map and the program while a callback is still queued. */
> +static void test_call_rcu_teardown(void)
> +{
> +	LIBBPF_OPTS(bpf_test_run_opts, opts);
> +	struct call_rcu *skel;
> +
> +	skel = call_rcu__open_and_load();
> +	if (!ASSERT_OK_PTR(skel, "skel_open_and_load"))
> +		return;
> +
> +	/* The callback re-arms after the last user reference is gone; that must be refused. */
> +	skel->bss->chain = 1;
> +	ASSERT_OK(bpf_prog_test_run_opts(bpf_program__fd(skel->progs.arm), &opts), "test_run");
> +	call_rcu__destroy(skel);
> +}

[Severity: Medium]
Does this test actually verify that the re-arming was refused?

It looks like we set chain to 1, run the program, and then immediately
destroy the skeleton without waiting for the callback to run or asserting
the value of chain_err.

If a kernel regression allowed the re-arm to succeed, would this test just
silently pass without catching the failure?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260907134552.1772405-1-puranjay@kernel.org?part=2

  reply	other threads:[~2026-09-07 13:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 13:45 [PATCH bpf-next 0/4] bpf: Add bpf_call_rcu() and bpf_call_rcu_tasks_trace() Puranjay Mohan
2026-09-07 13:45 ` [PATCH bpf-next 1/4] bpf: Add bpf_call_rcu() kfunc Puranjay Mohan
2026-09-07 14:06   ` sashiko-bot
2026-09-07 14:29     ` Puranjay Mohan
2026-09-08  0:19       ` Alexei Starovoitov
2026-09-08 12:22         ` Puranjay Mohan
2026-09-07 13:45 ` [PATCH bpf-next 2/4] selftests/bpf: Add tests for bpf_call_rcu() Puranjay Mohan
2026-09-07 13:58   ` sashiko-bot [this message]
2026-09-07 13:45 ` [PATCH bpf-next 3/4] bpf: Add bpf_call_rcu_tasks_trace() kfunc Puranjay Mohan
2026-09-07 13:45 ` [PATCH bpf-next 4/4] selftests/bpf: Add a test for bpf_call_rcu_tasks_trace() Puranjay Mohan

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=20260907135806.02FE41F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=puranjay@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