====================================================== WARNING: possible circular locking dependency detected 6.1.103-syzkaller #0 Not tainted ------------------------------------------------------ kworker/0:4/3680 is trying to acquire lock: ffff88805d3c01d0 (&htab->lockdep_key){-.-.}-{2:2}, at: htab_lock_bucket+0x1a0/0x360 kernel/bpf/hashtab.c:166 but task is already holding lock: ffff88805b7791d0 (&htab->lockdep_key#2){-.-.}-{2:2}, at: htab_lock_bucket+0x1a0/0x360 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#2){-.-.}-{2:2}: lock_acquire+0x1f8/0x5a0 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+0x1a0/0x360 kernel/bpf/hashtab.c:166 htab_map_delete_elem+0x1d5/0x6b0 kernel/bpf/hashtab.c:1399 bpf_prog_77600dd2573fd9fe+0x42/0x46 bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline] __bpf_prog_run include/linux/filter.h:596 [inline] bpf_prog_run include/linux/filter.h:610 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline] bpf_trace_run2+0x361/0x410 kernel/trace/bpf_trace.c:2312 __traceiter_contention_end+0x74/0xa0 include/trace/events/lock.h:122 trace_contention_end+0x14c/0x190 include/trace/events/lock.h:122 __pv_queued_spin_lock_slowpath+0x935/0xc50 kernel/locking/qspinlock.c:560 pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:591 [inline] queued_spin_lock_slowpath+0x42/0x50 arch/x86/include/asm/qspinlock.h:51 queued_spin_lock include/asm-generic/qspinlock.h:114 [inline] do_raw_spin_lock+0x269/0x370 kernel/locking/spinlock_debug.c:115 htab_lock_bucket+0x1a0/0x360 kernel/bpf/hashtab.c:166 htab_map_delete_elem+0x1d5/0x6b0 kernel/bpf/hashtab.c:1399 bpf_prog_77600dd2573fd9fe+0x42/0x46 bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline] __bpf_prog_run include/linux/filter.h:596 [inline] bpf_prog_run include/linux/filter.h:610 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline] bpf_trace_run2+0x361/0x410 kernel/trace/bpf_trace.c:2312 __traceiter_contention_end+0x74/0xa0 include/trace/events/lock.h:122 trace_contention_end+0x12f/0x170 include/trace/events/lock.h:122 __mutex_lock_common kernel/locking/mutex.c:612 [inline] __mutex_lock+0x2ed/0xd80 kernel/locking/mutex.c:747 lo_simple_ioctl drivers/block/loop.c:1509 [inline] lo_ioctl+0x57f/0x2010 drivers/block/loop.c:1585 blkdev_ioctl+0x3a9/0x760 block/ioctl.c:619 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 -> #0 (&htab->lockdep_key){-.-.}-{2:2}: check_prev_add kernel/locking/lockdep.c:3090 [inline] check_prevs_add kernel/locking/lockdep.c:3209 [inline] validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049 lock_acquire+0x1f8/0x5a0 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+0x1a0/0x360 kernel/bpf/hashtab.c:166 htab_map_delete_elem+0x1d5/0x6b0 kernel/bpf/hashtab.c:1399 bpf_prog_77600dd2573fd9fe+0x42/0x46 bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline] __bpf_prog_run include/linux/filter.h:596 [inline] bpf_prog_run include/linux/filter.h:610 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline] bpf_trace_run2+0x361/0x410 kernel/trace/bpf_trace.c:2312 __traceiter_contention_end+0x74/0xa0 include/trace/events/lock.h:122 trace_contention_end+0x14c/0x190 include/trace/events/lock.h:122 __pv_queued_spin_lock_slowpath+0x935/0xc50 kernel/locking/qspinlock.c:560 pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:591 [inline] queued_spin_lock_slowpath+0x42/0x50 arch/x86/include/asm/qspinlock.h:51 queued_spin_lock include/asm-generic/qspinlock.h:114 [inline] do_raw_spin_lock+0x269/0x370 kernel/locking/spinlock_debug.c:115 htab_lock_bucket+0x1a0/0x360 kernel/bpf/hashtab.c:166 htab_map_delete_elem+0x1d5/0x6b0 kernel/bpf/hashtab.c:1399 bpf_prog_77600dd2573fd9fe+0x42/0x46 bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline] __bpf_prog_run include/linux/filter.h:596 [inline] bpf_prog_run include/linux/filter.h:610 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline] bpf_trace_run2+0x361/0x410 kernel/trace/bpf_trace.c:2312 __traceiter_contention_end+0x74/0xa0 include/trace/events/lock.h:122 trace_contention_end+0x12f/0x170 include/trace/events/lock.h:122 __mutex_lock_common kernel/locking/mutex.c:612 [inline] __mutex_lock+0x2ed/0xd80 kernel/locking/mutex.c:747 srcu_gp_end kernel/rcu/srcutree.c:756 [inline] srcu_advance_state kernel/rcu/srcutree.c:1554 [inline] process_srcu+0x22a/0x1300 kernel/rcu/srcutree.c:1650 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&htab->lockdep_key#2); lock(&htab->lockdep_key); lock(&htab->lockdep_key#2); lock(&htab->lockdep_key); *** DEADLOCK *** 7 locks held by kworker/0:4/3680: #0: ffff888012872138 ((wq_completion)rcu_gp){+.+.}-{0:0}, at: process_one_work+0x7a9/0x11d0 kernel/workqueue.c:2267 #1: ffffc900040afd20 ((work_completion)(&(&ssp->work)->work)){+.+.}-{0:0}, at: process_one_work+0x7a9/0x11d0 kernel/workqueue.c:2267 #2: ffffffff91ffe898 (&ssp->srcu_gp_mutex){+.+.}-{3:3}, at: srcu_advance_state kernel/rcu/srcutree.c:1498 [inline] #2: ffffffff91ffe898 (&ssp->srcu_gp_mutex){+.+.}-{3:3}, at: process_srcu+0x2f/0x1300 kernel/rcu/srcutree.c:1650 #3: ffffffff91ffe7c8 (&ssp->srcu_cb_mutex){+.+.}-{3:3}, at: srcu_gp_end kernel/rcu/srcutree.c:756 [inline] #3: ffffffff91ffe7c8 (&ssp->srcu_cb_mutex){+.+.}-{3:3}, at: srcu_advance_state kernel/rcu/srcutree.c:1554 [inline] #3: ffffffff91ffe7c8 (&ssp->srcu_cb_mutex){+.+.}-{3:3}, at: process_srcu+0x22a/0x1300 kernel/rcu/srcutree.c:1650 #4: ffffffff8d32afc0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline] #4: ffffffff8d32afc0 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline] #4: ffffffff8d32afc0 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2272 [inline] #4: ffffffff8d32afc0 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run2+0x110/0x410 kernel/trace/bpf_trace.c:2312 #5: ffff88805b7791d0 (&htab->lockdep_key#2){-.-.}-{2:2}, at: htab_lock_bucket+0x1a0/0x360 kernel/bpf/hashtab.c:166 #6: ffffffff8d32afc0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline] #6: ffffffff8d32afc0 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline] #6: ffffffff8d32afc0 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2272 [inline] #6: ffffffff8d32afc0 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run2+0x110/0x410 kernel/trace/bpf_trace.c:2312 stack backtrace: CPU: 0 PID: 3680 Comm: kworker/0:4 Not tainted 6.1.103-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Workqueue: rcu_gp process_srcu Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 check_noncircular+0x2fa/0x3b0 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+0x1661/0x5950 kernel/locking/lockdep.c:3825 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049 lock_acquire+0x1f8/0x5a0 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+0x1a0/0x360 kernel/bpf/hashtab.c:166 htab_map_delete_elem+0x1d5/0x6b0 kernel/bpf/hashtab.c:1399 bpf_prog_77600dd2573fd9fe+0x42/0x46 bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline] __bpf_prog_run include/linux/filter.h:596 [inline] bpf_prog_run include/linux/filter.h:610 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline] bpf_trace_run2+0x361/0x410 kernel/trace/bpf_trace.c:2312 __traceiter_contention_end+0x74/0xa0 include/trace/events/lock.h:122 trace_contention_end+0x14c/0x190 include/trace/events/lock.h:122 __pv_queued_spin_lock_slowpath+0x935/0xc50 kernel/locking/qspinlock.c:560 pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:591 [inline] queued_spin_lock_slowpath+0x42/0x50 arch/x86/include/asm/qspinlock.h:51 queued_spin_lock include/asm-generic/qspinlock.h:114 [inline] do_raw_spin_lock+0x269/0x370 kernel/locking/spinlock_debug.c:115 htab_lock_bucket+0x1a0/0x360 kernel/bpf/hashtab.c:166 htab_map_delete_elem+0x1d5/0x6b0 kernel/bpf/hashtab.c:1399 bpf_prog_77600dd2573fd9fe+0x42/0x46 bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline] __bpf_prog_run include/linux/filter.h:596 [inline] bpf_prog_run include/linux/filter.h:610 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline] bpf_trace_run2+0x361/0x410 kernel/trace/bpf_trace.c:2312 __traceiter_contention_end+0x74/0xa0 include/trace/events/lock.h:122 trace_contention_end+0x12f/0x170 include/trace/events/lock.h:122 __mutex_lock_common kernel/locking/mutex.c:612 [inline] __mutex_lock+0x2ed/0xd80 kernel/locking/mutex.c:747 srcu_gp_end kernel/rcu/srcutree.c:756 [inline] srcu_advance_state kernel/rcu/srcutree.c:1554 [inline] process_srcu+0x22a/0x1300 kernel/rcu/srcutree.c:1650 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295