syzbot


possible deadlock in get_partial_node

Status: upstream: reported on 2024/05/22 07:35
Subsystems: bpf
[Documentation on labels]
Reported-by: syzbot+9045c0a3d5a7f1b119f7@syzkaller.appspotmail.com
First crash: 143d, last: 48d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bpf?] possible deadlock in get_partial_node 0 (1) 2024/05/22 07:35
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in get_partial_node 1 111d 111d 0/3 auto-obsoleted due to no activity on 2024/09/26 19:17

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.10.0-rc7-syzkaller-00003-g4376e966ecb7 #0 Not tainted
------------------------------------------------------
syz.3.2069/15008 is trying to acquire lock:
ffff88801544e6d8 (&n->list_lock){-.-.}-{2:2}, at: get_partial_node.part.0+0x20/0x350 mm/slub.c:2676

but task is already holding lock:
ffff88802dcc89f8 (&trie->lock){-.-.}-{2:2}, at: trie_update_elem+0xc8/0xe00 kernel/bpf/lpm_trie.c:333

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&trie->lock){-.-.}-{2:2}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162
       trie_delete_elem+0xb0/0x820 kernel/bpf/lpm_trie.c:462
       ___bpf_prog_run+0x3e51/0xabd0 kernel/bpf/core.c:2011
       __bpf_prog_run32+0xc1/0x100 kernel/bpf/core.c:2252
       bpf_dispatcher_nop_func include/linux/bpf.h:1243 [inline]
       __bpf_prog_run include/linux/filter.h:691 [inline]
       bpf_prog_run include/linux/filter.h:698 [inline]
       __bpf_trace_run kernel/trace/bpf_trace.c:2403 [inline]
       bpf_trace_run2+0x231/0x590 kernel/trace/bpf_trace.c:2444
       __bpf_trace_contention_end+0xca/0x110 include/trace/events/lock.h:122
       trace_contention_end.constprop.0+0xea/0x170 include/trace/events/lock.h:122
       __pv_queued_spin_lock_slowpath+0x28e/0xcc0 kernel/locking/qspinlock.c:557
       pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:584 [inline]
       queued_spin_lock_slowpath arch/x86/include/asm/qspinlock.h:51 [inline]
       queued_spin_lock include/asm-generic/qspinlock.h:114 [inline]
       do_raw_spin_lock+0x210/0x2c0 kernel/locking/spinlock_debug.c:116
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline]
       _raw_spin_lock_irqsave+0x42/0x60 kernel/locking/spinlock.c:162
       __put_partials+0xc3/0x170 mm/slub.c:2975
       qlink_free mm/kasan/quarantine.c:163 [inline]
       qlist_free_all+0x4e/0x140 mm/kasan/quarantine.c:179
       kasan_quarantine_reduce+0x192/0x1e0 mm/kasan/quarantine.c:286
       __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:322
       kasan_slab_alloc include/linux/kasan.h:201 [inline]
       slab_post_alloc_hook mm/slub.c:3940 [inline]
       slab_alloc_node mm/slub.c:4002 [inline]
       kmem_cache_alloc_node_noprof+0x153/0x310 mm/slub.c:4045
       __alloc_skb+0x2b1/0x380 net/core/skbuff.c:656
       alloc_skb include/linux/skbuff.h:1308 [inline]
       netlink_alloc_large_skb+0x69/0x130 net/netlink/af_netlink.c:1210
       netlink_sendmsg+0x689/0xd70 net/netlink/af_netlink.c:1880
       sock_sendmsg_nosec net/socket.c:730 [inline]
       __sock_sendmsg net/socket.c:745 [inline]
       ____sys_sendmsg+0xab5/0xc90 net/socket.c:2585
       ___sys_sendmsg+0x135/0x1e0 net/socket.c:2639
       __sys_sendmsg+0x117/0x1f0 net/socket.c:2668
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&n->list_lock){-.-.}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain kernel/locking/lockdep.c:3869 [inline]
       __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137
       lock_acquire kernel/locking/lockdep.c:5754 [inline]
       lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162
       get_partial_node.part.0+0x20/0x350 mm/slub.c:2676
       get_partial_node mm/slub.c:2673 [inline]
       get_partial mm/slub.c:2790 [inline]
       ___slab_alloc+0x65b/0x1870 mm/slub.c:3647
       __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3757
       __slab_alloc_node mm/slub.c:3810 [inline]
       slab_alloc_node mm/slub.c:3990 [inline]
       __do_kmalloc_node mm/slub.c:4122 [inline]
       __kmalloc_node_noprof+0x35c/0x440 mm/slub.c:4130
       kmalloc_node_noprof include/linux/slab.h:681 [inline]
       bpf_map_kmalloc_node+0x98/0x4a0 kernel/bpf/syscall.c:422
       lpm_trie_node_alloc kernel/bpf/lpm_trie.c:299 [inline]
       trie_update_elem+0x1ef/0xe00 kernel/bpf/lpm_trie.c:342
       bpf_map_update_value+0x2c1/0x6c0 kernel/bpf/syscall.c:203
       map_update_elem+0x623/0x910 kernel/bpf/syscall.c:1654
       __sys_bpf+0x90c/0x49a0 kernel/bpf/syscall.c:5676
       __do_sys_bpf kernel/bpf/syscall.c:5795 [inline]
       __se_sys_bpf kernel/bpf/syscall.c:5793 [inline]
       __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5793
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

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.2069/15008:
 #0: ffffffff8dbb1620 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:329 [inline]
 #0: ffffffff8dbb1620 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:781 [inline]
 #0: ffffffff8dbb1620 (rcu_read_lock){....}-{1:2}, at: bpf_map_update_value+0x24b/0x6c0 kernel/bpf/syscall.c:202
 #1: ffff88802dcc89f8 (&trie->lock){-.-.}-{2:2}, at: trie_update_elem+0xc8/0xe00 kernel/bpf/lpm_trie.c:333

