syzbot


KCSAN: data-race in munlock_folio / need_mlock_drain (7)

Status: moderation: reported on 2025/07/12 13:25
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+1b2b913aa57b1c233c99@syzkaller.appspotmail.com
First crash: 8d01h, last: 8d01h
Similar bugs (6)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in munlock_folio / need_mlock_drain mm 6 1 810d 810d 0/29 auto-obsoleted due to no activity on 2023/06/05 22:24
upstream KCSAN: data-race in munlock_folio / need_mlock_drain (2) mm 6 1 656d 656d 0/29 auto-obsoleted due to no activity on 2023/11/07 10:03
upstream KCSAN: data-race in munlock_folio / need_mlock_drain (5) mm 6 16 257d 412d 0/29 auto-obsoleted due to no activity on 2024/12/31 00:27
upstream KCSAN: data-race in munlock_folio / need_mlock_drain (4) mm 6 1 450d 450d 0/29 auto-obsoleted due to no activity on 2024/05/31 11:19
upstream KCSAN: data-race in munlock_folio / need_mlock_drain (6) mm 6 7 77d 175d 0/29 auto-obsoleted due to no activity on 2025/06/29 06:03
upstream KCSAN: data-race in munlock_folio / need_mlock_drain (3) mm 6 2 552d 581d 0/29 auto-obsoleted due to no activity on 2024/02/18 23:01

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

read-write to 0xffff888237d26a10 of 1 bytes by task 7398 on cpu 1:
 folio_batch_add include/linux/pagevec.h:77 [inline]
 munlock_folio+0x44/0x120 mm/mlock.c:301
 munlock_vma_folio mm/internal.h:1023 [inline]
 __folio_remove_rmap mm/rmap.c:1787 [inline]
 folio_remove_rmap_ptes+0x197/0x1a0 mm/rmap.c:1804
 zap_present_folio_ptes mm/memory.c:1529 [inline]
 zap_present_ptes mm/memory.c:1590 [inline]
 do_zap_pte_range mm/memory.c:1691 [inline]
 zap_pte_range mm/memory.c:1735 [inline]
 zap_pmd_range mm/memory.c:1827 [inline]
 zap_pud_range mm/memory.c:1856 [inline]
 zap_p4d_range mm/memory.c:1877 [inline]
 unmap_page_range+0x14f6/0x2740 mm/memory.c:1898
 unmap_single_vma mm/memory.c:1941 [inline]
 unmap_vmas+0x23d/0x3a0 mm/memory.c:1985
 exit_mmap+0x1b0/0x6c0 mm/mmap.c:1284
 __mmput+0x28/0x1c0 kernel/fork.c:1121
 mmput+0x40/0x50 kernel/fork.c:1144
 exit_mm+0xe4/0x190 kernel/exit.c:581
 do_exit+0x417/0x1590 kernel/exit.c:952
 do_group_exit+0xff/0x140 kernel/exit.c:1105
 get_signal+0xe59/0xf70 kernel/signal.c:3034
 arch_do_signal_or_restart+0x96/0x480 arch/x86/kernel/signal.c:337
 exit_to_user_mode_loop+0x7a/0x100 kernel/entry/common.c:111
 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline]
 syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline]
 do_syscall_64+0x1d6/0x200 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

read to 0xffff888237d26a10 of 1 bytes by task 3305 on cpu 0:
 folio_batch_count include/linux/pagevec.h:56 [inline]
 need_mlock_drain+0x30/0x50 mm/mlock.c:235
 cpu_needs_drain mm/swap.c:779 [inline]
 __lru_add_drain_all+0x220/0x3f0 mm/swap.c:867
 lru_add_drain_all+0x10/0x20 mm/swap.c:883
 invalidate_bdev+0x47/0x70 block/bdev.c:101
 ext4_put_super+0x624/0x7d0 fs/ext4/super.c:1339
 generic_shutdown_super+0xe6/0x210 fs/super.c:643
 kill_block_super+0x2a/0x70 fs/super.c:1755
 ext4_kill_sb+0x42/0x80 fs/ext4/super.c:7391
 deactivate_locked_super+0x72/0x1c0 fs/super.c:474
 deactivate_super+0x97/0xa0 fs/super.c:507
 cleanup_mnt+0x269/0x2e0 fs/namespace.c:1417
 __cleanup_mnt+0x19/0x20 fs/namespace.c:1424
 task_work_run+0x131/0x1a0 kernel/task_work.c:227
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 exit_to_user_mode_loop+0xe4/0x100 kernel/entry/common.c:114
 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline]
 syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline]
 do_syscall_64+0x1d6/0x200 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

value changed: 0x18 -> 0x1f

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 UID: 0 PID: 3305 Comm: syz-executor Tainted: G        W           6.16.0-rc5-syzkaller-00224-g379f604cc3dc #0 PREEMPT(voluntary) 
Tainted: [W]=WARN
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
==================================================================
EXT4-fs (loop1): unmounting filesystem 00000000-0000-0000-0000-000000000000.

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/07/12 13:24 upstream 379f604cc3dc 3cda49cf .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in munlock_folio / need_mlock_drain
* Struck through repros no longer work on HEAD.