syzbot


KCSAN: data-race in folio_alloc_swap / free_swap_slot

Status: auto-obsoleted due to no activity on 2024/08/17 06:05
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+1e0df2c549ba820056f6@syzkaller.appspotmail.com
First crash: 166d, last: 166d

Sample crash report:
==================================================================
BUG: KCSAN: data-race in folio_alloc_swap / free_swap_slot

write to 0xffffffff8842621b of 1 bytes by task 17853 on cpu 1:
 reactivate_swap_slots_cache mm/swap_slots.c:63 [inline]
 check_cache_active mm/swap_slots.c:102 [inline]
 folio_alloc_swap+0x1b3/0x490 mm/swap_slots.c:329
 shmem_writepage+0x43e/0x970 mm/shmem.c:1504
 pageout mm/vmscan.c:660 [inline]
 shrink_folio_list+0x19f4/0x2630 mm/vmscan.c:1341
 evict_folios+0x254f/0x3400 mm/vmscan.c:4553
 try_to_shrink_lruvec+0x719/0x8b0 mm/vmscan.c:4749
 lru_gen_shrink_lruvec mm/vmscan.c:4892 [inline]
 shrink_lruvec+0x25c/0x1760 mm/vmscan.c:5669
 shrink_node_memcgs mm/vmscan.c:5889 [inline]
 shrink_node+0x55e/0x1da0 mm/vmscan.c:5924
 shrink_zones mm/vmscan.c:6168 [inline]
 do_try_to_free_pages+0x3cf/0xc20 mm/vmscan.c:6230
 try_to_free_mem_cgroup_pages+0x1ea/0x4e0 mm/vmscan.c:6545
 try_charge_memcg+0x27a/0xcd0 mm/memcontrol.c:2944
 try_charge mm/memcontrol.c:3092 [inline]
 charge_memcg mm/memcontrol.c:7495 [inline]
 __mem_cgroup_charge+0x63/0x100 mm/memcontrol.c:7510
 mem_cgroup_charge include/linux/memcontrol.h:691 [inline]
 shmem_alloc_and_add_folio mm/shmem.c:1688 [inline]
 shmem_get_folio_gfp+0x480/0xb70 mm/shmem.c:2066
 shmem_get_folio mm/shmem.c:2171 [inline]
 shmem_write_begin+0xa0/0x1c0 mm/shmem.c:2754
 generic_perform_write+0x1d5/0x410 mm/filemap.c:4016
 shmem_file_write_iter+0xc8/0xf0 mm/shmem.c:2930
 __kernel_write_iter+0x24f/0x4e0 fs/read_write.c:523
 dump_emit_page fs/coredump.c:893 [inline]
 dump_user_range+0x3a7/0x550 fs/coredump.c:954
 elf_core_dump+0x1aeb/0x1c30 fs/binfmt_elf.c:2083
 do_coredump+0xff6/0x1860 fs/coredump.c:767
 get_signal+0xdc1/0x1080 kernel/signal.c:2894
 arch_do_signal_or_restart+0x95/0x4b0 arch/x86/kernel/signal.c:310
 exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 irqentry_exit_to_user_mode+0x94/0x130 kernel/entry/common.c:231
 irqentry_exit+0x12/0x50 kernel/entry/common.c:334
 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623

read to 0xffffffff8842621b of 1 bytes by task 17850 on cpu 0:
 free_swap_slot+0x4b/0x1d0 mm/swap_slots.c:280
 __swap_entry_free+0x1cc/0x1f0 mm/swapfile.c:1324
 free_swap_and_cache_nr+0x117/0x310 mm/swapfile.c:1633
 free_swap_and_cache include/linux/swap.h:604 [inline]
 shmem_free_swap mm/shmem.c:853 [inline]
 shmem_undo_range+0x2c3/0xa50 mm/shmem.c:1006
 shmem_truncate_range mm/shmem.c:1125 [inline]
 shmem_evict_inode+0x14d/0x530 mm/shmem.c:1253
 evict+0x1ae/0x420 fs/inode.c:667
 iput_final fs/inode.c:1741 [inline]
 iput+0x432/0x5c0 fs/inode.c:1767
 dentry_unlink_inode+0x24c/0x260 fs/dcache.c:404
 __dentry_kill+0x188/0x4b0 fs/dcache.c:607
 dput+0x5c/0xd0 fs/dcache.c:849
 __fput+0x41f/0x6f0 fs/file_table.c:430
 ____fput+0x15/0x20 fs/file_table.c:450
 task_work_run+0x13a/0x1a0 kernel/task_work.c:180
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0x5d5/0x1710 kernel/exit.c:876
 do_group_exit+0x102/0x150 kernel/exit.c:1025
 get_signal+0xf2f/0x1080 kernel/signal.c:2909
 arch_do_signal_or_restart+0x95/0x4b0 arch/x86/kernel/signal.c:310
 exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 irqentry_exit_to_user_mode+0x94/0x130 kernel/entry/common.c:231
 irqentry_exit+0x12/0x50 kernel/entry/common.c:334
 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623

value changed: 0x00 -> 0x01

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 17850 Comm: syz.3.3909 Not tainted 6.10.0-rc7-syzkaller-00254-g528dd46d0fc3 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/07/13 06:04 upstream 528dd46d0fc3 eaeb5c15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce KCSAN: data-race in folio_alloc_swap / free_swap_slot
* Struck through repros no longer work on HEAD.