[v5.15] possible deadlock in trie_update_elem

0 views
Skip to first unread message

syzbot

unread,
Mar 19, 2024, 8:15:32 AMMar 19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: b95c01af2113 Linux 5.15.152
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=12790ac9180000
kernel config: https://syzkaller.appspot.com/x/.config?x=b26cb65e5b8ad5c7
dashboard link: https://syzkaller.appspot.com/bug?extid=02f80c2ffc3d585f9512
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/5cd4262a21bb/disk-b95c01af.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/85698e4f8310/vmlinux-b95c01af.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f57a616768d4/bzImage-b95c01af.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+02f80c...@syzkaller.appspotmail.com

ODEBUG: Out of memory. ODEBUG disabled
======================================================
WARNING: possible circular locking dependency detected
5.15.152-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.0/27146 is trying to acquire lock:
ffffffff8c7fbf78 ((console_sem).lock){-.-.}-{2:2}, at: down_trylock+0x1c/0xa0 kernel/locking/semaphore.c:138

but task is already holding lock:
ffff88805043bdb8 (&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:

-> #3 (&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
0xffffffffa002ad7a
bpf_dispatcher_nop_func include/linux/bpf.h:780 [inline]
__bpf_prog_run include/linux/filter.h:625 [inline]
bpf_prog_run include/linux/filter.h:632 [inline]
__bpf_trace_run kernel/trace/bpf_trace.c:1880 [inline]
bpf_trace_run2+0x19e/0x340 kernel/trace/bpf_trace.c:1917
trace_tlb_flush+0xed/0x110 include/trace/events/tlb.h:38
switch_mm_irqs_off+0x748/0xa30
context_switch kernel/sched/core.c:5016 [inline]
__schedule+0x1167/0x45b0 kernel/sched/core.c:6376
preempt_schedule_common+0x83/0xd0 kernel/sched/core.c:6552
preempt_schedule+0xd9/0xe0 kernel/sched/core.c:6577
preempt_schedule_thunk+0x16/0x18 arch/x86/entry/thunk_64.S:34
__raw_spin_unlock include/linux/spinlock_api_smp.h:152 [inline]
_raw_spin_unlock+0x36/0x40 kernel/locking/spinlock.c:186
spin_unlock include/linux/spinlock.h:403 [inline]
copy_pte_range mm/memory.c:1095 [inline]
copy_pmd_range mm/memory.c:1156 [inline]
copy_pud_range mm/memory.c:1193 [inline]
copy_p4d_range mm/memory.c:1217 [inline]
copy_page_range+0x3679/0x43b0 mm/memory.c:1290
dup_mmap kernel/fork.c:614 [inline]
dup_mm kernel/fork.c:1465 [inline]
copy_mm+0xc64/0x1370 kernel/fork.c:1517
copy_process+0x1816/0x3ef0 kernel/fork.c:2206
kernel_clone+0x210/0x960 kernel/fork.c:2604
__do_sys_clone kernel/fork.c:2721 [inline]
__se_sys_clone kernel/fork.c:2705 [inline]
__x64_sys_clone+0x23f/0x290 kernel/fork.c:2705
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb

-> #2 (&rq->__lock){-.-.}-{2:2}:
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
_raw_spin_lock_nested+0x2d/0x40 kernel/locking/spinlock.c:368
raw_spin_rq_lock_nested+0x26/0x140 kernel/sched/core.c:475
raw_spin_rq_lock kernel/sched/sched.h:1326 [inline]
rq_lock kernel/sched/sched.h:1621 [inline]
task_fork_fair+0x5d/0x350 kernel/sched/fair.c:11480
sched_cgroup_fork+0x2d3/0x330 kernel/sched/core.c:4466
copy_process+0x224a/0x3ef0 kernel/fork.c:2320
kernel_clone+0x210/0x960 kernel/fork.c:2604
kernel_thread+0x168/0x1e0 kernel/fork.c:2656
rest_init+0x21/0x330 init/main.c:703
start_kernel+0x48c/0x535 init/main.c:1137
secondary_startup_64_no_verify+0xb1/0xbb

-> #1 (&p->pi_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
try_to_wake_up+0xae/0x1300 kernel/sched/core.c:4030
up+0x6e/0x90 kernel/locking/semaphore.c:190
__up_console_sem+0x11a/0x1e0 kernel/printk/printk.c:256
console_unlock+0x1145/0x12b0 kernel/printk/printk.c:2754
vprintk_emit+0xbf/0x150 kernel/printk/printk.c:2268
_printk+0xd1/0x111 kernel/printk/printk.c:2293
set_capacity_and_notify+0x2bf/0x360 block/genhd.c:86
loop_set_size+0x44/0xa0 drivers/block/loop.c:286
loop_configure+0xf0c/0x1470 drivers/block/loop.c:1307
lo_ioctl+0x933/0x23b0
blkdev_ioctl+0x333/0x6b0 block/ioctl.c:604
block_ioctl+0xb1/0xf0 block/fops.c:493
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl+0xf1/0x160 fs/ioctl.c:860
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb

-> #0 ((console_sem).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
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
down_trylock+0x1c/0xa0 kernel/locking/semaphore.c:138
__down_trylock_console_sem+0x105/0x250 kernel/printk/printk.c:239
console_trylock kernel/printk/printk.c:2569 [inline]
console_trylock_spinning+0x8a/0x3f0 kernel/printk/printk.c:1867
vprintk_emit+0xa6/0x150 kernel/printk/printk.c:2267
_printk+0xd1/0x111 kernel/printk/printk.c:2293
debug_objects_oom+0xb4/0x370 lib/debugobjects.c:472
debug_object_activate+0x42d/0x4e0 lib/debugobjects.c:698
debug_rcu_head_queue kernel/rcu/rcu.h:176 [inline]
kvfree_call_rcu+0xb6/0x8a0 kernel/rcu/tree.c:3587
trie_update_elem+0x808/0xc00 kernel/bpf/lpm_trie.c:384
bpf_map_update_value+0x5d7/0x6c0 kernel/bpf/syscall.c:221
generic_map_update_batch+0x54d/0x8b0 kernel/bpf/syscall.c:1399
bpf_map_do_batch+0x4d0/0x620
__sys_bpf+0x55c/0x670
__do_sys_bpf kernel/bpf/syscall.c:4733 [inline]
__se_sys_bpf kernel/bpf/syscall.c:4731 [inline]
__x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4731
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb

other info that might help us debug this:

Chain exists of:
(console_sem).lock --> &rq->__lock --> &trie->lock

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&trie->lock);
lock(&rq->__lock);
lock(&trie->lock);
lock((console_sem).lock);

