====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.4.3461/18228 is trying to acquire lock: ffff888035af7238 (&trie->lock){....}-{2:2}, at: trie_delete_elem+0x90/0x710 kernel/bpf/lpm_trie.c:467 but task is already holding lock: ffff88813fffbcd8 (&zone->lock){-.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:364 [inline] ffff88813fffbcd8 (&zone->lock){-.-.}-{2:2}, at: free_pcppages_bulk+0x4ee/0x7c0 mm/page_alloc.c:1519 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&zone->lock){-.-.}-{2:2}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xa4/0xf0 kernel/locking/spinlock.c:162 rmqueue_buddy mm/page_alloc.c:3610 [inline] rmqueue mm/page_alloc.c:3748 [inline] get_page_from_freelist+0x591/0x1c60 mm/page_alloc.c:4189 __alloc_pages+0x1e1/0x470 mm/page_alloc.c:5487 __alloc_pages_node include/linux/gfp.h:570 [inline] alloc_pages_node include/linux/gfp.h:584 [inline] kmalloc_large_node+0x7d/0x190 mm/slub.c:4426 __kmalloc_node+0x232/0x3b0 mm/slub.c:4442 kmalloc_node include/linux/slab.h:630 [inline] bpf_map_kmalloc_node+0xba/0x140 kernel/bpf/syscall.c:432 lpm_trie_node_alloc kernel/bpf/lpm_trie.c:290 [inline] trie_update_elem+0x1cc/0xc50 kernel/bpf/lpm_trie.c:332 bpf_map_update_value+0x57d/0x650 kernel/bpf/syscall.c:223 map_update_elem+0x626/0x770 kernel/bpf/syscall.c:1194 __sys_bpf+0x3fb/0x670 kernel/bpf/syscall.c:4645 __do_sys_bpf kernel/bpf/syscall.c:4761 [inline] __se_sys_bpf kernel/bpf/syscall.c:4759 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4759 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 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 kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xa4/0xf0 kernel/locking/spinlock.c:162 trie_delete_elem+0x90/0x710 kernel/bpf/lpm_trie.c:467 bpf_prog_6164f3e647ab800e+0x3d/0xc5c bpf_dispatcher_nop_func include/linux/bpf.h:888 [inline] __bpf_prog_run include/linux/filter.h:628 [inline] bpf_prog_run include/linux/filter.h:635 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:1878 [inline] bpf_trace_run3+0x17e/0x320 kernel/trace/bpf_trace.c:1916 __bpf_trace_mm_page_pcpu_drain+0x93/0xc0 include/trace/events/kmem.h:267 trace_mm_page_pcpu_drain include/trace/events/kmem.h:267 [inline] free_pcppages_bulk+0x6e6/0x7c0 mm/page_alloc.c:1540 free_unref_page+0x13f/0x280 mm/page_alloc.c:3416 free_slab mm/slub.c:2020 [inline] discard_slab mm/slub.c:2026 [inline] __unfreeze_partials+0x1a5/0x200 mm/slub.c:2512 put_cpu_partial+0x12d/0x190 mm/slub.c:2592 qlist_free_all+0x35/0x90 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x150/0x160 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x2f/0xd0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519 slab_alloc_node mm/slub.c:3225 [inline] slab_alloc mm/slub.c:3233 [inline] kmem_cache_alloc+0x100/0x290 mm/slub.c:3238 ptlock_alloc mm/memory.c:5556 [inline] ptlock_init include/linux/mm.h:2241 [inline] pmd_ptlock_init include/linux/mm.h:2327 [inline] pgtable_pmd_page_ctor include/linux/mm.h:2363 [inline] pmd_alloc_one include/asm-generic/pgalloc.h:129 [inline] __pmd_alloc+0x11f/0x730 mm/memory.c:4958 pmd_alloc include/linux/mm.h:2191 [inline] copy_pmd_range mm/memory.c:1147 [inline] copy_pud_range mm/memory.c:1204 [inline] copy_p4d_range mm/memory.c:1228 [inline] copy_page_range+0x2bee/0x3220 mm/memory.c:1301 dup_mmap kernel/fork.c:615 [inline] dup_mm kernel/fork.c:1466 [inline] copy_mm+0xc60/0x1380 kernel/fork.c:1518 copy_process+0x17c6/0x3e00 kernel/fork.c:2290 kernel_clone+0x219/0x930 kernel/fork.c:2679 __do_sys_clone kernel/fork.c:2796 [inline] __se_sys_clone kernel/fork.c:2780 [inline] __x64_sys_clone+0x170/0x1c0 kernel/fork.c:2780 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&zone->lock); lock(&trie->lock); lock(&zone->lock); lock(&trie->lock); *** DEADLOCK *** 7 locks held by syz.4.3461/18228: #0: ffffffff8c1a68f0 (dup_mmap_sem){++++}-{0:0}, at: dup_mmap kernel/fork.c:503 [inline] #0: ffffffff8c1a68f0 (dup_mmap_sem){++++}-{0:0}, at: dup_mm kernel/fork.c:1466 [inline] #0: ffffffff8c1a68f0 (dup_mmap_sem){++++}-{0:0}, at: copy_mm+0x21f/0x1380 kernel/fork.c:1518 #1: ffff88807914c028 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:87 [inline] #1: ffff88807914c028 (&mm->mmap_lock){++++}-{3:3}, at: dup_mmap kernel/fork.c:504 [inline] #1: ffff88807914c028 (&mm->mmap_lock){++++}-{3:3}, at: dup_mm kernel/fork.c:1466 [inline] #1: ffff88807914c028 (&mm->mmap_lock){++++}-{3:3}, at: copy_mm+0x238/0x1380 kernel/fork.c:1518 #2: ffff88807914c728 (&mm->mmap_lock/1){+.+.}-{3:3}, at: mmap_write_lock_nested include/linux/mmap_lock.h:78 [inline] #2: ffff88807914c728 (&mm->mmap_lock/1){+.+.}-{3:3}, at: dup_mmap kernel/fork.c:513 [inline] #2: ffff88807914c728 (&mm->mmap_lock/1){+.+.}-{3:3}, at: dup_mm kernel/fork.c:1466 [inline] #2: ffff88807914c728 (&mm->mmap_lock/1){+.+.}-{3:3}, at: copy_mm+0x354/0x1380 kernel/fork.c:1518 #3: ffffffff8c1f10e8 (remove_cache_srcu){....}-{0:0}, at: rcu_lock_acquire+0x0/0x30 #4: ffff8880b9135df8 (lock){-.-.}-{2:2}, at: local_lock_acquire+0x5/0x120 include/linux/local_lock_internal.h:28 #5: ffff88813fffbcd8 (&zone->lock){-.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:364 [inline] #5: ffff88813fffbcd8 (&zone->lock){-.-.}-{2:2}, at: free_pcppages_bulk+0x4ee/0x7c0 mm/page_alloc.c:1519 #6: ffffffff8c11c760 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:312 stack backtrace: CPU: 1 PID: 18228 Comm: syz.4.3461 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Call Trace: dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106 check_noncircular+0x274/0x310 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 kernel/locking/lockdep.c:3788 [inline] __lock_acquire+0x2c33/0x7c60 kernel/locking/lockdep.c:5012 lock_acquire+0x197/0x3f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xa4/0xf0 kernel/locking/spinlock.c:162 trie_delete_elem+0x90/0x710 kernel/bpf/lpm_trie.c:467 bpf_prog_6164f3e647ab800e+0x3d/0xc5c bpf_dispatcher_nop_func include/linux/bpf.h:888 [inline] __bpf_prog_run include/linux/filter.h:628 [inline] bpf_prog_run include/linux/filter.h:635 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:1878 [inline] bpf_trace_run3+0x17e/0x320 kernel/trace/bpf_trace.c:1916 __bpf_trace_mm_page_pcpu_drain+0x93/0xc0 include/trace/events/kmem.h:267 trace_mm_page_pcpu_drain include/trace/events/kmem.h:267 [inline] free_pcppages_bulk+0x6e6/0x7c0 mm/page_alloc.c:1540 free_unref_page+0x13f/0x280 mm/page_alloc.c:3416 free_slab mm/slub.c:2020 [inline] discard_slab mm/slub.c:2026 [inline] __unfreeze_partials+0x1a5/0x200 mm/slub.c:2512 put_cpu_partial+0x12d/0x190 mm/slub.c:2592 qlist_free_all+0x35/0x90 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x150/0x160 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x2f/0xd0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519 slab_alloc_node mm/slub.c:3225 [inline] slab_alloc mm/slub.c:3233 [inline] kmem_cache_alloc+0x100/0x290 mm/slub.c:3238 ptlock_alloc mm/memory.c:5556 [inline] ptlock_init include/linux/mm.h:2241 [inline] pmd_ptlock_init include/linux/mm.h:2327 [inline] pgtable_pmd_page_ctor include/linux/mm.h:2363 [inline] pmd_alloc_one include/asm-generic/pgalloc.h:129 [inline] __pmd_alloc+0x11f/0x730 mm/memory.c:4958 pmd_alloc include/linux/mm.h:2191 [inline] copy_pmd_range mm/memory.c:1147 [inline] copy_pud_range mm/memory.c:1204 [inline] copy_p4d_range mm/memory.c:1228 [inline] copy_page_range+0x2bee/0x3220 mm/memory.c:1301 dup_mmap kernel/fork.c:615 [inline] dup_mm kernel/fork.c:1466 [inline] copy_mm+0xc60/0x1380 kernel/fork.c:1518 copy_process+0x17c6/0x3e00 kernel/fork.c:2290 kernel_clone+0x219/0x930 kernel/fork.c:2679 __do_sys_clone kernel/fork.c:2796 [inline] __se_sys_clone kernel/fork.c:2780 [inline] __x64_sys_clone+0x170/0x1c0 kernel/fork.c:2780 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7faceb715749 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:00007face997bfe8 EFLAGS: 00000206 ORIG_RAX: 0000000000000038 RAX: ffffffffffffffda RBX: 00007faceb96bfa0 RCX: 00007faceb715749 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000040000000 RBP: 00007faceb799f91 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000206 R12: 0000000000000000 R13: 00007faceb96c038 R14: 00007faceb96bfa0 R15: 00007ffd0acdfc38