[syzbot] [exfat?] KCSAN: data-race in xas_find_marked / xas_init_marks (4)

From: syzbot
Date: Mon Oct 14 2024 - 02:09:47 EST


Hello,

syzbot found the following issue on:

HEAD commit: 09f6b0c8904b Merge tag 'linux_kselftest-fixes-6.12-rc3' of..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1777705f980000
kernel config: https://syzkaller.appspot.com/x/.config?x=a2f7ae2f221e9eae
dashboard link: https://syzkaller.appspot.com/bug?extid=0dd28f0c6293cc87d462
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/bab2dba03669/disk-09f6b0c8.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ef90b6468079/vmlinux-09f6b0c8.xz
kernel image: https://storage.googleapis.com/syzbot-assets/5674cb34660a/bzImage-09f6b0c8.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+0dd28f0c6293cc87d462@xxxxxxxxxxxxxxxxxxxxxxxxx

==================================================================
BUG: KCSAN: data-race in xas_find_marked / xas_init_marks

read-write to 0xffff8881068ba480 of 8 bytes by task 7376 on cpu 0:
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 mm/truncate.c:727 [inline]
truncate_setsize+0x9b/0xc0 mm/truncate.c:752
fat_setattr+0x720/0x840 fs/fat/file.c:550
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 0xffff8881068ba480 of 8 bytes by task 7358 on cpu 1:
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
writeback_get_folio mm/page-writeback.c:2489 [inline]
writeback_iter+0x4b0/0x830 mm/page-writeback.c:2590
write_cache_pages+0xad/0x100 mm/page-writeback.c:2639
mpage_writepages+0x72/0xf0 fs/mpage.c:666
fat_writepages+0x24/0x30 fs/fat/inode.c:199
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_file_fsync+0x46/0x140 fs/libfs.c:1528
fat_file_fsync+0x46/0x100 fs/fat/file.c:191
vfs_fsync_range+0x116/0x130 fs/sync.c:188
generic_write_sync include/linux/fs.h:2871 [inline]
generic_file_write_iter+0x185/0x1c0 mm/filemap.c:4185
new_sync_write fs/read_write.c:590 [inline]
vfs_write+0x76a/0x910 fs/read_write.c:683
ksys_write+0xeb/0x1b0 fs/read_write.c:736
__do_sys_write fs/read_write.c:748 [inline]
__se_sys_write fs/read_write.c:745 [inline]
__x64_sys_write+0x42/0x50 fs/read_write.c:745
x64_sys_call+0x27dd/0x2d60 arch/x86/include/generated/asm/syscalls_64.h:2
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: 0xffffffffffffffff -> 0xfffffffffff00000

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 7358 Comm: syz.0.1306 Not tainted 6.12.0-rc2-syzkaller-00291-g09f6b0c8904b #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup