syzbot


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

Status: moderation: reported on 2024/04/23 09:55
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+336025f268285ce8f9f8@syzkaller.appspotmail.com
First crash: 10d, last: 10d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KCSAN: data-race in mlock_folio / need_mlock_drain (2) mm 1 260d 260d 0/26 auto-obsoleted due to no activity on 2023/09/21 20:14
upstream KCSAN: data-race in mlock_folio / need_mlock_drain (3) mm 1 129d 129d 0/26 auto-obsoleted due to no activity on 2024/01/30 08:30
upstream KCSAN: data-race in mlock_folio / need_mlock_drain mm 2 297d 298d 0/26 auto-obsoleted due to no activity on 2023/08/15 13:37

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

read-write to 0xffff888237d2b410 of 1 bytes by task 11300 on cpu 1:
 folio_batch_add include/linux/pagevec.h:77 [inline]
 mlock_folio+0x136/0x210 mm/mlock.c:257
 mlock_vma_folio mm/internal.h:765 [inline]
 __folio_add_file_rmap mm/rmap.c:1461 [inline]
 folio_add_file_rmap_ptes+0x175/0x180 mm/rmap.c:1478
 set_pte_range+0x2ae/0x670 mm/memory.c:4682
 finish_fault+0x3fc/0x510 mm/memory.c:4757
 do_read_fault mm/memory.c:4898 [inline]
 do_fault mm/memory.c:5024 [inline]
 do_pte_missing mm/memory.c:3880 [inline]
 handle_pte_fault mm/memory.c:5300 [inline]
 __handle_mm_fault mm/memory.c:5441 [inline]
 handle_mm_fault+0xdeb/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:3411 [inline]
 __do_sys_mlockall mm/mlock.c:777 [inline]
 __se_sys_mlockall+0x28e/0x320 mm/mlock.c:753
 __x64_sys_mlockall+0x1f/0x30 mm/mlock.c:753
 x64_sys_call+0x2a41/0x2d30 arch/x86/include/generated/asm/syscalls_64.h:152
 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 0xffff888237d2b410 of 1 bytes by task 10929 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: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: 0x19 -> 0x1a

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 10929 Comm: syz-executor.4 Not tainted 6.9.0-rc5-syzkaller-00031-g71b1543c83d6 #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.

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/23 09:55 upstream 71b1543c83d6 21339d7b .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.