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: 1d20h, last: 1d20h
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 993d 1028d 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 570d 600d 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 435d 456d 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 695d 687d 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 896d 923d 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 352d 352d 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 104d 104d 0/28 auto-obsoleted due to no activity on 2025/01/22 09:36

Sample crash report:
EXT4-fs (loop0): unmounting filesystem 00000000-0000-0000-0000-000000000000.
==================================================================
BUG: KCSAN: data-race in __filemap_add_folio / invalidate_bdev

read-write to 0xffff888100630570 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 0xffff888100630570 of 8 bytes by task 3306 on cpu 1:
 invalidate_bdev+0x25/0x70 block/bdev.c:99
 ext4_put_super+0x571/0x810 fs/ext4/super.c:1356
 generic_shutdown_super+0xe5/0x220 fs/super.c:642
 kill_block_super+0x2a/0x70 fs/super.c:1710
 ext4_kill_sb+0x44/0x80 fs/ext4/super.c:7368
 deactivate_locked_super+0x7d/0x1c0 fs/super.c:473
 deactivate_super+0x9f/0xb0 fs/super.c:506
 cleanup_mnt+0x268/0x2e0 fs/namespace.c:1413
 __cleanup_mnt+0x19/0x20 fs/namespace.c:1420
 task_work_run+0x13a/0x1a0 kernel/task_work.c:227
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0xa8/0x120 kernel/entry/common.c:218
 do_syscall_64+0xd6/0x1c0 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

value changed: 0x000000000000000d -> 0x000000000000000e

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 3306 Comm: syz-executor Not tainted 6.14.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
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.