summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorYuan Chen <chenyuan@kylinos.cn>2026-10-09 10:24:27 +0800
committerAlexei Starovoitov <ast@kernel.org>2026-10-16 18:41:07 +0000
commit2d1f101ee619435873ed8a23fcb3bd09204a5024 (patch)
tree329b092c173242ffbadcc1687d2f997010c1e8d8 /tools/perf/scripts/python
parentd2141481a764efdfaac70965ea28e8925f6a6b80 (diff)
bpf: Claim the per-CPU send_signal irq_work before filling it
irq_work_is_busy() cannot see the per-CPU send_signal_work while it is being filled: the check only matches after irq_work_queue() has claimed the work. A concurrent caller therefore passes it, both callers race for the same irq_work, and the loser's signal is silently lost along with its task reference while the queued work runs with a mix of both callers' fields. kprobe, tracepoint and perf_event programs exclude each other on the same CPU through bpf_prog_active, so for two callers to meet, one of the programs has to be a raw tracepoint or an fentry one. And since commit 87c544108b61 ("bpf: Send signals asynchronously if !preemptible") this path runs with IRQs enabled too, so a hard IRQ can interrupt the fill as well, not only an NMI. Found by code inspection and reproduced with a perf_event NMI program racing an fentry one. Claim the work through work->task itself: cmpxchg() it from NULL to the target task before touching the other fields, and set it back to NULL once the callback has consumed them. A context finding the work claimed returns the documented -EBUSY. Fixes: 1bc7896e9ef4 ("bpf: Fix deadlock with rq_lock in bpf_send_signal()") Signed-off-by: Yuan Chen <chenyuan@kylinos.cn> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261009022427.968304-1-chenyuan@kylinos.cn
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions