====================================================== WARNING: possible circular locking dependency detected 5.15.170-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor/4176 is trying to acquire lock: ffff888079a5a5b8 (&trie->lock){..-.}-{2:2}, at: trie_delete_elem+0x90/0x690 kernel/bpf/lpm_trie.c:450 but task is already holding lock: ffff8880b9028098 (&base->lock){-.-.}-{2:2}, at: lock_timer_base+0x120/0x260 kernel/time/timer.c:946 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&base->lock){-.-.}-{2:2}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 lock_timer_base+0x120/0x260 kernel/time/timer.c:946 __mod_timer+0x1d6/0xeb0 kernel/time/timer.c:1019 queue_delayed_work_on+0x156/0x250 kernel/workqueue.c:1715 queue_delayed_work include/linux/workqueue.h:527 [inline] schedule_delayed_work include/linux/workqueue.h:631 [inline] kvfree_call_rcu+0x50e/0x8a0 kernel/rcu/tree.c:3625 rtnl_register_internal+0x443/0x530 net/core/rtnetlink.c:223 rtnl_register+0x32/0x70 net/core/rtnetlink.c:273 ip_rt_init+0x2e6/0x390 net/ipv4/route.c:3750 ip_init+0xa/0x20 net/ipv4/ip_output.c:1749 inet_init+0x27c/0x390 net/ipv4/af_inet.c:2009 do_one_initcall+0x22b/0x7a0 init/main.c:1302 do_initcall_level+0x157/0x210 init/main.c:1375 do_initcalls+0x49/0x90 init/main.c:1391 kernel_init_freeable+0x425/0x5c0 init/main.c:1615 kernel_init+0x19/0x290 init/main.c:1506 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 -> #1 (krc.lock){..-.}-{2:2}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154 krc_this_cpu_lock kernel/rcu/tree.c:3199 [inline] add_ptr_to_bulk_krc_lock kernel/rcu/tree.c:3506 [inline] kvfree_call_rcu+0x1b5/0x8a0 kernel/rcu/tree.c:3597 trie_update_elem+0x808/0xc00 kernel/bpf/lpm_trie.c:384 bpf_map_update_value+0x5d7/0x6c0 kernel/bpf/syscall.c:221 generic_map_update_batch+0x54d/0x8b0 kernel/bpf/syscall.c:1421 bpf_map_do_batch+0x4d0/0x620 __sys_bpf+0x55c/0x670 __do_sys_bpf kernel/bpf/syscall.c:4755 [inline] __se_sys_bpf kernel/bpf/syscall.c:4753 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4753 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 (&trie->lock){..-.}-{2:2}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 trie_delete_elem+0x90/0x690 kernel/bpf/lpm_trie.c:450 bpf_prog_2e5e7763945ac34e+0x3c/0x788 bpf_dispatcher_nop_func include/linux/bpf.h:790 [inline] __bpf_prog_run include/linux/filter.h:621 [inline] bpf_prog_run include/linux/filter.h:635 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:1878 [inline] bpf_trace_run3+0x2ce/0x380 kernel/trace/bpf_trace.c:1916 trace_timer_start include/trace/events/timer.h:52 [inline] enqueue_timer+0x3ae/0x540 kernel/time/timer.c:586 internal_add_timer kernel/time/timer.c:611 [inline] __mod_timer+0xa60/0xeb0 kernel/time/timer.c:1062 hsr_announce+0x22a/0x300 net/hsr/hsr_device.c:385 call_timer_fn+0x16d/0x560 kernel/time/timer.c:1451 expire_timers kernel/time/timer.c:1496 [inline] __run_timers+0x67c/0x890 kernel/time/timer.c:1767 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1780 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558 __do_softirq kernel/softirq.c:592 [inline] invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x157/0x240 kernel/softirq.c:641 irq_exit_rcu+0x5/0x20 kernel/softirq.c:653 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline] sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1108 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:676 copy_present_pte mm/memory.c:972 [inline] copy_pte_range mm/memory.c:1070 [inline] copy_pmd_range mm/memory.c:1156 [inline] copy_pud_range mm/memory.c:1193 [inline] copy_p4d_range mm/memory.c:1217 [inline] copy_page_range+0x19d5/0x43b0 mm/memory.c:1290 dup_mmap kernel/fork.c:614 [inline] dup_mm kernel/fork.c:1465 [inline] copy_mm+0xc64/0x1370 kernel/fork.c:1517 copy_process+0x1816/0x3ef0 kernel/fork.c:2203 kernel_clone+0x210/0x960 kernel/fork.c:2601 __do_sys_clone kernel/fork.c:2718 [inline] __se_sys_clone kernel/fork.c:2702 [inline] __x64_sys_clone+0x23f/0x290 kernel/fork.c:2702 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 other info that might help us debug this: Chain exists of: &trie->lock --> krc.lock --> &base->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&base->lock); lock(krc.lock); lock(&base->lock); lock(&trie->lock); *** DEADLOCK *** 9 locks held by syz-executor/4176: #0: ffffffff8c9ab0f0 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mmap kernel/fork.c:502 [inline] #0: ffffffff8c9ab0f0 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1465 [inline] #0: ffffffff8c9ab0f0 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm+0x223/0x1370 kernel/fork.c:1517 #1: ffff88807cb5c028 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:87 [inline] #1: ffff88807cb5c028 (&mm->mmap_lock){++++}-{3:3}, at: dup_mmap kernel/fork.c:503 [inline] #1: ffff88807cb5c028 (&mm->mmap_lock){++++}-{3:3}, at: dup_mm kernel/fork.c:1465 [inline] #1: ffff88807cb5c028 (&mm->mmap_lock){++++}-{3:3}, at: copy_mm+0x242/0x1370 kernel/fork.c:1517 #2: ffff88807ae07128 (&mm->mmap_lock/1){+.+.}-{3:3}, at: mmap_write_lock_nested include/linux/mmap_lock.h:78 [inline] #2: ffff88807ae07128 (&mm->mmap_lock/1){+.+.}-{3:3}, at: dup_mmap kernel/fork.c:512 [inline] #2: ffff88807ae07128 (&mm->mmap_lock/1){+.+.}-{3:3}, at: dup_mm kernel/fork.c:1465 [inline] #2: ffff88807ae07128 (&mm->mmap_lock/1){+.+.}-{3:3}, at: copy_mm+0x35c/0x1370 kernel/fork.c:1517 #3: ffff88801f4a3e58 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:363 [inline] #3: ffff88801f4a3e58 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: copy_pte_range mm/memory.c:1021 [inline] #3: ffff88801f4a3e58 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: copy_pmd_range mm/memory.c:1156 [inline] #3: ffff88801f4a3e58 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: copy_pud_range mm/memory.c:1193 [inline] #3: ffff88801f4a3e58 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: copy_p4d_range mm/memory.c:1217 [inline] #3: ffff88801f4a3e58 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: copy_page_range+0xfc2/0x43b0 mm/memory.c:1290 #4: ffff88802bbd9198 (ptlock_ptr(page)#2/1){+.+.}-{2:2}, at: copy_pte_range mm/memory.c:1028 [inline] #4: ffff88802bbd9198 (ptlock_ptr(page)#2/1){+.+.}-{2:2}, at: copy_pmd_range mm/memory.c:1156 [inline] #4: ffff88802bbd9198 (ptlock_ptr(page)#2/1){+.+.}-{2:2}, at: copy_pud_range mm/memory.c:1193 [inline] #4: ffff88802bbd9198 (ptlock_ptr(page)#2/1){+.+.}-{2:2}, at: copy_p4d_range mm/memory.c:1217 [inline] #4: ffff88802bbd9198 (ptlock_ptr(page)#2/1){+.+.}-{2:2}, at: copy_page_range+0x10bd/0x43b0 mm/memory.c:1290 #5: ffffc90000007be0 ((&hsr->announce_timer)){+.-.}-{0:0}, at: lockdep_copy_map include/linux/lockdep.h:45 [inline] #5: ffffc90000007be0 ((&hsr->announce_timer)){+.-.}-{0:0}, at: call_timer_fn+0xbe/0x560 kernel/time/timer.c:1441 #6: ffffffff8c91fc60 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:311 #7: ffff8880b9028098 (&base->lock){-.-.}-{2:2}, at: lock_timer_base+0x120/0x260 kernel/time/timer.c:946 #8: ffffffff8c91fc60 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:311 stack backtrace: CPU: 0 PID: 4176 Comm: syz-executor Not tainted 5.15.170-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 trie_delete_elem+0x90/0x690 kernel/bpf/lpm_trie.c:450 bpf_prog_2e5e7763945ac34e+0x3c/0x788 bpf_dispatcher_nop_func include/linux/bpf.h:790 [inline] __bpf_prog_run include/linux/filter.h:621 [inline] bpf_prog_run include/linux/filter.h:635 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:1878 [inline] bpf_trace_run3+0x2ce/0x380 kernel/trace/bpf_trace.c:1916 trace_timer_start include/trace/events/timer.h:52 [inline] enqueue_timer+0x3ae/0x540 kernel/time/timer.c:586 internal_add_timer kernel/time/timer.c:611 [inline] __mod_timer+0xa60/0xeb0 kernel/time/timer.c:1062 hsr_announce+0x22a/0x300 net/hsr/hsr_device.c:385 call_timer_fn+0x16d/0x560 kernel/time/timer.c:1451 expire_timers kernel/time/timer.c:1496 [inline] __run_timers+0x67c/0x890 kernel/time/timer.c:1767 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1780 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558 __do_softirq kernel/softirq.c:592 [inline] invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x157/0x240 kernel/softirq.c:641 irq_exit_rcu+0x5/0x20 kernel/softirq.c:653 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline] sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1108 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:676 RIP: 0010:copy_present_pte mm/memory.c:972 [inline] RIP: 0010:copy_pte_range mm/memory.c:1070 [inline] RIP: 0010:copy_pmd_range mm/memory.c:1156 [inline] RIP: 0010:copy_pud_range mm/memory.c:1193 [inline] RIP: 0010:copy_p4d_range mm/memory.c:1217 [inline] RIP: 0010:copy_page_range+0x19d5/0x43b0 mm/memory.c:1290 Code: 00 00 00 48 83 e0 fd eb 0d e8 47 2e c8 ff 48 8b 84 24 88 00 00 00 49 89 c6 49 83 e6 9f 48 8b 74 24 10 48 83 e6 08 4c 0f 44 f0 <31> ff e8 04 32 c8 ff 48 8b 9c 24 f0 00 00 00 48 89 d8 48 c1 e8 03 RSP: 0018:ffffc90002ef75e0 EFLAGS: 00000202 RAX: 800000006773d007 RBX: 0000000000000002 RCX: ffff88807e028000 RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000000000000 RBP: ffffc90002ef7950 R08: ffffffff81b84540 R09: fffff9400033b9e9 R10: 0000000000000000 R11: dffffc0000000001 R12: ffff888023465210 R13: 00fff00000000000 R14: 800000006773d007 R15: ffff888023465260 dup_mmap kernel/fork.c:614 [inline] dup_mm kernel/fork.c:1465 [inline] copy_mm+0xc64/0x1370 kernel/fork.c:1517 copy_process+0x1816/0x3ef0 kernel/fork.c:2203 kernel_clone+0x210/0x960 kernel/fork.c:2601 __do_sys_clone kernel/fork.c:2718 [inline] __se_sys_clone kernel/fork.c:2702 [inline] __x64_sys_clone+0x23f/0x290 kernel/fork.c:2702 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7faff29fff93 Code: 1f 84 00 00 00 00 00 64 48 8b 04 25 10 00 00 00 45 31 c0 31 d2 31 f6 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 89 c2 85 c0 75 2c 64 48 8b 04 25 10 00 00 RSP: 002b:00007ffd88898078 EFLAGS: 00000246 ORIG_RAX: 0000000000000038 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007faff29fff93 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011 RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000 R10: 00005555948de7d0 R11: 0000000000000246 R12: 0000000000000000 R13: 00000000000159f7 R14: 00000000000158d6 R15: 00007ffd88898200 ---------------- Code disassembly (best guess): 0: 00 00 add %al,(%rax) 2: 00 48 83 add %cl,-0x7d(%rax) 5: e0 fd loopne 0x4 7: eb 0d jmp 0x16 9: e8 47 2e c8 ff call 0xffc82e55 e: 48 8b 84 24 88 00 00 mov 0x88(%rsp),%rax 15: 00 16: 49 89 c6 mov %rax,%r14 19: 49 83 e6 9f and $0xffffffffffffff9f,%r14 1d: 48 8b 74 24 10 mov 0x10(%rsp),%rsi 22: 48 83 e6 08 and $0x8,%rsi 26: 4c 0f 44 f0 cmove %rax,%r14 * 2a: 31 ff xor %edi,%edi <-- trapping instruction 2c: e8 04 32 c8 ff call 0xffc83235 31: 48 8b 9c 24 f0 00 00 mov 0xf0(%rsp),%rbx 38: 00 39: 48 89 d8 mov %rbx,%rax 3c: 48 c1 e8 03 shr $0x3,%rax