From: sashiko-bot@kernel.org
To: "Mykyta Yatsenko" <mykyta.yatsenko5@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v6 4/6] bpf: Verifier support for sleepable tracepoint programs
Date: Thu, 13 Aug 2026 22:47:24 +0000 [thread overview]
Message-ID: <20260813224725.71C101F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260324-sleepable_tracepoints-v6-4-81bab3a43f25@meta.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Sleepable BPF_PROG_TYPE_RAW_TRACEPOINT programs cause a 'scheduling while atomic' kernel panic when executed via BPF_PROG_TEST_RUN.
--
--- Patch [4]: [PATCH bpf-next v6 4/6] bpf: Verifier support for sleepable tracepoint programs ---
commit 0adc028b1ba3ebb449f79abbe66b1d15d4ba5578
Author: Mykyta Yatsenko <yatsenko@meta.com>
bpf: Verifier support for sleepable tracepoint programs
This commit allows BPF_PROG_TYPE_RAW_TRACEPOINT, BPF_PROG_TYPE_TRACEPOINT, and
BPF_TRACE_RAW_TP programs to be sleepable. It also adds checks to ensure
these sleepable programs are only attached to faultable tracepoints.
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 01c18f4268deb..a4836f564cb12 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
[ ... ]
> @@ -25478,7 +25485,9 @@ static bool can_be_sleepable(struct bpf_prog *prog)
> }
> return prog->type == BPF_PROG_TYPE_LSM ||
> prog->type == BPF_PROG_TYPE_KPROBE /* only for uprobes */ ||
> - prog->type == BPF_PROG_TYPE_STRUCT_OPS;
> + prog->type == BPF_PROG_TYPE_STRUCT_OPS ||
> + prog->type == BPF_PROG_TYPE_RAW_TRACEPOINT ||
> + prog->type == BPF_PROG_TYPE_TRACEPOINT;
> }
[Severity: High]
Can this change introduce a 'scheduling while atomic' kernel panic when a
sleepable BPF_PROG_TYPE_RAW_TRACEPOINT program is executed via
BPF_PROG_TEST_RUN?
Looking at net/bpf/test_run.c, bpf_prog_test_run_raw_tp() disables preemption
via get_cpu() or smp_call_function_single() before running the program:
net/bpf/test_run.c:bpf_prog_test_run_raw_tp() {
current_cpu = get_cpu();
if ((kattr->test.flags & BPF_F_TEST_RUN_ON_CPU) == 0 ||
cpu == current_cpu) {
__bpf_prog_test_run_raw_tp(&info);
} else if (cpu >= nr_cpu_ids || !cpu_online(cpu)) {
err = -ENXIO;
} else {
err = smp_call_function_single(cpu, __bpf_prog_test_run_raw_tp,
&info, 1);
}
put_cpu();
}
And __bpf_prog_test_run_raw_tp() then executes the program under
rcu_read_lock():
net/bpf/test_run.c:__bpf_prog_test_run_raw_tp() {
rcu_read_lock();
info->retval = bpf_prog_run(info->prog, info->ctx);
rcu_read_unlock();
}
If a user with CAP_BPF loads a sleepable raw tracepoint program and executes it
via the BPF_PROG_TEST_RUN syscall, wouldn't invoking sleepable helpers in this
context trigger a 'BUG: scheduling while atomic' panic?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260324-sleepable_tracepoints-v6-0-81bab3a43f25@meta.com?part=4
next prev parent reply other threads:[~2026-08-13 22:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 19:03 [PATCH bpf-next v6 0/6] bpf: Add support for sleepable tracepoint programs Mykyta Yatsenko
2026-03-24 19:03 ` [PATCH bpf-next v6 1/6] bpf: Add sleepable support for raw " Mykyta Yatsenko
2026-03-24 19:46 ` Alexei Starovoitov
2026-03-24 22:25 ` Mykyta Yatsenko
2026-03-24 19:03 ` [PATCH bpf-next v6 2/6] bpf: Rename bpf_prog_run_array_uprobe() to bpf_prog_run_array_sleepable() Mykyta Yatsenko
2026-03-24 19:03 ` [PATCH bpf-next v6 3/6] bpf: Add sleepable support for classic tracepoint programs Mykyta Yatsenko
2026-03-24 19:56 ` Alexei Starovoitov
2026-03-24 19:03 ` [PATCH bpf-next v6 4/6] bpf: Verifier support for sleepable " Mykyta Yatsenko
2026-08-13 22:47 ` sashiko-bot [this message]
2026-03-24 19:03 ` [PATCH bpf-next v6 5/6] libbpf: Add section handlers for sleepable tracepoints Mykyta Yatsenko
2026-03-24 19:03 ` [PATCH bpf-next v6 6/6] selftests/bpf: Add tests for sleepable tracepoint programs Mykyta Yatsenko
2026-03-24 20:05 ` [PATCH bpf-next v6 0/6] bpf: Add support " Kumar Kartikeya Dwivedi
2026-03-24 22:20 ` Mykyta Yatsenko
2026-03-24 23:57 ` Alexei Starovoitov
2026-03-24 23:59 ` Alexei Starovoitov
-- strict thread matches above, loose matches on Subject: below --
2026-03-25 18:55 Mykyta Yatsenko
2026-03-25 18:55 ` [PATCH bpf-next v6 4/6] bpf: Verifier " Mykyta Yatsenko
2026-03-26 16:49 ` Kumar Kartikeya Dwivedi
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=20260813224725.71C101F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=mykyta.yatsenko5@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.