[moderation] [virt?] KCSAN: data-race in virtqueue_get_buf_ctx / vring_interrupt (9)

0 views
Skip to first unread message

syzbot

unread,
1:56 PM (10 minutes ago) 1:56 PM
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 666539eecdf4 Merge tag 'assoc-array-fixes-v2'
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13ebc065580000
kernel config: https://syzkaller.appspot.com/x/.config?x=b949a9d3c1d44ceb
dashboard link: https://syzkaller.appspot.com/bug?extid=378ba14d9bff8b9e7210
compiler: Debian clang version 22.1.8 (1~deb13u4), Debian LLD 22.1.8
CC: [eper...@redhat.com jasow...@gmail.com linux-...@vger.kernel.org m...@redhat.com virtual...@lists.linux.dev xuan...@linux.alibaba.com]

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a943b9915869/disk-666539ee.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/9bfd839d7ea5/vmlinux-666539ee.xz
kernel image: https://storage.googleapis.com/syzbot-assets/0f20b9720a71/bzImage-666539ee.xz

AI-generated root cause summary:
In virtio split-ring mode, an unmarked data race occurs on the 16-bit field
vq->last_used_idx between virtqueue_get_buf_ctx_split() (which increments
last_used_idx in softirq/NAPI context) and vring_interrupt() ->
more_used_split() (which reads last_used_idx in hardirq context without
locking). While the packed-ring implementation explicitly uses READ_ONCE() and
WRITE_ONCE() to access last_used_idx across interrupt boundaries, the split-ring
functions use plain, unannotated C accesses. As a result, KCSAN detects an
unsynchronized read-write data race between the interrupt handler and buffer
consumption.

full analysis: https://syzkaller.appspot.com/x/ai_root_cause?x=378ba14d9bff8b9e7210

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

==================================================================
BUG: KCSAN: data-race in virtqueue_get_buf_ctx / vring_interrupt

read to 0xffff88810337f55c of 2 bytes by interrupt on cpu 1:
more_used_split drivers/virtio/virtio_ring.c:957 [inline]
more_used drivers/virtio/virtio_ring.c:3308 [inline]
vring_interrupt+0x48/0x310 drivers/virtio/virtio_ring.c:3323
__handle_irq_event_percpu+0x92/0x4a0 kernel/irq/handle.c:209
handle_irq_event_percpu kernel/irq/handle.c:246 [inline]
handle_irq_event+0x64/0xf0 kernel/irq/handle.c:263
handle_edge_irq+0x155/0x440 kernel/irq/chip.c:859
generic_handle_irq_desc include/linux/irqdesc.h:188 [inline]
handle_irq arch/x86/kernel/irq.c:209 [inline]
call_irq_handler arch/x86/kernel/irq.c:-1 [inline]
__common_interrupt+0x60/0xb0 arch/x86/kernel/irq.c:280
common_interrupt+0x3e/0x90 arch/x86/kernel/irq.c:273
asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:665
native_pause arch/x86/include/asm/vdso/processor.h:13 [inline]
delay_tsc+0x43/0xa0 arch/x86/lib/delay.c:76
udelay include/asm-generic/delay.h:64 [inline]
delay_access kernel/kcsan/core.c:332 [inline]
kcsan_setup_watchpoint+0x255/0x3f0 kernel/kcsan/core.c:622
virtqueue_get_buf_ctx_split drivers/virtio/virtio_ring.c:1008 [inline]
virtqueue_get_buf_ctx+0x598/0xd10 drivers/virtio/virtio_ring.c:3168
virtnet_rq_get_buf drivers/net/virtio_net.c:939 [inline]
receive_mergeable drivers/net/virtio_net.c:2436 [inline]
receive_buf+0x637/0xf30 drivers/net/virtio_net.c:2596
virtnet_receive_packets drivers/net/virtio_net.c:2921 [inline]
virtnet_receive drivers/net/virtio_net.c:2945 [inline]
virtnet_poll+0x169f/0x1f60 drivers/net/virtio_net.c:3040
__napi_poll+0x73/0x350 net/core/dev.c:7997
napi_poll net/core/dev.c:8060 [inline]
net_rx_action+0x33f/0x850 net/core/dev.c:8217
handle_softirqs+0x109/0x310 kernel/softirq.c:669
__do_softirq kernel/softirq.c:703 [inline]
invoke_softirq kernel/softirq.c:542 [inline]
__irq_exit_rcu+0x40/0xf0 kernel/softirq.c:786
common_interrupt+0x83/0x90 arch/x86/kernel/irq.c:273
asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:665
native_safe_halt arch/x86/include/asm/irqflags.h:48 [inline]
pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:63
arch_safe_halt arch/x86/kernel/process.c:767 [inline]
default_idle+0x9/0x20 arch/x86/kernel/process.c:768
default_idle_call+0x3b/0x60 kernel/sched/idle.c:122
cpuidle_idle_call kernel/sched/idle.c:199 [inline]
do_idle+0x183/0x2d0 kernel/sched/idle.c:355
cpu_startup_entry+0x24/0x30 kernel/sched/idle.c:458
start_secondary+0x95/0xa0 arch/x86/kernel/smpboot.c:312
common_startup_64+0x13e/0x157

read-write to 0xffff88810337f55c of 2 bytes by interrupt on cpu 1:
virtqueue_get_buf_ctx_split drivers/virtio/virtio_ring.c:1008 [inline]
virtqueue_get_buf_ctx+0x598/0xd10 drivers/virtio/virtio_ring.c:3168
virtnet_rq_get_buf drivers/net/virtio_net.c:939 [inline]
receive_mergeable drivers/net/virtio_net.c:2436 [inline]
receive_buf+0x637/0xf30 drivers/net/virtio_net.c:2596
virtnet_receive_packets drivers/net/virtio_net.c:2921 [inline]
virtnet_receive drivers/net/virtio_net.c:2945 [inline]
virtnet_poll+0x169f/0x1f60 drivers/net/virtio_net.c:3040
__napi_poll+0x73/0x350 net/core/dev.c:7997
napi_poll net/core/dev.c:8060 [inline]
net_rx_action+0x33f/0x850 net/core/dev.c:8217
handle_softirqs+0x109/0x310 kernel/softirq.c:669
__do_softirq kernel/softirq.c:703 [inline]
invoke_softirq kernel/softirq.c:542 [inline]
__irq_exit_rcu+0x40/0xf0 kernel/softirq.c:786
common_interrupt+0x83/0x90 arch/x86/kernel/irq.c:273
asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:665
native_safe_halt arch/x86/include/asm/irqflags.h:48 [inline]
pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:63
arch_safe_halt arch/x86/kernel/process.c:767 [inline]
default_idle+0x9/0x20 arch/x86/kernel/process.c:768
default_idle_call+0x3b/0x60 kernel/sched/idle.c:122
cpuidle_idle_call kernel/sched/idle.c:199 [inline]
do_idle+0x183/0x2d0 kernel/sched/idle.c:355
cpu_startup_entry+0x24/0x30 kernel/sched/idle.c:458
start_secondary+0x95/0xa0 arch/x86/kernel/smpboot.c:312
common_startup_64+0x13e/0x157

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Not tainted syzkaller #0 PREEMPT(lazy)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
==================================================================


---
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
Reply all
Reply to author
Forward
0 new messages