syzbot


KCSAN: data-race in file_write_and_wait_range / xas_clear_mark

Status: moderation: reported on 2024/12/30 09:03
Subsystems: fs mm
[Documentation on labels]
Reported-by: syzbot+4c346ec095996f236a27@syzkaller.appspotmail.com
First crash: 5d15h, last: 5d15h

Sample crash report:
==================================================================
BUG: KCSAN: data-race in file_write_and_wait_range / xas_clear_mark

write to 0xffff888104bb7424 of 4 bytes by task 3543 on cpu 0:
 xa_mark_clear lib/xarray.c:77 [inline]
 xas_clear_mark+0x169/0x180 lib/xarray.c:925
 __folio_start_writeback+0x2d9/0x430 mm/page-writeback.c:3158
 ext4_bio_write_folio+0x591/0x9d0 fs/ext4/page-io.c:556
 mpage_submit_folio fs/ext4/inode.c:1932 [inline]
 mpage_process_page_bufs+0x486/0x5d0 fs/ext4/inode.c:2045
 mpage_prepare_extent_to_map+0x788/0xb80 fs/ext4/inode.c:2546
 ext4_do_writepages+0xa20/0x2130 fs/ext4/inode.c:2733
 ext4_writepages+0x159/0x2e0 fs/ext4/inode.c:2824
 do_writepages+0x1d8/0x480 mm/page-writeback.c:2702
 filemap_fdatawrite_wbc mm/filemap.c:397 [inline]
 __filemap_fdatawrite_range mm/filemap.c:430 [inline]
 file_write_and_wait_range+0x168/0x2f0 mm/filemap.c:787
 generic_buffers_fsync_noflush+0x46/0x120 fs/buffer.c:600
 ext4_fsync_nojournal fs/ext4/fsync.c:88 [inline]
 ext4_sync_file+0x1ff/0x6c0 fs/ext4/fsync.c:151
 vfs_fsync_range+0x116/0x130 fs/sync.c:187
 generic_write_sync include/linux/fs.h:2904 [inline]
 ext4_buffered_write_iter+0x326/0x370 fs/ext4/file.c:305
 ext4_file_write_iter+0x383/0xf20
 iter_file_splice_write+0x5f1/0x980 fs/splice.c:743
 do_splice_from fs/splice.c:941 [inline]
 direct_splice_actor+0x160/0x2c0 fs/splice.c:1164
 splice_direct_to_actor+0x302/0x670 fs/splice.c:1108
 do_splice_direct_actor fs/splice.c:1207 [inline]
 do_splice_direct+0xd7/0x150 fs/splice.c:1233
 do_sendfile+0x398/0x660 fs/read_write.c:1363
 __do_sys_sendfile64 fs/read_write.c:1424 [inline]
 __se_sys_sendfile64 fs/read_write.c:1410 [inline]
 __x64_sys_sendfile64+0x110/0x150 fs/read_write.c:1410
 x64_sys_call+0xfbd/0x2dc0 arch/x86/include/generated/asm/syscalls_64.h:41
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xc9/0x1c0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

read to 0xffff888104bb7424 of 4 bytes by task 3525 on cpu 1:
 xa_marked include/linux/xarray.h:424 [inline]
 mapping_tagged include/linux/fs.h:504 [inline]
 filemap_fdatawrite_wbc mm/filemap.c:393 [inline]
 __filemap_fdatawrite_range mm/filemap.c:430 [inline]
 file_write_and_wait_range+0x116/0x2f0 mm/filemap.c:787
 generic_buffers_fsync_noflush+0x46/0x120 fs/buffer.c:600
 ext4_fsync_nojournal fs/ext4/fsync.c:88 [inline]
 ext4_sync_file+0x1ff/0x6c0 fs/ext4/fsync.c:151
 vfs_fsync_range+0x116/0x130 fs/sync.c:187
 generic_write_sync include/linux/fs.h:2904 [inline]
 ext4_buffered_write_iter+0x326/0x370 fs/ext4/file.c:305
 ext4_file_write_iter+0x383/0xf20
 iter_file_splice_write+0x5f1/0x980 fs/splice.c:743
 do_splice_from fs/splice.c:941 [inline]
 direct_splice_actor+0x160/0x2c0 fs/splice.c:1164
 splice_direct_to_actor+0x302/0x670 fs/splice.c:1108
 do_splice_direct_actor fs/splice.c:1207 [inline]
 do_splice_direct+0xd7/0x150 fs/splice.c:1233
 do_sendfile+0x398/0x660 fs/read_write.c:1363
 __do_sys_sendfile64 fs/read_write.c:1424 [inline]
 __se_sys_sendfile64 fs/read_write.c:1410 [inline]
 __x64_sys_sendfile64+0x110/0x150 fs/read_write.c:1410
 x64_sys_call+0xfbd/0x2dc0 arch/x86/include/generated/asm/syscalls_64.h:41
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xc9/0x1c0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

value changed: 0x0e000021 -> 0x04000021

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 3525 Comm: syz.2.35 Not tainted 6.13.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
==================================================================
EXT4-fs (loop2): unmounting filesystem 00000000-0000-0000-0000-000000000000.

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/30 09:02 upstream fc033cf25e61 d3ccff63 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in file_write_and_wait_range / xas_clear_mark
* Struck through repros no longer work on HEAD.