syzbot


KCSAN: data-race in __filemap_add_folio / invalidate_bdev (8)

Status: upstream: reported on 2025/03/10 09:40
Subsystems: mm fs
[Documentation on labels]
Reported-by: syzbot+f2aaf773187f5cae54f3@syzkaller.appspotmail.com
First crash: 23d, last: 19d
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] block: add lock for safe nrpages access in invalidate_bdev() 2 (2) 2025/03/10 17:11
[syzbot] [mm?] [fs?] KCSAN: data-race in __filemap_add_folio / invalidate_bdev (8) 1 (2) 2025/03/10 15:28
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in __filemap_add_folio / invalidate_bdev fs mm 3 1014d 1050d 0/28 auto-closed as invalid on 2022/07/28 00:49
upstream KCSAN: data-race in __filemap_add_folio / invalidate_bdev (4) fs mm 4 591d 622d 0/28 auto-obsoleted due to no activity on 2023/09/24 05:15
upstream KCSAN: data-race in __filemap_add_folio / invalidate_bdev (5) fs mm 4 457d 477d 0/28 auto-obsoleted due to no activity on 2024/02/05 20:23
upstream KCSAN: data-race in __filemap_add_folio / invalidate_bdev (3) block 1 717d 709d 0/28 auto-obsoleted due to no activity on 2023/05/21 22:53
upstream KCSAN: data-race in __filemap_add_folio / invalidate_bdev (2) fs mm 2 918d 944d 0/28 auto-obsoleted due to no activity on 2022/11/01 13:37
upstream KCSAN: data-race in __filemap_add_folio / invalidate_bdev (6) fs mm 1 374d 374d 0/28 auto-obsoleted due to no activity on 2024/04/28 09:19
upstream KCSAN: data-race in __filemap_add_folio / invalidate_bdev (7) fs mm 1 126d 126d 0/28 auto-obsoleted due to no activity on 2025/01/22 09:36

Sample crash report:
loop1: detected capacity change from 0 to 512
EXT4-fs (loop1): external journal device major/minor numbers have changed
EXT4-fs (loop1): couldn't read superblock of external journal
==================================================================
BUG: KCSAN: data-race in __filemap_add_folio / invalidate_bdev

read-write to 0xffff8881004c11f0 of 8 bytes by task 3291 on cpu 0:
 __filemap_add_folio+0x430/0x6f0 mm/filemap.c:929
 filemap_add_folio+0x9c/0x1b0 mm/filemap.c:981
 page_cache_ra_unbounded+0x1c1/0x350 mm/readahead.c:276
 do_page_cache_ra mm/readahead.c:328 [inline]
 force_page_cache_ra mm/readahead.c:357 [inline]
 page_cache_sync_ra+0x252/0x680 mm/readahead.c:585
 filemap_get_pages+0x2ca/0x11a0 mm/filemap.c:2580
 filemap_read+0x230/0x8c0 mm/filemap.c:2691
 blkdev_read_iter+0x228/0x2d0 block/fops.c:796
 new_sync_read fs/read_write.c:484 [inline]
 vfs_read+0x5cc/0x6f0 fs/read_write.c:565
 ksys_read+0xe8/0x1b0 fs/read_write.c:708
 __do_sys_read fs/read_write.c:717 [inline]
 __se_sys_read fs/read_write.c:715 [inline]
 __x64_sys_read+0x42/0x50 fs/read_write.c:715
 x64_sys_call+0x2874/0x2dc0 arch/x86/include/generated/asm/syscalls_64.h:1
 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 0xffff8881004c11f0 of 8 bytes by task 3905 on cpu 1:
 invalidate_bdev+0x25/0x70 block/bdev.c:99
 __ext4_fill_super fs/ext4/super.c:5697 [inline]
 ext4_fill_super+0x14e1/0x3630 fs/ext4/super.c:5722
 get_tree_bdev_flags+0x29f/0x310 fs/super.c:1636
 get_tree_bdev+0x1f/0x30 fs/super.c:1659
 ext4_get_tree+0x1c/0x30 fs/ext4/super.c:5754
 vfs_get_tree+0x56/0x1e0 fs/super.c:1814
 do_new_mount+0x227/0x690 fs/namespace.c:3560
 path_mount+0x49b/0xb30 fs/namespace.c:3887
 do_mount fs/namespace.c:3900 [inline]
 __do_sys_mount fs/namespace.c:4111 [inline]
 __se_sys_mount+0x27f/0x2d0 fs/namespace.c:4088
 __x64_sys_mount+0x67/0x80 fs/namespace.c:4088
 x64_sys_call+0x2c84/0x2dc0 arch/x86/include/generated/asm/syscalls_64.h:166
 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: 0x0000000000000007 -> 0x0000000000000008

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 3905 Comm: syz.1.160 Not tainted 6.14.0-rc6-syzkaller-00145-g695caca9345a #0
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/03/14 19:21 upstream 695caca9345a e2826670 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __filemap_add_folio / invalidate_bdev
2025/03/10 09:20 upstream 80e54e84911a 163f510d .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __filemap_add_folio / invalidate_bdev
* Struck through repros no longer work on HEAD.