KCSAN: data-race in mlock_folio / need_mlock_drain (10)

Status: moderation: reported on 2026/04/30 11:42
Subsystems: mm
Labels: prio:low
[Documentation on labels]
Reported-by: syzbot+2f4ec809c0aa94d7d565@syzkaller.appspotmail.com
First crash: 103d, last: 2d02h
✨ AI Jobs (2)
ID Workflow Result Correct Bug Created Started Finished Revision
6b123187 assessment-security DenialOfService: ❌ Exploitable: ❌ FilesystemTrigger: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ✅ UserNamespace: ✅ VMGuestTrigger: ❌ VMHostTrigger: ❌ KCSAN: data-race in mlock_folio / need_mlock_drain (10) 2026/05/22 23:53 2026/05/22 23:53 2026/05/23 00:49 df8ac09c
6bc7a208 assessment-kcsan Benign: ✅ Confident: ✅ KCSAN: data-race in mlock_folio / need_mlock_drain (10) 2026/04/30 11:42 2026/04/30 11:42 2026/04/30 12:03 005438fc
Similar bugs (9)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in mlock_folio / need_mlock_drain (5) mm 6 1 796d 796d 0/29 auto-obsoleted due to no activity on 2024/07/11 10:01
upstream KCSAN: data-race in mlock_folio / need_mlock_drain (9) mm 6 5 173d 273d 0/29 auto-obsoleted due to no activity on 2026/04/16 07:40
upstream KCSAN: data-race in mlock_folio / need_mlock_drain (7) mm 6 3 421d 464d 0/29 auto-obsoleted due to no activity on 2025/08/10 18:09
upstream KCSAN: data-race in mlock_folio / need_mlock_drain (2) mm 6 1 1089d 1089d 0/29 auto-obsoleted due to no activity on 2023/09/21 20:14
upstream KCSAN: data-race in mlock_folio / need_mlock_drain (6) mm 6 13 579d 757d 0/29 auto-obsoleted due to no activity on 2025/03/06 02:54
upstream KCSAN: data-race in mlock_folio / need_mlock_drain (3) mm 6 1 959d 959d 0/29 auto-obsoleted due to no activity on 2024/01/30 08:30
upstream KCSAN: data-race in mlock_folio / need_mlock_drain (8) mm 6 1 350d 350d 0/29 auto-obsoleted due to no activity on 2025/10/20 23:51
upstream KCSAN: data-race in mlock_folio / need_mlock_drain (4) mm 6 1 840d 840d 0/29 auto-obsoleted due to no activity on 2024/05/28 09:55
upstream KCSAN: data-race in mlock_folio / need_mlock_drain mm 6 2 1126d 1127d 0/29 auto-obsoleted due to no activity on 2023/08/15 13:37

Sample crash report:
EXT4-fs warning (device loop7): ext4_init_metadata_csum:4685: metadata_csum and uninit_bg are redundant flags; please run fsck.
EXT4-fs (loop7): VFS: Found ext4 filesystem with invalid superblock checksum.  Run e2fsck?
==================================================================
BUG: KCSAN: data-race in mlock_folio / need_mlock_drain

read-write to 0xffff888237c27088 of 1 bytes by task 11138 on cpu 0:
 folio_batch_add include/linux/folio_batch.h:77 [inline]
 mlock_folio+0x14d/0x240 mm/mlock.c:257
 mlock_vma_folio mm/internal.h:1198 [inline]
 __folio_add_file_rmap mm/rmap.c:1715 [inline]
 folio_add_file_rmap_ptes+0x1d0/0x1e0 mm/rmap.c:1732
 set_pte_range+0x2c1/0x4f0 mm/memory.c:5586
 filemap_map_order0_folio mm/filemap.c:3880 [inline]
 filemap_map_pages+0x579/0xef0 mm/filemap.c:3950
 do_fault_around mm/memory.c:5818 [inline]
 do_read_fault mm/memory.c:5851 [inline]
 do_fault mm/memory.c:5994 [inline]
 do_pte_missing mm/memory.c:4566 [inline]
 handle_pte_fault mm/memory.c:6379 [inline]
 __handle_mm_fault mm/memory.c:6517 [inline]
 handle_mm_fault+0x14c5/0x2da0 mm/memory.c:6686
 faultin_page mm/gup.c:1126 [inline]
 __get_user_pages+0x129c/0x1f10 mm/gup.c:1428
 populate_vma_page_range mm/gup.c:1860 [inline]
 __mm_populate+0x242/0x390 mm/gup.c:1963
 mm_populate include/linux/mm.h:4171 [inline]
 __do_sys_mlockall mm/mlock.c:775 [inline]
 __se_sys_mlockall+0x35e/0x3c0 mm/mlock.c:751
 __x64_sys_mlockall+0x1f/0x30 mm/mlock.c:751
 x64_sys_call+0xf90/0x3020 arch/x86/include/generated/asm/syscalls_64.h:152
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x136/0x3c0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

read to 0xffff888237c27088 of 1 bytes by task 11146 on cpu 1:
 folio_batch_count include/linux/folio_batch.h:56 [inline]
 need_mlock_drain+0x30/0x50 mm/mlock.c:235
 cpu_needs_drain mm/swap.c:837 [inline]
 __lru_add_drain_all+0x273/0x450 mm/swap.c:928
 lru_add_drain_all+0x10/0x20 mm/swap.c:944
 invalidate_bdev+0x47/0x70 block/bdev.c:101
 __ext4_fill_super fs/ext4/super.c:5803 [inline]
 ext4_fill_super+0x2c8c/0x3760 fs/ext4/super.c:5828
 get_tree_bdev_flags+0x291/0x300 fs/super.c:1640
 get_tree_bdev+0x1f/0x30 fs/super.c:1663
 ext4_get_tree+0x1c/0x30 fs/ext4/super.c:5860
 vfs_get_tree+0x57/0x1d0 fs/super.c:1700
 fc_mount fs/namespace.c:1198 [inline]
 do_new_mount_fc fs/namespace.c:3765 [inline]
 do_new_mount+0x288/0x8d0 fs/namespace.c:3841
 path_mount+0x4ad/0xb90 fs/namespace.c:4161
 do_mount fs/namespace.c:4174 [inline]
 __do_sys_mount fs/namespace.c:4390 [inline]
 __se_sys_mount+0x28c/0x2e0 fs/namespace.c:4367
 __x64_sys_mount+0x67/0x80 fs/namespace.c:4367
 x64_sys_call+0x2d61/0x3020 arch/x86/include/generated/asm/syscalls_64.h:166
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x136/0x3c0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

value changed: 0x19 -> 0x1f

Reported by Kernel Concurrency Sanitizer on:
CPU: 1 UID: 0 PID: 11146 Comm: syz.7.2196 Tainted: G        W           syzkaller #0 PREEMPT(lazy) 
Tainted: [W]=WARN
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/08/09 10:27 upstream 06cf61899d64 5d63f80b .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in mlock_folio / need_mlock_drain
2026/07/04 15:49 upstream 1e9cdc2ea15a fcece630 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in mlock_folio / need_mlock_drain
2026/05/25 06:19 upstream 6a97c4d5262d c69befb3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in mlock_folio / need_mlock_drain
2026/04/30 11:42 upstream e75a43c7cec4 a7464baf .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in mlock_folio / need_mlock_drain
* Struck through repros no longer work on HEAD.