*** DEADLOCK ***

2 locks held by syz-executor.0/27146:
#0: ffffffff8c91f720 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:268
#1: ffff88805043bdb8 (&trie->lock){....}-{2:2}, at: trie_update_elem+0xc5/0xc00 kernel/bpf/lpm_trie.c:323

stack backtrace:
CPU: 0 PID: 27146 Comm: syz-executor.0 Not tainted 5.15.152-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb 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
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
down_trylock+0x1c/0xa0 kernel/locking/semaphore.c:138
__down_trylock_console_sem+0x105/0x250 kernel/printk/printk.c:239
console_trylock kernel/printk/printk.c:2569 [inline]
console_trylock_spinning+0x8a/0x3f0 kernel/printk/printk.c:1867
vprintk_emit+0xa6/0x150 kernel/printk/printk.c:2267
_printk+0xd1/0x111 kernel/printk/printk.c:2293
debug_objects_oom+0xb4/0x370 lib/debugobjects.c:472
debug_object_activate+0x42d/0x4e0 lib/debugobjects.c:698
debug_rcu_head_queue kernel/rcu/rcu.h:176 [inline]
kvfree_call_rcu+0xb6/0x8a0 kernel/rcu/tree.c:3587
trie_update_elem+0x808/0xc00 kernel/bpf/lpm_trie.c:384
bpf_map_update_value+0x5d7/0x6c0 kernel/bpf/syscall.c:221
generic_map_update_batch+0x54d/0x8b0 kernel/bpf/syscall.c:1399
bpf_map_do_batch+0x4d0/0x620
__sys_bpf+0x55c/0x670
__do_sys_bpf kernel/bpf/syscall.c:4733 [inline]
__se_sys_bpf kernel/bpf/syscall.c:4731 [inline]
__x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4731
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f92b061dda9
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:00007f92aeb9e0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f92b074bf80 RCX: 00007f92b061dda9
RDX: 0000000000000038 RSI: 0000000020000000 RDI: 000000000000001a
RBP: 00007f92b066a47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f92b074bf80 R15: 00007ffd9c4ddc38
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Mar 31, 2024, 5:59:17 AMMar 31
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 9465fef4ae35 Linux 5.15.153
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14e4903d180000
kernel config: https://syzkaller.appspot.com/x/.config?x=176c746ee3348b33
dashboard link: https://syzkaller.appspot.com/bug?extid=02f80c2ffc3d585f9512
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=164c65c6180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1252025e180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/741f29d5f449/disk-9465fef4.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/66645f341114/vmlinux-9465fef4.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f7d21e0c9e19/bzImage-9465fef4.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+02f80c...@syzkaller.appspotmail.com

