syzbot


possible deadlock in htab_lock_bucket

Status: upstream: reported C repro on 2024/04/17 13:40
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+44ec6afbbc9b9c66b458@syzkaller.appspotmail.com
First crash: 498d, last: 34d
Fix bisection: failed (error log, bisect log)
  
Bug presence (3)
Date Name Commit Repro Result
2025/05/15 linux-6.1.y (ToT) 02b72ccb5f9d C [report] possible deadlock in htab_lock_bucket
2024/05/04 upstream (ToT) 7367539ad4b0 C [report] possible deadlock in htab_lock_bucket
2025/05/15 upstream (ToT) fee3e843b309 C Didn't crash
Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in htab_lock_bucket (2) bpf 4 C error error 6 156d 388d 0/29 auto-obsoleted due to no activity on 2025/08/26 22:14
Fix bisection attempts (6)
Created Duration User Patch Repo Result
2025/07/10 23:32 2h12m fix candidate upstream OK (0) job log
2024/10/15 01:01 0m bisect fix linux-6.1.y error job log
2024/09/10 12:51 1h29m bisect fix linux-6.1.y OK (0) job log log
2024/08/06 03:15 1h35m bisect fix linux-6.1.y OK (0) job log log
2024/06/27 02:23 1h52m bisect fix linux-6.1.y OK (0) job log log
2024/05/22 21:38 2h48m bisect fix linux-6.1.y OK (0) job log log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.147-syzkaller #0 Not tainted
------------------------------------------------------
syz.4.279/4774 is trying to acquire lock:
ffff88805b0788d8 (&htab->lockdep_key#4){....}-{2:2}, at: htab_lock_bucket+0x17d/0x300 kernel/bpf/hashtab.c:166

but task is already holding lock:
ffff88805b8f0da0 (&htab->lockdep_key#5){....}-{2:2}, at: htab_lock_bucket+0x17d/0x300 kernel/bpf/hashtab.c:166

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&htab->lockdep_key#5){....}-{2:2}:
       __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
       _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154
       htab_lock_bucket+0x17d/0x300 kernel/bpf/hashtab.c:166
       htab_lru_map_delete_elem+0x1ad/0x760 kernel/bpf/hashtab.c:1438
       bpf_prog_5966e622e8031da9+0x42/0x4b
       bpf_dispatcher_nop_func include/linux/bpf.h:1001 [inline]
       __bpf_prog_run include/linux/filter.h:603 [inline]
       bpf_prog_run include/linux/filter.h:610 [inline]
       __bpf_trace_run kernel/trace/bpf_trace.c:2285 [inline]
       bpf_trace_run2+0x1cd/0x3b0 kernel/trace/bpf_trace.c:2324
       __traceiter_contention_begin+0x74/0xa0 include/trace/events/lock.h:95
       trace_contention_begin+0x142/0x190 include/trace/events/lock.h:95
       __pv_queued_spin_lock_slowpath+0xdc/0x9c0 kernel/locking/qspinlock.c:405
       pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:591 [inline]
       queued_spin_lock_slowpath+0x43/0x50 arch/x86/include/asm/qspinlock.h:51
       queued_spin_lock include/asm-generic/qspinlock.h:114 [inline]
       do_raw_spin_lock+0x217/0x280 kernel/locking/spinlock_debug.c:115
       htab_lock_bucket+0x17d/0x300 kernel/bpf/hashtab.c:166
       htab_lru_map_delete_elem+0x1ad/0x760 kernel/bpf/hashtab.c:1438
       0xffffffffa0000996
       bpf_dispatcher_nop_func include/linux/bpf.h:1001 [inline]
       __bpf_prog_run include/linux/filter.h:603 [inline]
       bpf_prog_run include/linux/filter.h:610 [inline]
       __bpf_trace_run kernel/trace/bpf_trace.c:2285 [inline]
       bpf_trace_run2+0x1cd/0x3b0 kernel/trace/bpf_trace.c:2324
       __traceiter_contention_begin+0x74/0xa0 include/trace/events/lock.h:95
       trace_contention_begin+0x123/0x170 include/trace/events/lock.h:95
       __mutex_lock_common kernel/locking/mutex.c:605 [inline]
       __mutex_lock+0x131/0xaf0 kernel/locking/mutex.c:747
       tracepoint_probe_unregister+0x2c/0x930 kernel/tracepoint.c:548
       bpf_raw_tp_link_release+0x5f/0x80 kernel/bpf/syscall.c:3190
       bpf_link_free kernel/bpf/syscall.c:2759 [inline]
       bpf_link_put+0x22a/0x2c0 kernel/bpf/syscall.c:2785
       bpf_link_release+0x37/0x40 kernel/bpf/syscall.c:2794
       __fput+0x22c/0x920 fs/file_table.c:320
       task_work_run+0x1ca/0x250 kernel/task_work.c:203
       resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
       exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:177
       exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
       __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
       syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:303
       do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:87
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&htab->lockdep_key#4){....}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain kernel/locking/lockdep.c:3825 [inline]
       __lock_acquire+0x2cf8/0x7c50 kernel/locking/lockdep.c:5049
       lock_acquire+0x1b4/0x490 kernel/locking/lockdep.c:5662
       __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
       _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154
       htab_lock_bucket+0x17d/0x300 kernel/bpf/hashtab.c:166
       htab_lru_map_delete_elem+0x1ad/0x760 kernel/bpf/hashtab.c:1438
       0xffffffffa0000996
       bpf_dispatcher_nop_func include/linux/bpf.h:1001 [inline]
       __bpf_prog_run include/linux/filter.h:603 [inline]
       bpf_prog_run include/linux/filter.h:610 [inline]
       __bpf_trace_run kernel/trace/bpf_trace.c:2285 [inline]
       bpf_trace_run2+0x1cd/0x3b0 kernel/trace/bpf_trace.c:2324
       __traceiter_contention_begin+0x74/0xa0 include/trace/events/lock.h:95
       trace_contention_begin+0x142/0x190 include/trace/events/lock.h:95
       __pv_queued_spin_lock_slowpath+0xdc/0x9c0 kernel/locking/qspinlock.c:405
       pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:591 [inline]
       queued_spin_lock_slowpath+0x43/0x50 arch/x86/include/asm/qspinlock.h:51
       queued_spin_lock include/asm-generic/qspinlock.h:114 [inline]
       do_raw_spin_lock+0x217/0x280 kernel/locking/spinlock_debug.c:115
       htab_lock_bucket+0x17d/0x300 kernel/bpf/hashtab.c:166
       htab_lru_map_delete_elem+0x1ad/0x760 kernel/bpf/hashtab.c:1438
       bpf_prog_5966e622e8031da9+0x42/0x4b
       bpf_dispatcher_nop_func include/linux/bpf.h:1001 [inline]
       __bpf_prog_run include/linux/filter.h:603 [inline]
       bpf_prog_run include/linux/filter.h:610 [inline]
       __bpf_trace_run kernel/trace/bpf_trace.c:2285 [inline]
       bpf_trace_run2+0x1cd/0x3b0 kernel/trace/bpf_trace.c:2324
       __traceiter_contention_begin+0x74/0xa0 include/trace/events/lock.h:95
       trace_contention_begin+0x123/0x170 include/trace/events/lock.h:95
       __mutex_lock_common kernel/locking/mutex.c:605 [inline]
       __mutex_lock+0x131/0xaf0 kernel/locking/mutex.c:747
       tracepoint_probe_unregister+0x2c/0x930 kernel/tracepoint.c:548
       bpf_raw_tp_link_release+0x5f/0x80 kernel/bpf/syscall.c:3190
       bpf_link_free kernel/bpf/syscall.c:2759 [inline]
       bpf_link_put+0x22a/0x2c0 kernel/bpf/syscall.c:2785
       bpf_link_release+0x37/0x40 kernel/bpf/syscall.c:2794
       __fput+0x22c/0x920 fs/file_table.c:320
       task_work_run+0x1ca/0x250 kernel/task_work.c:203
       resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
       exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:177
       exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
       __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
       syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:303
       do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:87
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&htab->lockdep_key#5);
                               lock(&htab->lockdep_key#4);
                               lock(&htab->lockdep_key#5);
  lock(&htab->lockdep_key#4);

 *** DEADLOCK ***

4 locks held by syz.4.279/4774:
 #0: ffffffff8cb71f48 (tracepoints_mutex){+.+.}-{3:3}, at: tracepoint_probe_unregister+0x2c/0x930 kernel/tracepoint.c:548
 #1: ffffffff8cb2ae20 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
 #1: ffffffff8cb2ae20 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
 #1: ffffffff8cb2ae20 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2284 [inline]
 #1: ffffffff8cb2ae20 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run2+0xda/0x3b0 kernel/trace/bpf_trace.c:2324
 #2: ffff88805b8f0da0 (&htab->lockdep_key#5){....}-{2:2}, at: htab_lock_bucket+0x17d/0x300 kernel/bpf/hashtab.c:166
 #3: ffffffff8cb2ae20 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
 #3: ffffffff8cb2ae20 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
 #3: ffffffff8cb2ae20 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2284 [inline]
 #3: ffffffff8cb2ae20 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run2+0xda/0x3b0 kernel/trace/bpf_trace.c:2324

stack backtrace:
CPU: 1 PID: 4774 Comm: syz.4.279 Not tainted 6.1.147-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x168/0x22e lib/dump_stack.c:106
 check_noncircular+0x274/0x310 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain kernel/locking/lockdep.c:3825 [inline]
 __lock_acquire+0x2cf8/0x7c50 kernel/locking/lockdep.c:5049
 lock_acquire+0x1b4/0x490 kernel/locking/lockdep.c:5662
 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
 _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154
 htab_lock_bucket+0x17d/0x300 kernel/bpf/hashtab.c:166
 htab_lru_map_delete_elem+0x1ad/0x760 kernel/bpf/hashtab.c:1438
 </TASK>

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/07/25 09:12 linux-6.1.y 3594f306da12 fb8f743d .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in htab_lock_bucket
2024/04/17 13:39 linux-6.1.y 6741e066ec76 18f6e127 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in htab_lock_bucket
2025/06/28 03:09 linux-6.1.y 7e69c33e4858 fc9d8ee5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in htab_lock_bucket
2025/04/25 08:31 linux-6.1.y 420102835862 e3715315 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in htab_lock_bucket
2024/08/08 05:26 linux-6.1.y 48d525b0e463 de12cf65 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in htab_lock_bucket
* Struck through repros no longer work on HEAD.