stack backtrace:
CPU: 0 PID: 15008 Comm: syz.3.2069 Not tainted 6.10.0-rc7-syzkaller-00003-g4376e966ecb7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114
 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2187
 check_prev_add kernel/locking/lockdep.c:3134 [inline]
 check_prevs_add kernel/locking/lockdep.c:3253 [inline]
 validate_chain kernel/locking/lockdep.c:3869 [inline]
 __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137
 lock_acquire kernel/locking/lockdep.c:5754 [inline]
 lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5719
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x3a/0x60 kernel/locking/spinlock.c:162
 get_partial_node.part.0+0x20/0x350 mm/slub.c:2676
 get_partial_node mm/slub.c:2673 [inline]
 get_partial mm/slub.c:2790 [inline]
 ___slab_alloc+0x65b/0x1870 mm/slub.c:3647
 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3757
 __slab_alloc_node mm/slub.c:3810 [inline]
 slab_alloc_node mm/slub.c:3990 [inline]
 __do_kmalloc_node mm/slub.c:4122 [inline]
 __kmalloc_node_noprof+0x35c/0x440 mm/slub.c:4130
 kmalloc_node_noprof include/linux/slab.h:681 [inline]
 bpf_map_kmalloc_node+0x98/0x4a0 kernel/bpf/syscall.c:422
 lpm_trie_node_alloc kernel/bpf/lpm_trie.c:299 [inline]
 trie_update_elem+0x1ef/0xe00 kernel/bpf/lpm_trie.c:342
 bpf_map_update_value+0x2c1/0x6c0 kernel/bpf/syscall.c:203
 map_update_elem+0x623/0x910 kernel/bpf/syscall.c:1654
 __sys_bpf+0x90c/0x49a0 kernel/bpf/syscall.c:5676
 __do_sys_bpf kernel/bpf/syscall.c:5795 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5793 [inline]
 __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5793
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc132b75bd9
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:00007fc1339d5048 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fc132d03f60 RCX: 00007fc132b75bd9
RDX: 0000000000000020 RSI: 00000000200004c0 RDI: 0000000000000002
RBP: 00007fc132be4e60 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fc132d03f60 R15: 00007ffc92258018
 </TASK>

Crashes (18):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/09 04:12 upstream 4376e966ecb7 bc23a442 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in get_partial_node
2024/06/24 10:22 upstream f2661062f16b edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in get_partial_node
2024/06/17 07:01 upstream 2ccbdf43d5e7 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in get_partial_node
2024/06/15 11:26 upstream 2ccbdf43d5e7 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in get_partial_node
2024/06/11 16:14 upstream 83a7eefedc9b c7d7d815 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in get_partial_node
2024/06/03 13:02 upstream c3f38fa61af7 0aba2352 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in get_partial_node
2024/06/02 02:48 upstream cc8ed4d0a848 3113787f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in get_partial_node
2024/05/29 21:34 upstream 4a4be1ad3a6e 34889ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in get_partial_node
2024/08/08 06:54 upstream 6a0e38264012 de12cf65 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in get_partial_node
2024/05/29 20:20 upstream 4a4be1ad3a6e c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in get_partial_node
2024/06/17 05:53 bpf 36534d3c5453 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce possible deadlock in get_partial_node
2024/06/15 21:50 bpf 36534d3c5453 f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce possible deadlock in get_partial_node
2024/05/31 08:02 net 068648aab72c 34889ee3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in get_partial_node
2024/08/20 23:24 bpf-next 01ac89d0a5c2 9f0ab3fb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce possible deadlock in get_partial_node
2024/08/16 02:08 bpf-next 35ec1cdfc3fe e4bacdaf .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce possible deadlock in get_partial_node
2024/05/18 15:34 net-next 4b377b4868ef c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in get_partial_node
2024/05/18 09:31 net-next 4b377b4868ef c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in get_partial_node
2024/05/18 07:31 net-next 4b377b4868ef c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in get_partial_node
* Struck through repros no longer work on HEAD.