====================================================== WARNING: possible circular locking dependency detected 6.13.0-rc3-syzkaller-gc061cf420ded #0 Not tainted ------------------------------------------------------ kworker/0:1/9 is trying to acquire lock: ffff888021041a20 (&htab->lockdep_key#609){..-.}-{2:2}, at: htab_lock_bucket kernel/bpf/hashtab.c:167 [inline] ffff888021041a20 (&htab->lockdep_key#609){..-.}-{2:2}, at: htab_lru_map_delete_elem+0x1c8/0x790 kernel/bpf/hashtab.c:1484 but task is already holding lock: ffff888021041b20 (&htab->lockdep_key#612){..-.}-{2:2}, at: htab_lock_bucket kernel/bpf/hashtab.c:167 [inline] ffff888021041b20 (&htab->lockdep_key#612){..-.}-{2:2}, at: htab_lru_map_delete_elem+0x1c8/0x790 kernel/bpf/hashtab.c:1484 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&htab->lockdep_key#612){..-.}-{2:2}: __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 htab_lock_bucket kernel/bpf/hashtab.c:167 [inline] htab_lru_map_delete_elem+0x1c8/0x790 kernel/bpf/hashtab.c:1484 bpf_prog_2c29ac5cdc6b1842+0x43/0x47 bpf_dispatcher_nop_func include/linux/bpf.h:1290 [inline] __bpf_prog_run include/linux/filter.h:701 [inline] bpf_prog_run include/linux/filter.h:708 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2362 [inline] bpf_trace_run2+0x231/0x590 kernel/trace/bpf_trace.c:2403 __bpf_trace_contention_begin+0xca/0x110 include/trace/events/lock.h:95 __traceiter_contention_begin+0x5a/0xa0 include/trace/events/lock.h:95 __preempt_count_dec_and_test arch/x86/include/asm/preempt.h:94 [inline] class_preempt_notrace_destructor include/linux/preempt.h:481 [inline] trace_contention_begin.constprop.0+0xf3/0x170 include/trace/events/lock.h:95 __pv_queued_spin_lock_slowpath+0x10b/0xc90 kernel/locking/qspinlock.c:402 pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:584 [inline] queued_spin_lock_slowpath arch/x86/include/asm/qspinlock.h:51 [inline] queued_spin_lock include/asm-generic/qspinlock.h:114 [inline] do_raw_spin_lock+0x210/0x2c0 kernel/locking/spinlock_debug.c:116 htab_lock_bucket kernel/bpf/hashtab.c:167 [inline] htab_lru_map_delete_elem+0x1c8/0x790 kernel/bpf/hashtab.c:1484 bpf_prog_2c29ac5cdc6b1842+0x43/0x47 bpf_dispatcher_nop_func include/linux/bpf.h:1290 [inline] __bpf_prog_run include/linux/filter.h:701 [inline] bpf_prog_run include/linux/filter.h:708 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2362 [inline] bpf_trace_run2+0x231/0x590 kernel/trace/bpf_trace.c:2403 __bpf_trace_contention_begin+0xca/0x110 include/trace/events/lock.h:95 __traceiter_contention_begin+0x5a/0xa0 include/trace/events/lock.h:95 trace_contention_begin+0xd2/0x140 include/trace/events/lock.h:95 __mutex_lock_common kernel/locking/mutex.c:587 [inline] __mutex_lock+0x1a8/0xa60 kernel/locking/mutex.c:735 nf_sockopt_find.constprop.0+0x2a/0x290 net/netfilter/nf_sockopt.c:67 nf_getsockopt+0x2d/0xe0 net/netfilter/nf_sockopt.c:113 ipv6_getsockopt+0x1f7/0x280 net/ipv6/ipv6_sockglue.c:1493 tcp_getsockopt+0x9e/0x100 net/ipv4/tcp.c:4671 do_sock_getsockopt+0x3fe/0x800 net/socket.c:2374 __sys_getsockopt+0x12f/0x260 net/socket.c:2403 __do_sys_getsockopt net/socket.c:2410 [inline] __se_sys_getsockopt net/socket.c:2407 [inline] __x64_sys_getsockopt+0xbd/0x160 net/socket.c:2407 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&htab->lockdep_key#609){..-.}-{2:2}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x249e/0x3c40 kernel/locking/lockdep.c:5226 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5849 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 htab_lock_bucket kernel/bpf/hashtab.c:167 [inline] htab_lru_map_delete_elem+0x1c8/0x790 kernel/bpf/hashtab.c:1484 bpf_prog_2c29ac5cdc6b1842+0x43/0x47 bpf_dispatcher_nop_func include/linux/bpf.h:1290 [inline] __bpf_prog_run include/linux/filter.h:701 [inline] bpf_prog_run include/linux/filter.h:708 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2362 [inline] bpf_trace_run2+0x231/0x590 kernel/trace/bpf_trace.c:2403 __bpf_trace_contention_begin+0xca/0x110 include/trace/events/lock.h:95 __traceiter_contention_begin+0x5a/0xa0 include/trace/events/lock.h:95 __preempt_count_dec_and_test arch/x86/include/asm/preempt.h:94 [inline] class_preempt_notrace_destructor include/linux/preempt.h:481 [inline] trace_contention_begin.constprop.0+0xf3/0x170 include/trace/events/lock.h:95 __pv_queued_spin_lock_slowpath+0x10b/0xc90 kernel/locking/qspinlock.c:402 pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:584 [inline] queued_spin_lock_slowpath arch/x86/include/asm/qspinlock.h:51 [inline] queued_spin_lock include/asm-generic/qspinlock.h:114 [inline] do_raw_spin_lock+0x210/0x2c0 kernel/locking/spinlock_debug.c:116 htab_lock_bucket kernel/bpf/hashtab.c:167 [inline] htab_lru_map_delete_elem+0x1c8/0x790 kernel/bpf/hashtab.c:1484 bpf_prog_2c29ac5cdc6b1842+0x43/0x47 bpf_dispatcher_nop_func include/linux/bpf.h:1290 [inline] __bpf_prog_run include/linux/filter.h:701 [inline] bpf_prog_run include/linux/filter.h:708 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2362 [inline] bpf_trace_run2+0x231/0x590 kernel/trace/bpf_trace.c:2403 __bpf_trace_contention_begin+0xca/0x110 include/trace/events/lock.h:95 __traceiter_contention_begin+0x5a/0xa0 include/trace/events/lock.h:95 trace_contention_begin+0xd2/0x140 include/trace/events/lock.h:95 __mutex_lock_common kernel/locking/mutex.c:587 [inline] __mutex_lock+0x1a8/0xa60 kernel/locking/mutex.c:735 srcu_advance_state kernel/rcu/srcutree.c:1691 [inline] process_srcu+0x72/0x1720 kernel/rcu/srcutree.c:1851 process_one_work+0x9c5/0x1ba0 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 kthread+0x2c1/0x3a0 kernel/kthread.c:389 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&htab->lockdep_key#612); lock(&htab->lockdep_key#609); lock(&htab->lockdep_key#612); lock(&htab->lockdep_key#609); *** DEADLOCK *** 6 locks held by kworker/0:1/9: #0: ffff88801b08a948 ((wq_completion)rcu_gp){+.+.}-{0:0}, at: process_one_work+0x1293/0x1ba0 kernel/workqueue.c:3204 #1: ffffc900000c7d80 ((work_completion)(&(&ssp->srcu_sup->work)->work)){+.+.}-{0:0}, at: process_one_work+0x921/0x1ba0 kernel/workqueue.c:3205 #2: ffff88801e6ae158 (&ssp->srcu_sup->srcu_gp_mutex){+.+.}-{4:4}, at: srcu_advance_state kernel/rcu/srcutree.c:1691 [inline] #2: ffff88801e6ae158 (&ssp->srcu_sup->srcu_gp_mutex){+.+.}-{4:4}, at: process_srcu+0x72/0x1720 kernel/rcu/srcutree.c:1851 #3: ffffffff8e1bb900 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:337 [inline] #3: ffffffff8e1bb900 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline] #3: ffffffff8e1bb900 (rcu_read_lock){....}-{1:3}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2361 [inline] #3: ffffffff8e1bb900 (rcu_read_lock){....}-{1:3}, at: bpf_trace_run2+0x1c2/0x590 kernel/trace/bpf_trace.c:2403 #4: ffff888021041b20 (&htab->lockdep_key#612){..-.}-{2:2}, at: htab_lock_bucket kernel/bpf/hashtab.c:167 [inline] #4: ffff888021041b20 (&htab->lockdep_key#612){..-.}-{2:2}, at: htab_lru_map_delete_elem+0x1c8/0x790 kernel/bpf/hashtab.c:1484 #5: ffffffff8e1bb900 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:337 [inline] #5: ffffffff8e1bb900 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline] #5: ffffffff8e1bb900 (rcu_read_lock){....}-{1:3}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2361 [inline] #5: ffffffff8e1bb900 (rcu_read_lock){....}-{1:3}, at: bpf_trace_run2+0x1c2/0x590 kernel/trace/bpf_trace.c:2403 stack backtrace: CPU: 0 UID: 0 PID: 9 Comm: kworker/0:1 Not tainted 6.13.0-rc3-syzkaller-gc061cf420ded #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: rcu_gp process_srcu Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x419/0x5d0 kernel/locking/lockdep.c:2074 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x249e/0x3c40 kernel/locking/lockdep.c:5226 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5849 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 htab_lock_bucket kernel/bpf/hashtab.c:167 [inline] htab_lru_map_delete_elem+0x1c8/0x790 kernel/bpf/hashtab.c:1484 bpf_prog_2c29ac5cdc6b1842+0x43/0x47 bpf_dispatcher_nop_func include/linux/bpf.h:1290 [inline] __bpf_prog_run include/linux/filter.h:701 [inline] bpf_prog_run include/linux/filter.h:708 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2362 [inline] bpf_trace_run2+0x231/0x590 kernel/trace/bpf_trace.c:2403 __bpf_trace_contention_begin+0xca/0x110 include/trace/events/lock.h:95 __traceiter_contention_begin+0x5a/0xa0 include/trace/events/lock.h:95 __preempt_count_dec_and_test arch/x86/include/asm/preempt.h:94 [inline] class_preempt_notrace_destructor include/linux/preempt.h:481 [inline] trace_contention_begin.constprop.0+0xf3/0x170 include/trace/events/lock.h:95 __pv_queued_spin_lock_slowpath+0x10b/0xc90 kernel/locking/qspinlock.c:402 pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:584 [inline] queued_spin_lock_slowpath arch/x86/include/asm/qspinlock.h:51 [inline] queued_spin_lock include/asm-generic/qspinlock.h:114 [inline] do_raw_spin_lock+0x210/0x2c0 kernel/locking/spinlock_debug.c:116 htab_lock_bucket kernel/bpf/hashtab.c:167 [inline] htab_lru_map_delete_elem+0x1c8/0x790 kernel/bpf/hashtab.c:1484 bpf_prog_2c29ac5cdc6b1842+0x43/0x47 bpf_dispatcher_nop_func include/linux/bpf.h:1290 [inline] __bpf_prog_run include/linux/filter.h:701 [inline] bpf_prog_run include/linux/filter.h:708 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2362 [inline] bpf_trace_run2+0x231/0x590 kernel/trace/bpf_trace.c:2403 __bpf_trace_contention_begin+0xca/0x110 include/trace/events/lock.h:95 __traceiter_contention_begin+0x5a/0xa0 include/trace/events/lock.h:95 trace_contention_begin+0xd2/0x140 include/trace/events/lock.h:95 __mutex_lock_common kernel/locking/mutex.c:587 [inline] __mutex_lock+0x1a8/0xa60 kernel/locking/mutex.c:735 srcu_advance_state kernel/rcu/srcutree.c:1691 [inline] process_srcu+0x72/0x1720 kernel/rcu/srcutree.c:1851 process_one_work+0x9c5/0x1ba0 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3391 kthread+0x2c1/0x3a0 kernel/kthread.c:389 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244