syzbot


KCSAN: data-race in _copy_to_iter / fat_mirror_bhs

Status: moderation: reported on 2025/05/05 11:05
Subsystems: block
[Documentation on labels]
Reported-by: syzbot+f6503ea9f215bfe69fa2@syzkaller.appspotmail.com
First crash: 12h48m, last: 12h48m

Sample crash report:
loop6: detected capacity change from 0 to 8192
==================================================================
BUG: KCSAN: data-race in _copy_to_iter / fat_mirror_bhs

read to 0xffff88812d580000 of 1024 bytes by task 3460 on cpu 0:
 instrument_copy_to_user include/linux/instrumented.h:113 [inline]
 copy_to_user_iter lib/iov_iter.c:24 [inline]
 iterate_ubuf include/linux/iov_iter.h:30 [inline]
 iterate_and_advance2 include/linux/iov_iter.h:300 [inline]
 iterate_and_advance include/linux/iov_iter.h:328 [inline]
 _copy_to_iter+0x12d/0xdd0 lib/iov_iter.c:185
 copy_page_to_iter+0x171/0x2b0 lib/iov_iter.c:362
 copy_folio_to_iter include/linux/uio.h:198 [inline]
 filemap_read+0x413/0x990 mm/filemap.c:2753
 blkdev_read_iter+0x22d/0x2e0 block/fops.c:809
 new_sync_read fs/read_write.c:489 [inline]
 vfs_read+0x5ca/0x6f0 fs/read_write.c:570
 ksys_read+0xda/0x1a0 fs/read_write.c:713
 __do_sys_read fs/read_write.c:722 [inline]
 __se_sys_read fs/read_write.c:720 [inline]
 __x64_sys_read+0x40/0x50 fs/read_write.c:720
 x64_sys_call+0x2d77/0x2fb0 arch/x86/include/generated/asm/syscalls_64.h:1
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xd0/0x1a0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

write to 0xffff88812d580200 of 512 bytes by task 7178 on cpu 1:
 fat_mirror_bhs+0x1df/0x320 fs/fat/fatent.c:395
 fat_alloc_clusters+0x98b/0xa80 fs/fat/fatent.c:543
 fat_add_cluster fs/fat/inode.c:107 [inline]
 __fat_get_block fs/fat/inode.c:154 [inline]
 fat_get_block+0x258/0x5e0 fs/fat/inode.c:189
 __block_write_begin_int+0x419/0xf70 fs/buffer.c:2151
 block_write_begin fs/buffer.c:2262 [inline]
 cont_write_begin+0x5a3/0x8e0 fs/buffer.c:2601
 fat_write_begin+0x4f/0xe0 fs/fat/inode.c:228
 cont_expand_zero fs/buffer.c:2528 [inline]
 cont_write_begin+0x198/0x8e0 fs/buffer.c:2591
 fat_write_begin+0x4f/0xe0 fs/fat/inode.c:228
 generic_cont_expand_simple+0xad/0x150 fs/buffer.c:2492
 fat_cont_expand+0x3e/0x170 fs/fat/file.c:223
 fat_fallocate+0x177/0x1c0 fs/fat/file.c:301
 vfs_fallocate+0x410/0x450 fs/open.c:338
 ksys_fallocate fs/open.c:362 [inline]
 __do_sys_fallocate fs/open.c:367 [inline]
 __se_sys_fallocate fs/open.c:365 [inline]
 __x64_sys_fallocate+0x7a/0xd0 fs/open.c:365
 x64_sys_call+0x2b88/0x2fb0 arch/x86/include/generated/asm/syscalls_64.h:286
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xd0/0x1a0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 7178 Comm: syz.6.1250 Not tainted 6.15.0-rc5-syzkaller #0 PREEMPT(voluntary) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025
==================================================================
FAT-fs (loop6): error, corrupted directory (invalid entries)
FAT-fs (loop6): Filesystem has been set read-only

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/05/05 11:05 upstream 92a09c47464d b0714e37 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in _copy_to_iter / fat_mirror_bhs
* Struck through repros no longer work on HEAD.