]> git.ipfire.org Git - thirdparty/linux.git/commit
bpf: Tighten conditions when timer/wq can be called synchronously
authorAlexei Starovoitov <ast@kernel.org>
Wed, 4 Feb 2026 05:51:44 +0000 (21:51 -0800)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 4 Feb 2026 21:12:50 +0000 (13:12 -0800)
commit7d49635e3775da946e536bc81ab55b2bca6b791d
tree3d3794ca8fe252e16906b231e9994ec8b37b41f8
parent5e6e1dc43a217624087ce45bafd20ac2cfb3c190
bpf: Tighten conditions when timer/wq can be called synchronously

Though hrtimer_start/cancel() inlines all of the smaller helpers in
hrtimer.c and only call timerqueue_add/del() from lib/timerqueue.c where
everything is not traceable and not kprobe-able (because all files in
lib/ are not traceable), there are tracepoints within hrtimer that are
called with locks held. Therefore prevent the deadlock by tightening
conditions when timer/wq can be called synchronously.
hrtimer/wq are using raw_spin_lock_irqsave(), so irqs_disabled() is enough.

Fixes: 1bfbc267ec91 ("bpf: Enable bpf_timer and bpf_wq in any context")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260204055147.54960-2-alexei.starovoitov@gmail.com
kernel/bpf/helpers.c