====================================================== WARNING: possible circular locking dependency detected 5.15.164-syzkaller #0 Not tainted ------------------------------------------------------ syz.3.1595/8189 is trying to acquire lock: ffff8880b9b35ca8 (lock){-.-.}-{2:2}, at: local_lock_acquire+0x7/0x130 include/linux/local_lock_internal.h:28 but task is already holding lock: ffff8880239c85b8 (&trie->lock){..-.}-{2:2}, at: trie_update_elem+0xc5/0xc00 kernel/bpf/lpm_trie.c:323 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&trie->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 trie_delete_elem+0x90/0x690 kernel/bpf/lpm_trie.c:450 bpf_prog_abe3471d98b428a0+0x9ad/0xd80 bpf_dispatcher_nop_func include/linux/bpf.h:790 [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:1880 [inline] bpf_trace_run1+0x168/0x2f0 kernel/trace/bpf_trace.c:1916 __bpf_trace_mm_page_free_batched+0x41/0x60 include/trace/events/kmem.h:182 trace_mm_page_free_batched include/trace/events/kmem.h:182 [inline] free_unref_page_list+0x79b/0x8e0 mm/page_alloc.c:3465 release_pages+0x1bb9/0x1f40 mm/swap.c:963 __pagevec_release+0x80/0xf0 mm/swap.c:983 pagevec_release include/linux/pagevec.h:81 [inline] shmem_undo_range+0x67a/0x1b50 mm/shmem.c:964 shmem_truncate_range mm/shmem.c:1063 [inline] shmem_fallocate+0x433/0xfb0 mm/shmem.c:2701 vfs_fallocate+0x54a/0x6b0 fs/open.c:308 do_vfs_ioctl+0x2317/0x2b70 fs/ioctl.c:853 __do_sys_ioctl fs/ioctl.c:872 [inline] __se_sys_ioctl+0x81/0x160 fs/ioctl.c:860 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 (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 local_lock_acquire+0x23/0x130 include/linux/local_lock_internal.h:29 rmqueue_pcplist mm/page_alloc.c:3652 [inline] rmqueue mm/page_alloc.c:3690 [inline] get_page_from_freelist+0x27cc/0x33c0 mm/page_alloc.c:4156 __alloc_pages+0x272/0x700 mm/page_alloc.c:5423 __alloc_pages_node include/linux/gfp.h:570 [inline] alloc_pages_node include/linux/gfp.h:584 [inline] kmalloc_large_node+0x7c/0x180 mm/slub.c:4421 __kmalloc_node+0x22d/0x390 mm/slub.c:4437 kmalloc_node include/linux/slab.h:614 [inline] bpf_map_kmalloc_node+0xdb/0x160 kernel/bpf/syscall.c:430 lpm_trie_node_alloc kernel/bpf/lpm_trie.c:290 [inline] trie_update_elem+0x1cb/0xc00 kernel/bpf/lpm_trie.c:332 bpf_map_update_value+0x5d7/0x6c0 kernel/bpf/syscall.c:221 map_update_elem+0x6a0/0x7c0 kernel/bpf/syscall.c:1185 __sys_bpf+0x2fd/0x670 kernel/bpf/syscall.c:4639 __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 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&trie->lock); lock(lock); lock(&trie->lock); lock(lock); *** DEADLOCK *** 2 locks held by syz.3.1595/8189: #0: ffffffff8c91fb20 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:311 #1: ffff8880239c85b8 (&trie->lock){..-.}-{2:2}, at: trie_update_elem+0xc5/0xc00 kernel/bpf/lpm_trie.c:323 stack backtrace: CPU: 1 PID: 8189 Comm: syz.3.1595 Not tainted 5.15.164-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/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 local_lock_acquire+0x23/0x130 include/linux/local_lock_internal.h:29 rmqueue_pcplist mm/page_alloc.c:3652 [inline] rmqueue mm/page_alloc.c:3690 [inline] get_page_from_freelist+0x27cc/0x33c0 mm/page_alloc.c:4156 __alloc_pages+0x272/0x700 mm/page_alloc.c:5423 __alloc_pages_node include/linux/gfp.h:570 [inline] alloc_pages_node include/linux/gfp.h:584 [inline] kmalloc_large_node+0x7c/0x180 mm/slub.c:4421 __kmalloc_node+0x22d/0x390 mm/slub.c:4437 kmalloc_node include/linux/slab.h:614 [inline] bpf_map_kmalloc_node+0xdb/0x160 kernel/bpf/syscall.c:430 lpm_trie_node_alloc kernel/bpf/lpm_trie.c:290 [inline] trie_update_elem+0x1cb/0xc00 kernel/bpf/lpm_trie.c:332 bpf_map_update_value+0x5d7/0x6c0 kernel/bpf/syscall.c:221 map_update_elem+0x6a0/0x7c0 kernel/bpf/syscall.c:1185 __sys_bpf+0x2fd/0x670 kernel/bpf/syscall.c:4639 __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 RIP: 0033:0x7fb33806e299 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:00007fb3364ed048 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007fb3381fcf80 RCX: 00007fb33806e299 RDX: 0000000000000020 RSI: 0000000020000000 RDI: 0000000000000002 RBP: 00007fb3380db8e6 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fb3381fcf80 R15: 00007ffd98ebe328