syzbot


KCSAN: data-race in __filemap_remove_folio / migrate_pages_batch

Status: moderation: reported on 2024/04/21 13:29
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+8087a55cacdf555a6f28@syzkaller.appspotmail.com
First crash: 33d, last: 33d

Sample crash report:
==================================================================
BUG: KCSAN: data-race in __filemap_remove_folio / migrate_pages_batch

write to 0xffffea0004722b18 of 8 bytes by task 3481 on cpu 0:
 page_cache_delete mm/filemap.c:152 [inline]
 __filemap_remove_folio+0x1ac/0x2c0 mm/filemap.c:232
 filemap_remove_folio+0x6c/0x1f0 mm/filemap.c:264
 truncate_inode_folio+0x42/0x50 mm/truncate.c:195
 shmem_undo_range+0x25e/0xa50 mm/shmem.c:1001
 shmem_truncate_range mm/shmem.c:1114 [inline]
 shmem_evict_inode+0x14d/0x530 mm/shmem.c:1242
 evict+0x1ae/0x420 fs/inode.c:667
 iput_final fs/inode.c:1741 [inline]
 iput+0x432/0x5c0 fs/inode.c:1767
 dentry_unlink_inode+0x230/0x240 fs/dcache.c:400
 __dentry_kill+0x188/0x4b0 fs/dcache.c:603
 dput+0x5c/0xd0 fs/dcache.c:845
 __fput+0x44c/0x660 fs/file_table.c:430
 ____fput+0x15/0x20 fs/file_table.c:450
 task_work_run+0x13a/0x1a0 kernel/task_work.c:180
 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:328 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0xbe/0x130 kernel/entry/common.c:218
 do_syscall_64+0xda/0x1d0 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

read to 0xffffea0004722b18 of 8 bytes by task 3476 on cpu 1:
 __folio_test_movable include/linux/page-flags.h:688 [inline]
 migrate_folio_unmap mm/migrate.c:1119 [inline]
 migrate_pages_batch+0x200/0x18a0 mm/migrate.c:1678
 migrate_pages_sync mm/migrate.c:1844 [inline]
 migrate_pages+0xd41/0x17f0 mm/migrate.c:1953
 do_mbind mm/mempolicy.c:1390 [inline]
 kernel_mbind mm/mempolicy.c:1532 [inline]
 __do_sys_mbind mm/mempolicy.c:1606 [inline]
 __se_sys_mbind+0xeb6/0x1030 mm/mempolicy.c:1602
 __x64_sys_mbind+0x78/0x90 mm/mempolicy.c:1602
 x64_sys_call+0x1cee/0x2d30 arch/x86/include/generated/asm/syscalls_64.h:238
 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+0x77/0x7f

value changed: 0xffff888116fdc4e8 -> 0x0000000000000000

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 3476 Comm: syz-executor.4 Not tainted 6.9.0-rc4-syzkaller-00266-g977b1ef51866 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/21 13:28 upstream 977b1ef51866 af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in __filemap_remove_folio / migrate_pages_batch
* Struck through repros no longer work on HEAD.