syzbot


KCSAN: data-race in mlock_new_folio / need_mlock_drain (3)

Status: moderation: reported on 2024/04/11 03:51
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+68fbd83d6f243168acea@syzkaller.appspotmail.com
First crash: 19d, last: 1d21h
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in mlock_new_folio / need_mlock_drain mm 2 208d 232d 0/26 auto-obsoleted due to no activity on 2023/11/08 14:06
upstream KCSAN: data-race in mlock_new_folio / need_mlock_drain (2) mm 8 58d 142d 0/26 auto-obsoleted due to no activity on 2024/04/07 03:38

Sample crash report:
EXT4-fs (loop4): unmounting filesystem 00000000-0000-0000-0000-000000000000.
==================================================================
BUG: KCSAN: data-race in mlock_new_folio / need_mlock_drain

read-write to 0xffff888237c2b410 of 1 bytes by task 26514 on cpu 0:
 folio_batch_add include/linux/pagevec.h:77 [inline]
 mlock_new_folio+0x114/0x200 mm/mlock.c:280
 folio_add_lru_vma+0x15d/0x170 mm/swap.c:550
 do_anonymous_page mm/memory.c:4480 [inline]
 do_pte_missing mm/memory.c:3878 [inline]
 handle_pte_fault mm/memory.c:5300 [inline]
 __handle_mm_fault mm/memory.c:5441 [inline]
 handle_mm_fault+0x2312/0x27e0 mm/memory.c:5606
 faultin_page mm/gup.c:958 [inline]
 __get_user_pages+0x470/0xec0 mm/gup.c:1257
 populate_vma_page_range mm/gup.c:1697 [inline]
 __mm_populate+0x204/0x340 mm/gup.c:1800
 mm_populate include/linux/mm.h:3413 [inline]
 __do_sys_mremap mm/mremap.c:1169 [inline]
 __se_sys_mremap+0x79a/0xe10 mm/mremap.c:975
 __x64_sys_mremap+0x67/0x80 mm/mremap.c:975
 x64_sys_call+0xff4/0x2d30 arch/x86/include/generated/asm/syscalls_64.h:26
 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

read to 0xffff888237c2b410 of 1 bytes by task 21834 on cpu 1:
 folio_batch_count include/linux/pagevec.h:56 [inline]
 need_mlock_drain+0x30/0x50 mm/mlock.c:235
 cpu_needs_drain mm/swap.c:816 [inline]
 __lru_add_drain_all+0x240/0x420 mm/swap.c:904
 lru_add_drain_all+0x10/0x20 mm/swap.c:920
 invalidate_bdev+0x54/0x80 block/bdev.c:95
 ext4_put_super+0x51b/0x7e0 fs/ext4/super.c:1361
 generic_shutdown_super+0xde/0x210 fs/super.c:641
 kill_block_super+0x2a/0x70 fs/super.c:1675
 ext4_kill_sb+0x44/0x80 fs/ext4/super.c:7327
 deactivate_locked_super+0x7d/0x1c0 fs/super.c:472
 deactivate_super+0x9f/0xb0 fs/super.c:505
 cleanup_mnt+0x272/0x2e0 fs/namespace.c:1267
 __cleanup_mnt+0x19/0x20 fs/namespace.c:1274
 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

value changed: 0x13 -> 0x1a

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 PID: 21834 Comm: syz-executor.4 Tainted: G        W          6.9.0-rc5-syzkaller-00355-g2c8159388952 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
==================================================================
EXT4-fs (loop4): unmounting filesystem 00000000-0000-0000-0000-000000000000.
EXT4-fs (loop4): unmounting filesystem 00000000-0000-0000-0000-000000000000.

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/28 12:26 upstream 2c8159388952 07b455f9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in mlock_new_folio / need_mlock_drain
2024/04/27 02:26 upstream 5eb4573ea63d 059e9963 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in mlock_new_folio / need_mlock_drain
2024/04/24 11:05 upstream 9d1ddab261f3 21339d7b .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in mlock_new_folio / need_mlock_drain
2024/04/11 03:50 upstream 9875c0beb8ad 33b9e058 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in mlock_new_folio / need_mlock_drain
* Struck through repros no longer work on HEAD.