syzbot


KCSAN: data-race in __xa_set_mark / filemap_write_and_wait_range

Status: moderation: reported on 2025/04/01 22:36
Subsystems: fs mm
[Documentation on labels]
Reported-by: syzbot+e5b6f1ea1ecef0e5119b@syzkaller.appspotmail.com
First crash: 1d04h, last: 1d04h

Sample crash report:
loop7: detected capacity change from 0 to 2048
EXT4-fs (loop7): mounted filesystem 00000000-0000-0000-0000-000000000000 r/w without journal. Quota mode: none.
==================================================================
BUG: KCSAN: data-race in __xa_set_mark / filemap_write_and_wait_range

write to 0xffff8881235dea94 of 4 bytes by task 15175 on cpu 0:
 xa_mark_set lib/xarray.c:71 [inline]
 xas_set_mark lib/xarray.c:899 [inline]
 __xa_set_mark+0x192/0x1c0 lib/xarray.c:1943
 __folio_mark_dirty+0x3b5/0x4e0 mm/page-writeback.c:2798
 mark_buffer_dirty+0x134/0x230 fs/buffer.c:1196
 __block_commit_write fs/buffer.c:2189 [inline]
 block_write_end+0x123/0x210 fs/buffer.c:2265
 ext4_write_end+0x148/0x770 fs/ext4/inode.c:1306
 ext4_da_write_end+0x74/0x810 fs/ext4/inode.c:3076
 generic_perform_write+0x31e/0x4b0 mm/filemap.c:4135
 ext4_buffered_write_iter+0x1ed/0x3c0 fs/ext4/file.c:299
 ext4_dio_write_iter fs/ext4/file.c:608 [inline]
 ext4_file_write_iter+0xe49/0xf80 fs/ext4/file.c:716
 iter_file_splice_write+0x5f2/0x980 fs/splice.c:738
 do_splice_from fs/splice.c:935 [inline]
 direct_splice_actor+0x160/0x2c0 fs/splice.c:1158
 splice_direct_to_actor+0x305/0x680 fs/splice.c:1102
 do_splice_direct_actor fs/splice.c:1201 [inline]
 do_splice_direct+0xd9/0x150 fs/splice.c:1227
 do_sendfile+0x40a/0x690 fs/read_write.c:1368
 __do_sys_sendfile64 fs/read_write.c:1429 [inline]
 __se_sys_sendfile64 fs/read_write.c:1415 [inline]
 __x64_sys_sendfile64+0x113/0x160 fs/read_write.c:1415
 x64_sys_call+0xfc3/0x2e10 arch/x86/include/generated/asm/syscalls_64.h:41
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xc9/0x1c0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

read to 0xffff8881235dea94 of 4 bytes by task 15171 on cpu 1:
 xa_marked include/linux/xarray.h:424 [inline]
 mapping_tagged include/linux/fs.h:540 [inline]
 filemap_fdatawrite_wbc mm/filemap.c:385 [inline]
 __filemap_fdatawrite_range mm/filemap.c:422 [inline]
 filemap_write_and_wait_range+0x105/0x370 mm/filemap.c:694
 ext4_dio_write_iter fs/ext4/file.c:621 [inline]
 ext4_file_write_iter+0xe89/0xf80 fs/ext4/file.c:716
 iter_file_splice_write+0x5f2/0x980 fs/splice.c:738
 do_splice_from fs/splice.c:935 [inline]
 direct_splice_actor+0x160/0x2c0 fs/splice.c:1158
 splice_direct_to_actor+0x305/0x680 fs/splice.c:1102
 do_splice_direct_actor fs/splice.c:1201 [inline]
 do_splice_direct+0xd9/0x150 fs/splice.c:1227
 do_sendfile+0x40a/0x690 fs/read_write.c:1368
 __do_sys_sendfile64 fs/read_write.c:1429 [inline]
 __se_sys_sendfile64 fs/read_write.c:1415 [inline]
 __x64_sys_sendfile64+0x113/0x160 fs/read_write.c:1415
 x64_sys_call+0xfc3/0x2e10 arch/x86/include/generated/asm/syscalls_64.h:41
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xc9/0x1c0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

value changed: 0x00000021 -> 0x0a000021

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 15171 Comm: syz.7.3979 Not tainted 6.14.0-syzkaller-11270-g08733088b566 #0 PREEMPT(voluntary) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/04/01 22:36 upstream 08733088b566 b8645499 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __xa_set_mark / filemap_write_and_wait_range
2025/04/01 22:35 upstream 08733088b566 b8645499 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __xa_set_mark / filemap_write_and_wait_range
* Struck through repros no longer work on HEAD.