syzbot


possible deadlock in deactivate_slab

Status: auto-obsoleted due to no activity on 2024/08/12 06:47
Reported-by: syzbot+f1f21e662614c1055006@syzkaller.appspotmail.com
First crash: 216d, last: 216d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in deactivate_slab bpf 2 134d 182d 0/28 auto-obsoleted due to no activity on 2024/11/02 09:45

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.90-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.1/7188 is trying to acquire lock:
ffff888140000d98 (&n->list_lock){-.-.}-{2:2}, at: deactivate_slab+0x233/0x4a0 mm/slub.c:2489

but task is already holding lock:
ffff88805ae18a38 (&trie->lock){-.-.}-{2:2}, at: trie_update_elem+0xc5/0xc00 kernel/bpf/lpm_trie.c:324

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:451
       0xffffffffa0001fdd
       bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline]
       __bpf_prog_run include/linux/filter.h:603 [inline]
       bpf_prog_run include/linux/filter.h:610 [inline]
       __bpf_trace_run kernel/trace/bpf_trace.c:2273 [inline]
       bpf_trace_run2+0x1fd/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]
       slab_alloc mm/slub.c:3406 [inline]
       __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
       kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422
       mt_alloc_one lib/maple_tree.c:152 [inline]
       mas_alloc_nodes+0x276/0x800 lib/maple_tree.c:1277
       mas_node_count_gfp lib/maple_tree.c:1359 [inline]
       mas_preallocate+0x12d/0x350 lib/maple_tree.c:5805
       mmap_region+0x1439/0x1fa0 mm/mmap.c:2821
       do_mmap+0x8c5/0xf60 mm/mmap.c:1425
       vm_mmap_pgoff+0x1ca/0x2d0 mm/util.c:520
       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
       deactivate_slab+0x233/0x4a0 mm/slub.c:2489
       ___slab_alloc+0x575/0x1270 mm/slub.c:3147
       __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:954 [inline]
       __kmalloc_node+0xa2/0x230 mm/slab_common.c:962
       kmalloc_node include/linux/slab.h:582 [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+0x1cb/0xc00 kernel/bpf/lpm_trie.c:333
       bpf_map_update_value+0x5cf/0x6f0 kernel/bpf/syscall.c:226
       map_update_elem+0x503/0x680 kernel/bpf/syscall.c:1448
       __sys_bpf+0x337/0x6c0 kernel/bpf/syscall.c:4993
       __do_sys_bpf kernel/bpf/syscall.c:5109 [inline]
       __se_sys_bpf kernel/bpf/syscall.c:5107 [inline]
       __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5107
       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-executor.1/7188:
 #0: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
 #0: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
 #0: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: bpf_map_update_value+0x207/0x6f0 kernel/bpf/syscall.c:225
 #1: ffff88805ae18a38 (&trie->lock){-.-.}-{2:2}, at: trie_update_elem+0xc5/0xc00 kernel/bpf/lpm_trie.c:324

stack backtrace:
CPU: 0 PID: 7188 Comm: syz-executor.1 Not tainted 6.1.90-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/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
 deactivate_slab+0x233/0x4a0 mm/slub.c:2489
 ___slab_alloc+0x575/0x1270 mm/slub.c:3147
 __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:954 [inline]
 __kmalloc_node+0xa2/0x230 mm/slab_common.c:962
 kmalloc_node include/linux/slab.h:582 [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+0x1cb/0xc00 kernel/bpf/lpm_trie.c:333
 bpf_map_update_value+0x5cf/0x6f0 kernel/bpf/syscall.c:226
 map_update_elem+0x503/0x680 kernel/bpf/syscall.c:1448
 __sys_bpf+0x337/0x6c0 kernel/bpf/syscall.c:4993
 __do_sys_bpf kernel/bpf/syscall.c:5109 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5107 [inline]
 __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5107
 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:0x7f1e8c27dca9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f1e8d02c0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f1e8c3abf80 RCX: 00007f1e8c27dca9
RDX: 0000000000000020 RSI: 0000000020000300 RDI: 0000000000000002
RBP: 00007f1e8c2c947e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f1e8c3abf80 R15: 00007ffc34776408
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/04 06:46 linux-6.1.y 909ba1f1b414 610f2a54 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in deactivate_slab
* Struck through repros no longer work on HEAD.