syzbot


possible deadlock in get_partial_node (2)

Status: upstream: reported on 2024/12/19 03:24
Reported-by: syzbot+3d80debb66cbd75ea2a0@syzkaller.appspotmail.com
First crash: 2d22h, last: 2d22h
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in get_partial_node 1 186d 186d 0/3 auto-obsoleted due to no activity on 2024/09/26 19:17
upstream possible deadlock in get_partial_node bpf 19 66d 213d 0/28 upstream: reported on 2024/05/22 07:35

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.120-syzkaller-00773-g52f863f820fd #0 Tainted: G        W         
------------------------------------------------------
syz.3.302/5273 is trying to acquire lock:
ffff888017c43318 (&n->list_lock){-.-.}-{2:2}, at: get_partial_node+0x36/0x450 mm/slub.c:2210

but task is already holding lock:
ffff88807b388a38 (&trie->lock){..-.}-{2:2}, at: trie_update_elem+0xc7/0xdd0 kernel/bpf/lpm_trie.c:335

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&trie->lock){..-.}-{2:2}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __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:467
       bpf_prog_682b67a395ac5c66+0xa/0x12
       bpf_dispatcher_nop_func include/linux/bpf.h:992 [inline]
       __bpf_prog_run include/linux/filter.h:596 [inline]
       bpf_prog_run include/linux/filter.h:610 [inline]
       __bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline]
       bpf_trace_run2+0x361/0x410 kernel/trace/bpf_trace.c:2312
       trace_contention_end+0x14c/0x190 include/trace/events/lock.h:122
       __pv_queued_spin_lock_slowpath+0x935/0xc50 kernel/locking/qspinlock.c:560
       pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:591 [inline]
       queued_spin_lock_slowpath+0x42/0x50 arch/x86/include/asm/qspinlock.h:51
       queued_spin_lock include/asm-generic/qspinlock.h:114 [inline]
       do_raw_spin_lock+0x269/0x370 kernel/locking/spinlock_debug.c:115
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline]
       _raw_spin_lock_irqsave+0xdd/0x120 kernel/locking/spinlock.c:162
       __unfreeze_partials+0x97/0x210 mm/slub.c:2550
       put_cpu_partial+0x17b/0x250 mm/slub.c:2662
       qlink_free mm/kasan/quarantine.c:168 [inline]
       qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
       kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294
       __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305
       kasan_slab_alloc include/linux/kasan.h:201 [inline]
       slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
       slab_alloc_node mm/slub.c:3398 [inline]
       __kmem_cache_alloc_node+0x137/0x260 mm/slub.c:3437
       kmalloc_node_trace+0x23/0xe0 mm/slab_common.c:1039
       kmalloc_node include/linux/slab.h:585 [inline]
       kzalloc_node include/linux/slab.h:710 [inline]
       __get_vm_area_node+0x126/0x360 mm/vmalloc.c:2498
       __vmalloc_node_range+0x37d/0x14b0 mm/vmalloc.c:3193
       __vmalloc_node mm/vmalloc.c:3298 [inline]
       __vmalloc+0x75/0x80 mm/vmalloc.c:3312
       bpf_prog_alloc_no_stats+0x34/0x3f0 kernel/bpf/core.c:92
       bpf_prog_alloc+0x1c/0x1b0 kernel/bpf/core.c:130
       bpf_prog_load+0x803/0x1bb0 kernel/bpf/syscall.c:2592
       __sys_bpf+0x382/0x6c0 kernel/bpf/syscall.c:5020
       __do_sys_bpf kernel/bpf/syscall.c:5124 [inline]
       __se_sys_bpf kernel/bpf/syscall.c:5122 [inline]
       __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5122
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (&n->list_lock){-.-.}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
       get_partial_node+0x36/0x450 mm/slub.c:2210
       get_partial mm/slub.c:2325 [inline]
       ___slab_alloc+0x9b2/0x1270 mm/slub.c:3175
       __slab_alloc mm/slub.c:3279 [inline]
       slab_alloc_node mm/slub.c:3364 [inline]
       __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
       __do_kmalloc_node mm/slab_common.c:935 [inline]
       __kmalloc_node+0xa2/0x230 mm/slab_common.c:943
       kmalloc_node include/linux/slab.h:589 [inline]
       bpf_map_kmalloc_node+0xce/0x1c0 kernel/bpf/syscall.c:452
       lpm_trie_node_alloc kernel/bpf/lpm_trie.c:291 [inline]
       trie_update_elem+0x176/0xdd0 kernel/bpf/lpm_trie.c:338
       bpf_map_update_value+0x5cf/0x6f0 kernel/bpf/syscall.c:226
       map_update_elem+0x503/0x680 kernel/bpf/syscall.c:1463
       __sys_bpf+0x337/0x6c0 kernel/bpf/syscall.c:5008
       __do_sys_bpf kernel/bpf/syscall.c:5124 [inline]
       __se_sys_bpf kernel/bpf/syscall.c:5122 [inline]
       __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5122
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&trie->lock);
                               lock(&n->list_lock);
                               lock(&trie->lock);
  lock(&n->list_lock);

 *** DEADLOCK ***

2 locks held by syz.3.302/5273:
 #0: ffffffff8d32b080 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
 #0: ffffffff8d32b080 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
 #0: ffffffff8d32b080 (rcu_read_lock){....}-{1:2}, at: bpf_map_update_value+0x207/0x6f0 kernel/bpf/syscall.c:225
 #1: ffff88807b388a38 (&trie->lock){..-.}-{2:2}, at: trie_update_elem+0xc7/0xdd0 kernel/bpf/lpm_trie.c:335

stack backtrace:
CPU: 1 PID: 5273 Comm: syz.3.302 Tainted: G        W          6.1.120-syzkaller-00773-g52f863f820fd #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/25/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
 get_partial_node+0x36/0x450 mm/slub.c:2210
 get_partial mm/slub.c:2325 [inline]
 ___slab_alloc+0x9b2/0x1270 mm/slub.c:3175
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:935 [inline]
 __kmalloc_node+0xa2/0x230 mm/slab_common.c:943
 kmalloc_node include/linux/slab.h:589 [inline]
 bpf_map_kmalloc_node+0xce/0x1c0 kernel/bpf/syscall.c:452
 lpm_trie_node_alloc kernel/bpf/lpm_trie.c:291 [inline]
 trie_update_elem+0x176/0xdd0 kernel/bpf/lpm_trie.c:338
 bpf_map_update_value+0x5cf/0x6f0 kernel/bpf/syscall.c:226
 map_update_elem+0x503/0x680 kernel/bpf/syscall.c:1463
 __sys_bpf+0x337/0x6c0 kernel/bpf/syscall.c:5008
 __do_sys_bpf kernel/bpf/syscall.c:5124 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5122 [inline]
 __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5122
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fd75f585d29
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:00007fd76043f038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fd75f775fa0 RCX: 00007fd75f585d29
RDX: 0000000000000020 RSI: 00000000200004c0 RDI: 0000000000000002
RBP: 00007fd75f601a20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fd75f775fa0 R15: 00007ffd94a448f8
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/19 03:23 linux-6.1.y 52f863f820fd 1432fc84 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in get_partial_node
* Struck through repros no longer work on HEAD.