====================================================== WARNING: possible circular locking dependency detected 6.12.0-rc5-syzkaller-00308-g3e5e6c9900c3 #0 Not tainted ------------------------------------------------------ syz.0.800/8295 is trying to acquire lock: ffff88803149ea00 (&trie->lock){-.-.}-{2:2}, at: trie_delete_elem+0xb0/0x820 kernel/bpf/lpm_trie.c:462 but task is already holding lock: ffffffff9aa91648 (&obj_hash[i].lock){-.-.}-{2:2}, at: debug_object_active_state+0x145/0x3a0 lib/debugobjects.c:936 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&obj_hash[i].lock){-.-.}-{2:2}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162 __debug_check_no_obj_freed lib/debugobjects.c:978 [inline] debug_check_no_obj_freed+0x1d0/0x600 lib/debugobjects.c:1019 free_pages_prepare mm/page_alloc.c:1115 [inline] free_unref_page+0x21a/0xdc0 mm/page_alloc.c:2638 stack_depot_save_flags+0x2da/0x8f0 lib/stackdepot.c:666 kasan_save_stack+0x42/0x60 mm/kasan/common.c:48 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:257 [inline] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_node_noprof+0x211/0x430 mm/slub.c:4270 kmalloc_node_noprof include/linux/slab.h:905 [inline] bpf_map_kmalloc_node+0x98/0x4a0 kernel/bpf/syscall.c:422 lpm_trie_node_alloc kernel/bpf/lpm_trie.c:299 [inline] trie_update_elem+0x1ef/0xe00 kernel/bpf/lpm_trie.c:342 bpf_map_update_value+0x2c1/0x6c0 kernel/bpf/syscall.c:203 map_update_elem+0x606/0x8f0 kernel/bpf/syscall.c:1626 __sys_bpf+0x14bb/0x49a0 kernel/bpf/syscall.c:5641 __do_sys_bpf kernel/bpf/syscall.c:5760 [inline] __se_sys_bpf kernel/bpf/syscall.c:5758 [inline] __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5758 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 (&trie->lock){-.-.}-{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+0x250b/0x3ce0 kernel/locking/lockdep.c:5202 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5825 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162 trie_delete_elem+0xb0/0x820 kernel/bpf/lpm_trie.c:462 bpf_prog_1c0c44170264bb34+0x46/0x4a bpf_dispatcher_nop_func include/linux/bpf.h:1265 [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:2316 [inline] bpf_trace_run2+0x231/0x590 kernel/trace/bpf_trace.c:2357 __bpf_trace_contention_end+0xca/0x110 include/trace/events/lock.h:122 trace_contention_end.constprop.0+0xea/0x170 include/trace/events/lock.h:122 __pv_queued_spin_lock_slowpath+0x27e/0xc90 kernel/locking/qspinlock.c:557 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 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0x42/0x60 kernel/locking/spinlock.c:162 debug_object_active_state+0x145/0x3a0 lib/debugobjects.c:936 debug_rcu_head_unqueue kernel/rcu/rcu.h:233 [inline] rcu_do_batch kernel/rcu/tree.c:2559 [inline] rcu_core+0x723/0x14d0 kernel/rcu/tree.c:2823 handle_softirqs+0x213/0x8f0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu kernel/softirq.c:637 [inline] irq_exit_rcu+0xbb/0x120 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1049 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline] _raw_spin_unlock_irqrestore+0x31/0x80 kernel/locking/spinlock.c:194 spin_unlock_irqrestore include/linux/spinlock.h:406 [inline] avc_reclaim_node security/selinux/avc.c:482 [inline] avc_alloc_node+0x365/0x5a0 security/selinux/avc.c:501 avc_update_node.isra.0+0x60/0x800 security/selinux/avc.c:835 avc_denied+0x138/0x180 security/selinux/avc.c:1002 avc_perm_nonode+0x158/0x170 security/selinux/avc.c:1113 avc_has_perm_noaudit+0x2d2/0x3a0 security/selinux/avc.c:1153 avc_has_perm+0xc1/0x1c0 security/selinux/avc.c:1188 selinux_bpf+0xd7/0x130 security/selinux/hooks.c:6814 security_bpf+0x206/0x230 security/security.c:5607 __sys_bpf+0x24c/0x49a0 kernel/bpf/syscall.c:5629 __do_sys_bpf kernel/bpf/syscall.c:5760 [inline] __se_sys_bpf kernel/bpf/syscall.c:5758 [inline] __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5758 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 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&obj_hash[i].lock); lock(&trie->lock); lock(&obj_hash[i].lock); lock(&trie->lock); *** DEADLOCK *** 2 locks held by syz.0.800/8295: #0: ffffffff9aa91648 (&obj_hash[i].lock){-.-.}-{2:2}, at: debug_object_active_state+0x145/0x3a0 lib/debugobjects.c:936 #1: ffffffff8e1b8340 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:337 [inline] #1: ffffffff8e1b8340 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline] #1: ffffffff8e1b8340 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2315 [inline] #1: ffffffff8e1b8340 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run2+0x1c2/0x590 kernel/trace/bpf_trace.c:2357 stack backtrace: CPU: 2 UID: 0 PID: 8295 Comm: syz.0.800 Not tainted 6.12.0-rc5-syzkaller-00308-g3e5e6c9900c3 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x41c/0x610 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+0x250b/0x3ce0 kernel/locking/lockdep.c:5202 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5825 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162 trie_delete_elem+0xb0/0x820 kernel/bpf/lpm_trie.c:462 bpf_prog_1c0c44170264bb34+0x46/0x4a bpf_dispatcher_nop_func include/linux/bpf.h:1265 [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:2316 [inline] bpf_trace_run2+0x231/0x590 kernel/trace/bpf_trace.c:2357 __bpf_trace_contention_end+0xca/0x110 include/trace/events/lock.h:122 trace_contention_end.constprop.0+0xea/0x170 include/trace/events/lock.h:122 __pv_queued_spin_lock_slowpath+0x27e/0xc90 kernel/locking/qspinlock.c:557 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 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0x42/0x60 kernel/locking/spinlock.c:162 debug_object_active_state+0x145/0x3a0 lib/debugobjects.c:936 debug_rcu_head_unqueue kernel/rcu/rcu.h:233 [inline] rcu_do_batch kernel/rcu/tree.c:2559 [inline] rcu_core+0x723/0x14d0 kernel/rcu/tree.c:2823 handle_softirqs+0x213/0x8f0 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu kernel/softirq.c:637 [inline] irq_exit_rcu+0xbb/0x120 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1049 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x31/0x80 kernel/locking/spinlock.c:194 Code: f5 53 48 8b 74 24 10 48 89 fb 48 83 c7 18 e8 d6 d3 44 f6 48 89 df e8 ee 50 45 f6 f7 c5 00 02 00 00 75 23 9c 58 f6 c4 02 75 37 01 00 00 00 e8 45 58 36 f6 65 8b 05 f6 11 de 74 85 c0 74 16 5b RSP: 0018:ffffc900290cf938 EFLAGS: 00000246 RAX: 0000000000000006 RBX: ffffffff9a991988 RCX: 1ffffffff20be2f1 RDX: 0000000000000000 RSI: ffffffff8b6cd040 RDI: ffffffff8bd1b2c0 RBP: 0000000000000206 R08: 0000000000000001 R09: 0000000000000001 R10: ffffffff905f59cf R11: 0000000000000000 R12: 000000000000006b R13: 0000000000000001 R14: dffffc0000000000 R15: 0000000000000206 spin_unlock_irqrestore include/linux/spinlock.h:406 [inline] avc_reclaim_node security/selinux/avc.c:482 [inline] avc_alloc_node+0x365/0x5a0 security/selinux/avc.c:501 avc_update_node.isra.0+0x60/0x800 security/selinux/avc.c:835 avc_denied+0x138/0x180 security/selinux/avc.c:1002 avc_perm_nonode+0x158/0x170 security/selinux/avc.c:1113 avc_has_perm_noaudit+0x2d2/0x3a0 security/selinux/avc.c:1153 avc_has_perm+0xc1/0x1c0 security/selinux/avc.c:1188 selinux_bpf+0xd7/0x130 security/selinux/hooks.c:6814 security_bpf+0x206/0x230 security/security.c:5607 __sys_bpf+0x24c/0x49a0 kernel/bpf/syscall.c:5629 __do_sys_bpf kernel/bpf/syscall.c:5760 [inline] __se_sys_bpf kernel/bpf/syscall.c:5758 [inline] __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5758 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 RIP: 0033:0x7fd937f7e719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fd938cf8038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007fd938135f80 RCX: 00007fd937f7e719 RDX: 0000000000000094 RSI: 0000000020002ac0 RDI: 0000000000000005 RBP: 00007fd937ff132e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000001 R14: 00007fd938135f80 R15: 00007fff56ad3bf8 ---------------- Code disassembly (best guess): 0: f5 cmc 1: 53 push %rbx 2: 48 8b 74 24 10 mov 0x10(%rsp),%rsi 7: 48 89 fb mov %rdi,%rbx a: 48 83 c7 18 add $0x18,%rdi e: e8 d6 d3 44 f6 call 0xf644d3e9 13: 48 89 df mov %rbx,%rdi 16: e8 ee 50 45 f6 call 0xf6455109 1b: f7 c5 00 02 00 00 test $0x200,%ebp 21: 75 23 jne 0x46 23: 9c pushf 24: 58 pop %rax 25: f6 c4 02 test $0x2,%ah 28: 75 37 jne 0x61 * 2a: bf 01 00 00 00 mov $0x1,%edi <-- trapping instruction 2f: e8 45 58 36 f6 call 0xf6365879 34: 65 8b 05 f6 11 de 74 mov %gs:0x74de11f6(%rip),%eax # 0x74de1231 3b: 85 c0 test %eax,%eax 3d: 74 16 je 0x55 3f: 5b pop %rbx