syzbot


KCSAN: data-race in folios_put_refs / need_mlock_drain

Status: moderation: reported on 2024/06/18 12:36
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+7f97e2bd338da740913e@syzkaller.appspotmail.com
First crash: 107d, last: 18d

Sample crash report:
==================================================================
BUG: KCSAN: data-race in folios_put_refs / need_mlock_drain

write to 0xffff888237d2b370 of 1 bytes by task 3522 on cpu 1:
 folio_batch_reinit include/linux/pagevec.h:50 [inline]
 folios_put_refs+0x266/0x2b0 mm/swap.c:1033
 folios_put include/linux/mm.h:1549 [inline]
 mlock_folio_batch+0x319d/0x31d0 mm/mlock.c:209
 mlock_new_folio+0x1a3/0x200 mm/mlock.c:282
 folio_add_lru_vma+0x5d/0x60 mm/swap.c:544
 do_anonymous_page mm/memory.c:4621 [inline]
 do_pte_missing mm/memory.c:3962 [inline]
 handle_pte_fault mm/memory.c:5538 [inline]
 __handle_mm_fault mm/memory.c:5681 [inline]
 handle_mm_fault+0x246c/0x2a30 mm/memory.c:5849
 faultin_page mm/gup.c:1194 [inline]
 __get_user_pages+0x499/0x10d0 mm/gup.c:1493
 populate_vma_page_range mm/gup.c:1932 [inline]
 __mm_populate+0x25b/0x3b0 mm/gup.c:2035
 mm_populate include/linux/mm.h:3430 [inline]
 __do_sys_mlockall mm/mlock.c:766 [inline]
 __se_sys_mlockall+0x2c5/0x370 mm/mlock.c:742
 __x64_sys_mlockall+0x1f/0x30 mm/mlock.c:742
 x64_sys_call+0x1e3a/0x2d60 arch/x86/include/generated/asm/syscalls_64.h:152
 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 0xffff888237d2b370 of 1 bytes by task 3533 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:824 [inline]
 __lru_add_drain_all+0x235/0x410 mm/swap.c:912
 lru_cache_disable+0x1f/0x30 mm/swap.c:965
 do_mbind mm/mempolicy.c:1305 [inline]
 kernel_mbind mm/mempolicy.c:1531 [inline]
 __do_sys_mbind mm/mempolicy.c:1605 [inline]
 __se_sys_mbind+0x4df/0x1160 mm/mempolicy.c:1601
 __x64_sys_mbind+0x78/0x90 mm/mempolicy.c:1601
 x64_sys_call+0x2b4d/0x2d60 arch/x86/include/generated/asm/syscalls_64.h:238
 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

value changed: 0x01 -> 0x00

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 UID: 0 PID: 3533 Comm: syz.2.37 Not tainted 6.11.0-rc7-syzkaller-00151-gd42f7708e27c #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
==================================================================

Crashes (20):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/09/15 22:04 upstream d42f7708e27c 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/09/11 02:33 upstream 8d8d276ba2fb 86aa7bd7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/09/08 13:53 upstream d1f2d51b711a 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/09/03 18:44 upstream 67784a74e258 326f9c5a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/09/02 22:37 upstream 67784a74e258 8045124c .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/08/29 21:54 upstream d5d547aa7b51 9bd464fc .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/08/22 16:59 upstream 872cf28b8df9 ca02180f .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/08/12 21:53 upstream 7c626ce4bae1 842184b3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/08/08 13:46 upstream 6a0e38264012 de12cf65 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/08/06 08:07 upstream b446a2dae984 e1bdb00a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/07/30 21:28 upstream 22f546873149 6fde257d .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/07/28 20:12 upstream 5437f30d3458 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/07/28 09:14 upstream ff30564411ff 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/07/24 13:19 upstream 786c8248dbd3 57b2edb1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/07/19 01:04 upstream b1bc554e009e 71884c12 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/07/16 21:01 upstream d67978318827 b66b37bd .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/07/12 01:34 upstream 8a18fda0febb eaeb5c15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/06/23 01:46 upstream 563a50672d8a edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/06/20 17:45 upstream e5b3efbe1ab1 dac2aa43 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
2024/06/18 12:35 upstream 14d7c92f8df9 639d6cdf .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folios_put_refs / need_mlock_drain
* Struck through repros no longer work on HEAD.