syzbot


KCSAN: data-race in __filemap_add_folio / kiocb_invalidate_post_direct_write (3)

Status: auto-obsoleted due to no activity on 2024/03/31 09:05
Subsystems: fs mm
[Documentation on labels]
Reported-by: syzbot+eb66920fb8126e450786@syzkaller.appspotmail.com
First crash: 66d, last: 50d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in __filemap_add_folio / kiocb_invalidate_post_direct_write (2) fs mm 4 118d 127d 0/26 auto-obsoleted due to no activity on 2024/01/23 17:15
upstream KCSAN: data-race in __filemap_add_folio / kiocb_invalidate_post_direct_write fs mm 7 200d 246d 0/26 auto-obsoleted due to no activity on 2023/11/01 22:02

Sample crash report:
==================================================================
BUG: KCSAN: data-race in __filemap_add_folio / kiocb_invalidate_post_direct_write

read-write to 0xffff88812043d538 of 8 bytes by task 8526 on cpu 1:
 __filemap_add_folio+0x4c1/0x730 mm/filemap.c:903
 filemap_add_folio+0x70/0x160 mm/filemap.c:938
 page_cache_ra_unbounded+0x15e/0x2e0 mm/readahead.c:250
 do_page_cache_ra mm/readahead.c:299 [inline]
 page_cache_ra_order mm/readahead.c:544 [inline]
 ondemand_readahead+0x50b/0x670 mm/readahead.c:666
 page_cache_async_ra+0x94/0xa0 mm/readahead.c:715
 do_async_mmap_readahead mm/filemap.c:3181 [inline]
 filemap_fault+0x3da/0xc30 mm/filemap.c:3235
 __do_fault+0xb2/0x1f0 mm/memory.c:4396
 do_read_fault mm/memory.c:4758 [inline]
 do_fault mm/memory.c:4888 [inline]
 do_pte_missing mm/memory.c:3745 [inline]
 handle_pte_fault mm/memory.c:5164 [inline]
 __handle_mm_fault mm/memory.c:5305 [inline]
 handle_mm_fault+0xd5f/0x27c0 mm/memory.c:5470
 faultin_page mm/gup.c:958 [inline]
 __get_user_pages+0x402/0xe40 mm/gup.c:1241
 populate_vma_page_range mm/gup.c:1679 [inline]
 __mm_populate+0x216/0x330 mm/gup.c:1788
 mm_populate include/linux/mm.h:3391 [inline]
 vm_mmap_pgoff+0x1a7/0x240 mm/util.c:561
 ksys_mmap_pgoff+0x2b8/0x330 mm/mmap.c:1425
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1d0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

read to 0xffff88812043d538 of 8 bytes by task 8517 on cpu 0:
 kiocb_invalidate_post_direct_write+0x5e/0x1b0 mm/filemap.c:3830
 iomap_dio_complete+0x334/0x4c0 fs/iomap/direct-io.c:114
 iomap_dio_rw+0x62/0x90 fs/iomap/direct-io.c:752
 ext4_dio_write_iter fs/ext4/file.c:577 [inline]
 ext4_file_write_iter+0xa8a/0xe10 fs/ext4/file.c:696
 call_write_iter include/linux/fs.h:2087 [inline]
 iter_file_splice_write+0x5de/0x950 fs/splice.c:743
 do_splice_from fs/splice.c:941 [inline]
 direct_splice_actor+0x167/0x2c0 fs/splice.c:1164
 splice_direct_to_actor+0x2fb/0x660 fs/splice.c:1108
 do_splice_direct_actor fs/splice.c:1207 [inline]
 do_splice_direct+0xd7/0x150 fs/splice.c:1233
 do_sendfile+0x3b9/0x960 fs/read_write.c:1295
 __do_sys_sendfile64 fs/read_write.c:1362 [inline]
 __se_sys_sendfile64 fs/read_write.c:1348 [inline]
 __x64_sys_sendfile64+0x110/0x150 fs/read_write.c:1348
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x1d0 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x63/0x6b

value changed: 0x00000000000000bf -> 0x00000000000000c0

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 8517 Comm: syz-executor.1 Tainted: G        W          6.8.0-rc5-syzkaller-00329-gab0a97cffa0b #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
==================================================================
Page cache invalidation failure on direct I/O.  Possible data corruption due to collision with buffered I/O!
File: /root/syzkaller-testdir3691147535/syzkaller.hFsLIe/4319/bus PID: 8517 Comm: syz-executor.1

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/02/25 09:05 upstream ab0a97cffa0b 8d446f15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __filemap_add_folio / kiocb_invalidate_post_direct_write
2024/02/11 14:14 upstream 7521f258ea30 77b23aa1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __filemap_add_folio / kiocb_invalidate_post_direct_write
2024/02/09 09:28 upstream 1f719a2f3fa6 7f07e9b0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __filemap_add_folio / kiocb_invalidate_post_direct_write
* Struck through repros no longer work on HEAD.