syzbot


KCSAN: data-race in random_recv_done / virtio_read (3)

Status: fixed on 2023/10/12 12:48
Subsystems: crypto
[Documentation on labels]
Reported-by: syzbot+726dc8c62c3536431ceb@syzkaller.appspotmail.com
Fix commit: ac52578d6e8d hwrng: virtio - Fix race on data_avail and actual data
First crash: 511d, last: 300d
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] hwrng: virtio - Fix race on data_avail and actual data 11 (11) 2023/05/11 15:11
[syzbot] [crypto?] KCSAN: data-race in random_recv_done / virtio_read (3) 2 (3) 2023/05/03 10:22
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in random_recv_done / virtio_read (2) crypto 32 564d 739d 0/26 auto-obsoleted due to no activity on 2022/11/08 08:46
upstream KCSAN: data-race in random_recv_done / virtio_read crypto 23 791d 800d 0/26 auto-closed as invalid on 2022/03/26 07:07

Sample crash report:
==================================================================
BUG: KCSAN: data-race in random_recv_done / virtio_read

read to 0xffff8881015368ec of 4 bytes by task 24993 on cpu 0:
 copy_data drivers/char/hw_random/virtio-rng.c:70 [inline]
 virtio_read+0xc3/0x3f0 drivers/char/hw_random/virtio-rng.c:92
 rng_get_data drivers/char/hw_random/core.c:197 [inline]
 rng_dev_read+0x1a7/0x5e0 drivers/char/hw_random/core.c:234
 vfs_read+0x19e/0x580 fs/read_write.c:468
 ksys_read+0xeb/0x1a0 fs/read_write.c:613
 __do_sys_read fs/read_write.c:623 [inline]
 __se_sys_read fs/read_write.c:621 [inline]
 __x64_sys_read+0x42/0x50 fs/read_write.c:621
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

write to 0xffff8881015368ec of 4 bytes by interrupt on cpu 1:
 random_recv_done+0x62/0x90 drivers/char/hw_random/virtio-rng.c:45
 vring_interrupt+0x150/0x170 drivers/virtio/virtio_ring.c:2501
 __handle_irq_event_percpu+0x91/0x490 kernel/irq/handle.c:158
 handle_irq_event_percpu kernel/irq/handle.c:193 [inline]
 handle_irq_event+0x64/0xf0 kernel/irq/handle.c:210
 handle_edge_irq+0x167/0x590 kernel/irq/chip.c:819
 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline]
 handle_irq arch/x86/kernel/irq.c:231 [inline]
 __common_interrupt+0x3c/0xb0 arch/x86/kernel/irq.c:250
 common_interrupt+0x3d/0x90 arch/x86/kernel/irq.c:240
 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:636

value changed: 0x00000000 -> 0x00000040

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 3293 Comm: syz-fuzzer Not tainted 6.4.0-rc7-syzkaller-00226-ga92b7d26c743 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
==================================================================
virtio_rng virtio3: input:id 0 is not a head!

Crashes (13):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/24 21:23 upstream a92b7d26c743 79782afc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in random_recv_done / virtio_read
2023/05/29 05:05 upstream 7877cb91f108 cf184559 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in random_recv_done / virtio_read
2023/05/24 06:40 upstream 27e462c8fad4 4bce1a3e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in random_recv_done / virtio_read
2023/05/22 13:50 upstream 44c026a73be8 4bce1a3e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in random_recv_done / virtio_read
2023/03/22 01:44 upstream 2faac9a98f01 8b4eb097 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in random_recv_done / virtio_read
2023/02/19 18:11 upstream 925cf0457d7e bcdf85f8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in random_recv_done / virtio_read
2023/02/06 05:43 upstream 4ec5183ec486 be607b78 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in random_recv_done / virtio_read
2023/01/24 15:25 upstream 7bf70dbb1882 9dfcf09c .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in random_recv_done / virtio_read
2023/01/01 23:41 upstream e4cf7c25bae5 ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in random_recv_done / virtio_read
2022/12/13 08:28 upstream 9b93f5069fd9 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in random_recv_done / virtio_read
2022/12/09 17:31 upstream 0d1409e4ff08 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in random_recv_done / virtio_read
2022/12/05 05:54 upstream 0ba09b173387 e080de16 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in random_recv_done / virtio_read
2022/11/26 07:18 upstream 08ad43d554ba f4470a7b .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in random_recv_done / virtio_read
* Struck through repros no longer work on HEAD.