============================================ WARNING: possible recursive locking detected 5.15.173-syzkaller #0 Not tainted -------------------------------------------- syz.0.13/4284 is trying to acquire lock: ffff88807ce7c9b8 (&trie->lock){....}-{2:2}, at: trie_delete_elem+0x90/0x690 kernel/bpf/lpm_trie.c:450 but task is already holding lock: ffff88807ce7c9b8 (&trie->lock){....}-{2:2}, at: trie_delete_elem+0x90/0x690 kernel/bpf/lpm_trie.c:450 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&trie->lock); lock(&trie->lock); *** DEADLOCK *** May be due to missing lock nesting notation 6 locks held by syz.0.13/4284: #0: ffff888078ffb4f0 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x2cb/0x380 fs/file.c:1057 #1: ffff8880607da460 (sb_writers#3){.+.+}-{0:0}, at: vfs_write+0x29a/0xe50 fs/read_write.c:590 #2: ffff88801f8e9520 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline] #2: ffff88801f8e9520 (&sb->s_type->i_mutex_key#8){++++}-{3:3}, at: generic_file_write_iter+0x7c/0x1b0 mm/filemap.c:3941 #3: ffffffff8c91fc60 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:311 #4: ffff88807ce7c9b8 (&trie->lock){....}-{2:2}, at: trie_delete_elem+0x90/0x690 kernel/bpf/lpm_trie.c:450 #5: ffffffff8c91fc60 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:311 stack backtrace: CPU: 0 PID: 4284 Comm: syz.0.13 Not tainted 5.15.173-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 print_deadlock_bug kernel/locking/lockdep.c:2946 [inline] check_deadlock kernel/locking/lockdep.c:2989 [inline] validate_chain+0x46d2/0x5930 kernel/locking/lockdep.c:3775 __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/0x3d0 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:1878 [inline] bpf_trace_run4+0x1ea/0x390 kernel/trace/bpf_trace.c:1917 __bpf_trace_mm_page_alloc+0xba/0xe0 include/trace/events/kmem.h:201 trace_mm_page_alloc include/trace/events/kmem.h:201 [inline] __alloc_pages+0x6e0/0x700 mm/page_alloc.c:5486 stack_depot_save+0x319/0x440 lib/stackdepot.c:302 save_stack+0x104/0x1e0 mm/page_owner.c:120 __set_page_owner+0x37/0x300 mm/page_owner.c:181 prep_new_page mm/page_alloc.c:2426 [inline] get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192 __alloc_pages+0x272/0x700 mm/page_alloc.c:5464 stack_depot_save+0x319/0x440 lib/stackdepot.c:302 kasan_save_stack+0x4d/0x60 mm/kasan/common.c:40 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348 kvfree_call_rcu+0x118/0x8a0 kernel/rcu/tree.c:3596 trie_delete_elem+0x520/0x690 bpf_prog_2e5e7763945ac34e+0x3c/0x3d0 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:1878 [inline] bpf_trace_run4+0x1ea/0x390 kernel/trace/bpf_trace.c:1917 __bpf_trace_mm_page_alloc+0xba/0xe0 include/trace/events/kmem.h:201 trace_mm_page_alloc include/trace/events/kmem.h:201 [inline] __alloc_pages+0x6e0/0x700 mm/page_alloc.c:5486 alloc_pages_vma+0x39a/0x800 mm/mempolicy.c:2146 shmem_alloc_page mm/shmem.c:1588 [inline] shmem_alloc_and_acct_page+0x4d1/0xd10 mm/shmem.c:1613 shmem_getpage_gfp+0x17b1/0x3190 mm/shmem.c:1908 shmem_getpage mm/shmem.c:151 [inline] shmem_write_begin+0xce/0x1a0 mm/shmem.c:2479 generic_perform_write+0x2bf/0x5b0 mm/filemap.c:3785 __generic_file_write_iter+0x243/0x4f0 mm/filemap.c:3912 generic_file_write_iter+0xa7/0x1b0 mm/filemap.c:3944 call_write_iter include/linux/fs.h:2174 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xacd/0xe50 fs/read_write.c:594 ksys_write+0x1a2/0x2c0 fs/read_write.c:647 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:0x7fbad59c9759 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:00007fbad3e41038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fbad5b80f80 RCX: 00007fbad59c9759 RDX: 00000000fffffdef RSI: 0000000020000140 RDI: 0000000000000005 RBP: 00007fbad5a3c75e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fbad5b80f80 R15: 00007fff613c11f8