================================================================== BUG: KCSAN: data-race in __mod_memcg_lruvec_state / mem_cgroup_css_rstat_flush write to 0xffffe8ffffd4e240 of 4 bytes by task 32316 on cpu 0: mem_cgroup_css_rstat_flush+0x4ea/0x540 mm/memcontrol.c:5848 cgroup_rstat_flush_locked+0x848/0x980 kernel/cgroup/rstat.c:245 cgroup_rstat_flush+0x26/0x40 kernel/cgroup/rstat.c:277 do_flush_stats mm/memcontrol.c:745 [inline] mem_cgroup_flush_stats+0xb2/0xc0 mm/memcontrol.c:766 prepare_scan_control mm/vmscan.c:2234 [inline] shrink_node+0x2f2/0x15a0 mm/vmscan.c:5906 shrink_zones mm/vmscan.c:6152 [inline] do_try_to_free_pages+0x3cc/0xca0 mm/vmscan.c:6214 try_to_free_mem_cgroup_pages+0x1eb/0x4e0 mm/vmscan.c:6529 try_charge_memcg+0x279/0xd10 mm/memcontrol.c:2783 try_charge mm/memcontrol.c:2931 [inline] charge_memcg mm/memcontrol.c:7284 [inline] mem_cgroup_swapin_charge_folio+0x107/0x1a0 mm/memcontrol.c:7369 __read_swap_cache_async+0x2b9/0x520 mm/swap_state.c:514 swap_cluster_readahead+0x276/0x3f0 mm/swap_state.c:678 swapin_readahead+0xe2/0x7a0 mm/swap_state.c:904 do_swap_page+0x3bb/0x15f0 mm/memory.c:4048 handle_pte_fault mm/memory.c:5303 [inline] __handle_mm_fault mm/memory.c:5441 [inline] handle_mm_fault+0x7fa/0x27e0 mm/memory.c:5606 do_user_addr_fault arch/x86/mm/fault.c:1382 [inline] handle_page_fault arch/x86/mm/fault.c:1474 [inline] exc_page_fault+0x2f5/0x690 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 __get_user_8+0x11/0x20 arch/x86/lib/getuser.S:85 rseq_get_rseq_cs kernel/rseq.c:161 [inline] rseq_ip_fixup kernel/rseq.c:281 [inline] __rseq_handle_notify_resume+0xc8/0xc00 kernel/rseq.c:329 rseq_handle_notify_resume include/linux/rseq.h:38 [inline] resume_user_mode_work include/linux/resume_user_mode.h:62 [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+0x90/0x130 kernel/entry/common.c:218 do_syscall_64+0xda/0x1d0 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f write to 0xffffe8ffffd4e240 of 4 bytes by task 8963 on cpu 1: memcg_rstat_updated mm/memcontrol.c:736 [inline] __mod_memcg_lruvec_state+0x115/0x1a0 mm/memcontrol.c:875 __mod_lruvec_state+0x3c/0x50 mm/memcontrol.c:897 __update_lru_size include/linux/mm_inline.h:47 [inline] update_lru_size include/linux/mm_inline.h:56 [inline] lruvec_add_folio include/linux/mm_inline.h:326 [inline] move_folios_to_lru+0x311/0x690 mm/vmscan.c:1849 shrink_inactive_list mm/vmscan.c:1929 [inline] shrink_list mm/vmscan.c:2163 [inline] shrink_lruvec+0xbd8/0x1640 mm/vmscan.c:5687 shrink_node_memcgs mm/vmscan.c:5873 [inline] shrink_node+0xa78/0x15a0 mm/vmscan.c:5908 shrink_zones mm/vmscan.c:6152 [inline] do_try_to_free_pages+0x3cc/0xca0 mm/vmscan.c:6214 try_to_free_mem_cgroup_pages+0x1eb/0x4e0 mm/vmscan.c:6529 try_charge_memcg+0x279/0xd10 mm/memcontrol.c:2783 try_charge mm/memcontrol.c:2931 [inline] charge_memcg mm/memcontrol.c:7284 [inline] mem_cgroup_swapin_charge_folio+0x107/0x1a0 mm/memcontrol.c:7369 __read_swap_cache_async+0x2b9/0x520 mm/swap_state.c:514 swap_cluster_readahead+0x276/0x3f0 mm/swap_state.c:678 swapin_readahead+0xe2/0x7a0 mm/swap_state.c:904 do_swap_page+0x3bb/0x15f0 mm/memory.c:4048 handle_pte_fault mm/memory.c:5303 [inline] __handle_mm_fault mm/memory.c:5441 [inline] handle_mm_fault+0x7fa/0x27e0 mm/memory.c:5606 do_user_addr_fault arch/x86/mm/fault.c:1382 [inline] handle_page_fault arch/x86/mm/fault.c:1474 [inline] exc_page_fault+0x2f5/0x690 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 __get_user_8+0x11/0x20 arch/x86/lib/getuser.S:85 rseq_get_rseq_cs kernel/rseq.c:161 [inline] rseq_ip_fixup kernel/rseq.c:281 [inline] __rseq_handle_notify_resume+0xc8/0xc00 kernel/rseq.c:329 rseq_handle_notify_resume include/linux/rseq.h:38 [inline] resume_user_mode_work include/linux/resume_user_mode.h:62 [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+0x90/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: 0x00000040 -> 0x00000000 Reported by Kernel Concurrency Sanitizer on: CPU: 1 PID: 8963 Comm: syz-executor.2 Tainted: G W 6.9.0-rc7-syzkaller-00056-g45db3ab70092 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 ================================================================== syz-executor.2 invoked oom-killer: gfp_mask=0x100cca(GFP_HIGHUSER_MOVABLE), order=0, oom_score_adj=1000 CPU: 0 PID: 8963 Comm: syz-executor.2 Tainted: G W 6.9.0-rc7-syzkaller-00056-g45db3ab70092 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xf2/0x150 lib/dump_stack.c:114 dump_stack+0x15/0x20 lib/dump_stack.c:123 dump_header+0x83/0x2d0 mm/oom_kill.c:462 oom_kill_process+0x33e/0x4c0 mm/oom_kill.c:1036 out_of_memory+0x9cb/0xc00 mm/oom_kill.c:1174 mem_cgroup_out_of_memory+0x13e/0x190 mm/memcontrol.c:1817 mem_cgroup_oom mm/memcontrol.c:2047 [inline] try_charge_memcg+0x752/0xd10 mm/memcontrol.c:2831 try_charge mm/memcontrol.c:2931 [inline] charge_memcg mm/memcontrol.c:7284 [inline] mem_cgroup_swapin_charge_folio+0x107/0x1a0 mm/memcontrol.c:7369 __read_swap_cache_async+0x2b9/0x520 mm/swap_state.c:514 swap_cluster_readahead+0x276/0x3f0 mm/swap_state.c:678 swapin_readahead+0xe2/0x7a0 mm/swap_state.c:904 do_swap_page+0x3bb/0x15f0 mm/memory.c:4048 handle_pte_fault mm/memory.c:5303 [inline] __handle_mm_fault mm/memory.c:5441 [inline] handle_mm_fault+0x7fa/0x27e0 mm/memory.c:5606 do_user_addr_fault arch/x86/mm/fault.c:1382 [inline] handle_page_fault arch/x86/mm/fault.c:1474 [inline] exc_page_fault+0x2f5/0x690 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 RIP: 0010:__get_user_8+0x11/0x20 arch/x86/lib/getuser.S:88 Code: ca c3 cc cc cc cc 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 48 89 c2 48 c1 fa 3f 48 09 d0 0f 01 cb <48> 8b 10 31 c0 0f 01 ca c3 cc cc cc cc 66 90 90 90 90 90 90 90 90 RSP: 0018:ffffc90000f07e38 EFLAGS: 00050202 RAX: 000055558d19fda8 RBX: ffffc90000f07e40 RCX: ffffffff814ab464 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff888113cb1a68 RBP: ffffc90000f07ef0 R08: 0001888113cb1a6f R09: 0000000000000000 R10: 0001ffffffffffff R11: ffff888113cb1080 R12: ffff888113cb1080 R13: ffff888113cb1a68 R14: ffffc90000f07f58 R15: ffffc90000f07fd8 rseq_get_rseq_cs kernel/rseq.c:161 [inline] rseq_ip_fixup kernel/rseq.c:281 [inline] __rseq_handle_notify_resume+0xc8/0xc00 kernel/rseq.c:329 rseq_handle_notify_resume include/linux/rseq.h:38 [inline] resume_user_mode_work include/linux/resume_user_mode.h:62 [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+0x90/0x130 kernel/entry/common.c:218 do_syscall_64+0xda/0x1d0 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f03df3b2c5a Code: 48 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c 24 0c e8 03 7f 02 00 8b 7c 24 0c 89 c2 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 36 89 d7 89 44 24 0c e8 63 7f 02 00 8b 44 24 RSP: 002b:00007ffd40b0dd80 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00007f03df3b2c5a RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003 RBP: 00007f03df4e3980 R08: 0000001b2f220000 R09: 00000000000005aa R10: 00000000815f63e7 R11: 0000000000000293 R12: 00000000000f4018 R13: 00007f03df4e205c R14: 00007f03df4e2050 R15: 0000000000000032 memory: usage 307200kB, limit 307200kB, failcnt 6227 memory+swap: usage 307600kB, limit 9007199254740988kB, failcnt 0 kmem: usage 307192kB, limit 9007199254740988kB, failcnt 0 Memory cgroup stats for /syz2: cache 8192 rss 0 shmem 0 mapped_file 0 dirty 0 writeback 0 workingset_refault_anon 436 workingset_refault_file 0 swap 409600 swapcached 0 pgpgin 413628 pgpgout 413626 pgfault 551193 pgmajfault 123 inactive_anon 0 active_anon 0 inactive_file 8192 active_file 0 unevictable 0 hierarchical_memory_limit 314572800 hierarchical_memsw_limit 9223372036854771712 total_cache 8192 total_rss 0 total_shmem 0 total_mapped_file 0 total_dirty 0 total_writeback 0 total_workingset_refault_anon 436 total_workingset_refault_file 0 total_swap 409600 total_swapcached 0 total_pgpgin 413630 total_pgpgout 413628 total_pgfault 551203 total_pgmajfault 123 total_inactive_anon 0 total_active_anon 0 total_inactive_file 8192 total_active_file 0 total_unevictable 0 oom-kill:constraint=CONSTRAINT_MEMCG,nodemask=(null),cpuset=syz2,mems_allowed=0,oom_memcg=/syz2,task_memcg=/syz2,task=syz-executor.2,pid=8963,uid=0 Memory cgroup out of memory: Killed process 8963 (syz-executor.2) total-vm:46476kB, anon-rss:356kB, file-rss:8832kB, shmem-rss:0kB, UID:0 pgtables:84kB oom_score_adj:1000 syz-executor.2 (8963) used greatest stack depth: 9232 bytes left ---------------- Code disassembly (best guess): 0: ca c3 cc lret $0xccc3 3: cc int3 4: cc int3 5: cc int3 6: 0f 1f 00 nopl (%rax) 9: 90 nop a: 90 nop b: 90 nop c: 90 nop d: 90 nop e: 90 nop f: 90 nop 10: 90 nop 11: 90 nop 12: 90 nop 13: 90 nop 14: 90 nop 15: 90 nop 16: 90 nop 17: 90 nop 18: 90 nop 19: f3 0f 1e fa endbr64 1d: 48 89 c2 mov %rax,%rdx 20: 48 c1 fa 3f sar $0x3f,%rdx 24: 48 09 d0 or %rdx,%rax 27: 0f 01 cb stac * 2a: 48 8b 10 mov (%rax),%rdx <-- trapping instruction 2d: 31 c0 xor %eax,%eax 2f: 0f 01 ca clac 32: c3 ret 33: cc int3 34: cc int3 35: cc int3 36: cc int3 37: 66 90 xchg %ax,%ax 39: 90 nop 3a: 90 nop 3b: 90 nop 3c: 90 nop 3d: 90 nop 3e: 90 nop 3f: 90 nop