Hi, this is a fix for a deadlock condition I noticed (and verified by constructing a test case, see patch #2) while looking at the code. There might be alternative ways to solve this, like having percpu map ops recursion counter, and detecting reentrancy based on that. I went for the simpler option for now. Previous discussions on a patch doing something similar for a different issue here, but never added BPF_PROG_TYPE_TRACING to this list: https://lore.kernel.org/bpf/CALOAHbBK1=ujbZp5n4t9zQf+DPZ3-a2ZDL0a3sfhVU6meJGqYw@xxxxxxxxxxxxxx https://lore.kernel.org/bpf/CALOAHbAQ7AKNPrkawGKHarkB5CGkWXTC8P=+EJP3DAPNEf=Ayw@xxxxxxxxxxxxxx Note that timer and timer_crash selftests are broken by this change, so it has potential for wider breakage. Kumar Kartikeya Dwivedi (2): bpf: Fix deadlock for bpf_timer's spinlock [EXAMPLE] selftests/bpf: Add timer deadlock example kernel/bpf/verifier.c | 10 ++-- .../testing/selftests/bpf/prog_tests/timer.c | 21 +++++--- .../selftests/bpf/prog_tests/timer_crash.c | 9 +++- .../selftests/bpf/prog_tests/timer_deadlock.c | 29 +++++++++++ tools/testing/selftests/bpf/progs/timer.c | 8 +-- .../testing/selftests/bpf/progs/timer_crash.c | 4 +- .../selftests/bpf/progs/timer_deadlock.c | 50 +++++++++++++++++++ 7 files changed, 113 insertions(+), 18 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/timer_deadlock.c create mode 100644 tools/testing/selftests/bpf/progs/timer_deadlock.c base-commit: 25906092edb4bcf94cb669bd1ed03a0ef2f4120c -- 2.38.1