======================================================
WARNING: possible circular locking dependency detected
5.15.153-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor146/3513 is trying to acquire lock:
ffff8880b9a35ca8 (lock){..-.}-{2:2}, at: local_lock_acquire+0x7/0x130 include/linux/local_lock_internal.h:28

but task is already holding lock:
ffff88801fe44db8 (&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
0xffffffffa0018bea
bpf_dispatcher_nop_func include/linux/bpf.h:785 [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
__traceiter_mm_page_free_batched+0x1e/0x30 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
tlb_batch_pages_flush mm/mmu_gather.c:49 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:240 [inline]
tlb_flush_mmu mm/mmu_gather.c:247 [inline]
tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:338
exit_mmap+0x3cd/0x670 mm/mmap.c:3188
__mmput+0x112/0x3b0 kernel/fork.c:1126
exit_mm+0x688/0x7f0 kernel/exit.c:548
do_exit+0x626/0x2480 kernel/exit.c:859
do_group_exit+0x144/0x310 kernel/exit.c:994
__do_sys_exit_group kernel/exit.c:1005 [inline]
__se_sys_exit_group kernel/exit.c:1003 [inline]
__x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1003
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb

-> #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:5421
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
__kmalloc_node+0x1fa/0x390 mm/slub.c:4451
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+0x857/0xc00 kernel/bpf/lpm_trie.c:399
bpf_map_update_value+0x5d7/0x6c0 kernel/bpf/syscall.c:221
generic_map_update_batch+0x54d/0x8b0 kernel/bpf/syscall.c:1421
bpf_map_do_batch+0x4d0/0x620
__sys_bpf+0x55c/0x670
__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+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb

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-executor146/3513:
#0: ffffffff8c91f720 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:311
#1: ffff88801fe44db8 (&trie->lock){....}-{2:2}, at: trie_update_elem+0xc5/0xc00 kernel/bpf/lpm_trie.c:323

stack backtrace:
CPU: 0 PID: 3513 Comm: syz-executor146 Not tainted 5.15.153-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+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:5421
alloc_slab_page mm/slub.c:1775 [inline]
allocate_slab mm/slub.c:1912 [inline]
new_slab+0xbb/0x4b0 mm/slub.c:1975
___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
__slab_alloc mm/slub.c:3095 [inline]
slab_alloc_node mm/slub.c:3186 [inline]
__kmalloc_node+0x1fa/0x390 mm/slub.c:4451
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+0x857/0xc00 kernel/bpf/lpm_trie.c:399
bpf_map_update_value+0x5d7/0x6c0 kernel/bpf/syscall.c:221
generic_map_update_batch+0x54d/0x8b0 kernel/bpf/syscall.c:1421
bpf_map_do_batch+0x4d0/0x620
__sys_bpf+0x55c/0x670
__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+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f405dcc5d69
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 c1 17 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffdd0fd2fc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f405dcc5d69
RDX: 0000000000000038 RSI: 0000000020000240 RDI: 000000000000001a
RBP: 0000000000000000 R08: 00000000000000a0 R09: 00000000000000a0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

syzbot

unread,
Apr 4, 2024, 7:38:27 AMApr 4
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 347385861c50 Linux 6.1.84
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16a9968d180000
kernel config: https://syzkaller.appspot.com/x/.config?x=40dfd13b04bfc094
dashboard link: https://syzkaller.appspot.com/bug?extid=71d4df074d6dbe9f4799
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/73d2a8622b6e/disk-34738586.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e7bc2e0101a7/vmlinux-34738586.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7b96d1168608/bzImage-34738586.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+71d4df...@syzkaller.appspotmail.com

======================================================
WARNING: possible circular locking dependency detected
6.1.84-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.1/4025 is trying to acquire lock:
ffffffff91faa430 (&obj_hash[i].lock){-.-.}-{2:2}, at: debug_object_activate+0x68/0x4e0 lib/debugobjects.c:697

but task is already holding lock:
ffff888076f70a38 (&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
0xffffffffa0001b32
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
debug_object_activate+0x68/0x4e0 lib/debugobjects.c:697
debug_rcu_head_queue kernel/rcu/rcu.h:189 [inline]
kvfree_call_rcu+0xb4/0x8c0 kernel/rcu/tree.c:3391
cfg80211_update_known_bss+0x16b/0x9e0
cfg80211_bss_update+0x187/0x21e0 net/wireless/scan.c:1773
cfg80211_inform_single_bss_frame_data net/wireless/scan.c:2434 [inline]
cfg80211_inform_bss_frame_data+0xae4/0x1680 net/wireless/scan.c:2467
ieee80211_bss_info_update+0x847/0xf00 net/mac80211/scan.c:190
ieee80211_rx_bss_info net/mac80211/ibss.c:1120 [inline]
ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1609 [inline]
ieee80211_ibss_rx_queued_mgmt+0x1962/0x2dd0 net/mac80211/ibss.c:1638
ieee80211_iface_process_skb net/mac80211/iface.c:1632 [inline]
ieee80211_iface_work+0x7aa/0xce0 net/mac80211/iface.c:1686
process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
kthread+0x28d/0x320 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:307

-> #0 (&obj_hash[i].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
debug_object_activate+0x68/0x4e0 lib/debugobjects.c:697
debug_rcu_head_queue kernel/rcu/rcu.h:189 [inline]
kvfree_call_rcu+0xb4/0x8c0 kernel/rcu/tree.c:3391
trie_update_elem+0x808/0xc00 kernel/bpf/lpm_trie.c:385
bpf_map_update_value+0x5cf/0x6f0 kernel/bpf/syscall.c:226
generic_map_update_batch+0x579/0x920 kernel/bpf/syscall.c:1684
bpf_map_do_batch+0x4d0/0x620
__sys_bpf+0x658/0x6c0
__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+0x3d/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&trie->lock);
lock(&obj_hash[i].lock);
lock(&trie->lock);
lock(&obj_hash[i].lock);

*** DEADLOCK ***

2 locks held by syz-executor.1/4025:
#0: ffffffff8d12a980 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
#0: ffffffff8d12a980 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
#0: ffffffff8d12a980 (rcu_read_lock){....}-{1:2}, at: bpf_map_update_value+0x207/0x6f0 kernel/bpf/syscall.c:225
#1: ffff888076f70a38 (&trie->lock){-.-.}-{2:2}, at: trie_update_elem+0xc5/0xc00 kernel/bpf/lpm_trie.c:324

stack backtrace:
CPU: 0 PID: 4025 Comm: syz-executor.1 Not tainted 6.1.84-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
debug_object_activate+0x68/0x4e0 lib/debugobjects.c:697
debug_rcu_head_queue kernel/rcu/rcu.h:189 [inline]
kvfree_call_rcu+0xb4/0x8c0 kernel/rcu/tree.c:3391
trie_update_elem+0x808/0xc00 kernel/bpf/lpm_trie.c:385
bpf_map_update_value+0x5cf/0x6f0 kernel/bpf/syscall.c:226
generic_map_update_batch+0x579/0x920 kernel/bpf/syscall.c:1684
bpf_map_do_batch+0x4d0/0x620
__sys_bpf+0x658/0x6c0
__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+0x3d/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fef8107de69
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:00007fef81e9b0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fef811abf80 RCX: 00007fef8107de69
RDX: 0000000000000038 RSI: 0000000020000240 RDI: 000000000000001a
RBP: 00007fef810ca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fef811abf80 R15: 00007fff2ab5a268
Reply all
Reply to author
Forward
0 new messages