On 1/9/23 7:25 PM, Martin KaFai Lau wrote:
btw, from a quick look at __perf_event_overflow, I suspect doing the
bpf_map_update_elem() here instead of the fentry/perf_event_overflow above
can also reproduce the patch 1 issue?
No
bpf_overflow_handler will check the bpf_prog_active, if syscall increase it,
bpf_overflow_handler will skip the bpf prog.
tbh, I am quite surprised the bpf_prog_active would be noisy enough to avoid
this deadlock being reproduced easily. fwiw, I just tried doing map_update here
and can reproduce it in the very first run.
Correcting my self. I only reproduced the warning splat but not the deadlock.
This test is using map_update from the syscall that bumps the prog_active.
Agree that SEC("perf_event") alone won't work unless the bpf_map_update_elem()
is not done from the syscall in prog_tests/htab_deadlock.c, eg. from another bpf
prog.