syzbot


KCSAN: data-race in xas_find_marked / xas_init_marks (4)

Status: upstream: reported on 2024/10/14 06:09
Subsystems: exfat ext4
[Documentation on labels]
Reported-by: syzbot+0dd28f0c6293cc87d462@syzkaller.appspotmail.com
First crash: 69d, last: 43d
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] Fix BUG: KCSAN: data-race in xas_find_marked / xas_init_marks 2 (2) 2024/10/29 03:29
[syzbot] [exfat?] KCSAN: data-race in xas_find_marked / xas_init_marks (4) 0 (1) 2024/10/14 06:09
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in xas_find_marked / xas_init_marks (3) ext4 1 119d 119d 0/28 auto-obsoleted due to no activity on 2024/09/27 13:38
upstream KCSAN: data-race in xas_find_marked / xas_init_marks (2) ext4 820 151d 1299d 0/28 auto-obsoleted due to no activity on 2024/08/19 12:59
upstream KCSAN: data-race in xas_find_marked / xas_init_marks ext4 11 1521d 1611d 0/28 auto-closed as invalid on 2020/11/26 04:55

Sample crash report:
==================================================================
BUG: KCSAN: data-race in xas_find_marked / xas_init_marks

read-write to 0xffff88810658b908 of 8 bytes by task 5055 on cpu 1:
 instrument_read_write include/linux/instrumented.h:55 [inline]
 __instrument_read_write_bitop include/asm-generic/bitops/instrumented-non-atomic.h:84 [inline]
 ___test_and_clear_bit include/asm-generic/bitops/instrumented-non-atomic.h:114 [inline]
 node_clear_mark lib/xarray.c:102 [inline]
 xas_clear_mark lib/xarray.c:915 [inline]
 xas_init_marks+0x17e/0x320 lib/xarray.c:948
 xas_store+0x213/0xc90 lib/xarray.c:810
 page_cache_delete_batch mm/filemap.c:322 [inline]
 delete_from_page_cache_batch+0x31c/0x700 mm/filemap.c:344
 truncate_inode_pages_range+0x1c5/0x6b0 mm/truncate.c:343
 truncate_inode_pages mm/truncate.c:423 [inline]
 truncate_pagecache+0x53/0x70 mm/truncate.c:727
 ext4_setattr+0xa07/0xeb0 fs/ext4/inode.c:5490
 notify_change+0x85c/0x8e0 fs/attr.c:503
 do_truncate+0x116/0x160 fs/open.c:65
 handle_truncate fs/namei.c:3395 [inline]
 do_open fs/namei.c:3778 [inline]
 path_openat+0x1c03/0x1fa0 fs/namei.c:3933
 do_filp_open+0xf7/0x200 fs/namei.c:3960
 do_sys_openat2+0xab/0x120 fs/open.c:1415
 do_sys_open fs/open.c:1430 [inline]
 __do_sys_openat fs/open.c:1446 [inline]
 __se_sys_openat fs/open.c:1441 [inline]
 __x64_sys_openat+0xf3/0x120 fs/open.c:1441
 x64_sys_call+0x1025/0x2d60 arch/x86/include/generated/asm/syscalls_64.h:258
 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 0xffff88810658b908 of 8 bytes by task 5041 on cpu 0:
 xas_find_chunk include/linux/xarray.h:1733 [inline]
 xas_find_marked+0x216/0x660 lib/xarray.c:1370
 find_get_entry+0x54/0x390 mm/filemap.c:1994
 filemap_get_folios_tag+0x136/0x210 mm/filemap.c:2261
 mpage_prepare_extent_to_map+0x329/0xb80 fs/ext4/inode.c:2437
 ext4_do_writepages+0x6ea/0x2130 fs/ext4/inode.c:2677
 ext4_writepages+0x159/0x2e0 fs/ext4/inode.c:2813
 do_writepages+0x1d8/0x480 mm/page-writeback.c:2683
 filemap_fdatawrite_wbc+0xdb/0x100 mm/filemap.c:398
 __filemap_fdatawrite_range mm/filemap.c:431 [inline]
 file_write_and_wait_range+0xc4/0x250 mm/filemap.c:788
 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:188
 generic_write_sync include/linux/fs.h:2871 [inline]
 ext4_buffered_write_iter+0x326/0x370 fs/ext4/file.c:305
 ext4_file_write_iter+0x293/0xe10
 new_sync_write fs/read_write.c:590 [inline]
 vfs_write+0x77f/0x920 fs/read_write.c:683
 ksys_pwrite64 fs/read_write.c:798 [inline]
 __do_sys_pwrite64 fs/read_write.c:808 [inline]
 __se_sys_pwrite64 fs/read_write.c:805 [inline]
 __x64_sys_pwrite64+0xf7/0x150 fs/read_write.c:805
 x64_sys_call+0x9d5/0x2d60 arch/x86/include/generated/asm/syscalls_64.h:19
 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: 0xfffffffffffffff8 -> 0xffffffffffff0000

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 UID: 0 PID: 5041 Comm: syz.0.302 Not tainted 6.12.0-rc6-syzkaller-00169-g906bd684e4b1 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
==================================================================

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/08 11:33 upstream 906bd684e4b1 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in xas_find_marked / xas_init_marks
2024/11/08 11:33 upstream 906bd684e4b1 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in xas_find_marked / xas_init_marks
2024/10/14 11:58 upstream 6485cf5ea253 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in xas_find_marked / xas_init_marks
2024/10/14 11:57 upstream 6485cf5ea253 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in xas_find_marked / xas_init_marks
2024/10/12 23:29 upstream 09f6b0c8904b 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in xas_find_marked / xas_init_marks
* Struck through repros no longer work on HEAD.