From: Mike Bazov bpf_perf_event_output() takes one of three per-CPU perf_sample_data slots per nesting level, and fails with -EBUSY and a WARN_ON_ONCE() when it is entered a fourth time on a CPU. Programs get there without any bug: a kprobe program calls it, and fentry programs on perf_event_output() call it again from inside. Each program's own recursion check lets it in once, so three of them reach the fourth level. With panic_on_warn, that takes the machine down. Keep the -EBUSY and drop the warning, as commit 3880cdbed1c4 ("bpf: Fix WARN() in get_bpf_raw_tp_regs") did for the raw tracepoint regs slots. Signed-off-by: Mike Bazov --- kernel/trace/bpf_trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index b4ff9d4e8..8910d5d05 100644 --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -702,7 +702,7 @@ BPF_CALL_5(bpf_perf_event_output, struct pt_regs *, regs, struct bpf_map *, map, sds = this_cpu_ptr(&bpf_trace_sds); nest_level = this_cpu_inc_return(bpf_trace_nest_level); - if (WARN_ON_ONCE(nest_level > ARRAY_SIZE(sds->sds))) { + if (nest_level > ARRAY_SIZE(sds->sds)) { err = -EBUSY; goto out; } -- 2.43.0