From: sashiko-bot@kernel.org
To: "Mykyta Yatsenko" <mykyta.yatsenko5@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v12 1/6] bpf: Add sleepable support for raw tracepoint programs
Date: Wed, 22 Apr 2026 21:43:34 +0000 [thread overview]
Message-ID: <20260422214335.1E4B8C19425@smtp.kernel.org> (raw)
In-Reply-To: <20260422-sleepable_tracepoints-v12-1-744bf0e3b311@meta.com>
Sashiko AI review found 1 potential issue(s):
- [Medium] Adding `bpf_prog_get_recursion_context()` to `__bpf_prog_test_run_raw_tp()` causes concurrent test runs of sleepable programs on the same CPU to silently fail and report success (returning 0) to user-space.
--
commit 222c8798357569a257ba54fe2c8b4e389e16e925
Author: Mykyta Yatsenko <yatsenko@meta.com>
Subject: bpf: Add sleepable support for raw tracepoint programs
This commit reworks __bpf_trace_run() and bpf_prog_test_run_raw_tp() to
support sleepable BPF programs by using explicit RCU flavor selection and
adding per-program recursion context guards.
> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> --- a/net/bpf/test_run.c
> +++ b/net/bpf/test_run.c
[ ... ]
> @@ -748,14 +748,35 @@ static void
> __bpf_prog_test_run_raw_tp(void *data)
> {
> struct bpf_raw_tp_test_run_info *info = data;
[ ... ]
> - rcu_read_lock();
> + if (info->prog->sleepable) {
> + scp = rcu_read_lock_tasks_trace();
> + migrate_disable();
> + } else {
> + rcu_read_lock();
> + }
> +
> + if (unlikely(!bpf_prog_get_recursion_context(info->prog))) {
> + bpf_prog_inc_misses_counter(info->prog);
> + goto out;
> + }
> +
> info->retval = bpf_prog_run(info->prog, info->ctx);
> - rcu_read_unlock();
> +
> +out:
> + bpf_prog_put_recursion_context(info->prog);
Does this introduce a regression where concurrent test runs of sleepable
programs silently skip execution and report success?
For sleepable programs, execution can block. Even with migrate_disable() held,
the task can yield the CPU while the per-CPU counter from
bpf_prog_get_recursion_context() remains incremented.
If another userspace thread executes a test run for the same sleepable
program and is scheduled on the same CPU, it will read the incremented
counter and falsely detect recursion.
This causes the second run to jump out and skip bpf_prog_run(). Because
info->retval is initialized to 0 and no error is returned, the test run will
silently succeed and copy 0 back to userspace.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260422-sleepable_tracepoints-v12-0-744bf0e3b311@meta.com?part=1
next prev parent reply other threads:[~2026-04-22 21:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-22 15:27 [PATCH bpf-next v12 0/6] bpf: Add support for sleepable tracepoint programs Mykyta Yatsenko
2026-04-22 15:27 ` [PATCH bpf-next v12 1/6] bpf: Add sleepable support for raw " Mykyta Yatsenko
2026-04-22 21:43 ` sashiko-bot [this message]
2026-04-22 15:27 ` [PATCH bpf-next v12 2/6] bpf: Add bpf_prog_run_array_sleepable() Mykyta Yatsenko
2026-04-22 16:06 ` bot+bpf-ci
2026-04-22 16:36 ` Mykyta Yatsenko
2026-04-22 17:00 ` Alexei Starovoitov
2026-04-22 17:57 ` Kumar Kartikeya Dwivedi
2026-04-22 18:02 ` Kumar Kartikeya Dwivedi
2026-04-22 18:27 ` Mykyta Yatsenko
2026-04-22 22:02 ` sashiko-bot
2026-04-22 15:27 ` [PATCH bpf-next v12 3/6] bpf: Add sleepable support for classic tracepoint programs Mykyta Yatsenko
2026-04-22 23:06 ` sashiko-bot
2026-04-22 15:27 ` [PATCH bpf-next v12 4/6] bpf: Verifier support for sleepable " Mykyta Yatsenko
2026-04-22 15:27 ` [PATCH bpf-next v12 5/6] libbpf: Add section handlers for sleepable tracepoints Mykyta Yatsenko
2026-04-22 15:27 ` [PATCH bpf-next v12 6/6] selftests/bpf: Add tests for sleepable tracepoint programs Mykyta Yatsenko
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=20260422214335.1E4B8C19425@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=mykyta.yatsenko5@gmail.com \
--cc=sashiko@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