================================================================== BUG: KASAN: use-after-free in sysv_new_inode+0xfd3/0x1170 fs/sysv/ialloc.c:153 Read of size 2 at addr ffff888044a2c1ce by task syz-executor.4/15173 CPU: 1 PID: 15173 Comm: syz-executor.4 Not tainted 6.9.0-rc5-syzkaller-00329-g5d12ed4bea43 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 sysv_new_inode+0xfd3/0x1170 fs/sysv/ialloc.c:153 sysv_mknod+0x4e/0xe0 fs/sysv/namei.c:53 lookup_open fs/namei.c:3497 [inline] open_last_lookups fs/namei.c:3566 [inline] path_openat+0x1425/0x3240 fs/namei.c:3796 do_filp_open+0x235/0x490 fs/namei.c:3826 do_sys_openat2+0x13e/0x1d0 fs/open.c:1406 do_sys_open fs/open.c:1421 [inline] __do_sys_openat fs/open.c:1437 [inline] __se_sys_openat fs/open.c:1432 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1432 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f012187dea9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f01226450c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f01219ac120 RCX: 00007f012187dea9 RDX: 000000000000275a RSI: 00000000200001c0 RDI: ffffffffffffff9c RBP: 00007f01218ca4a4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000006e R14: 00007f01219ac120 R15: 00007ffc3636df28 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x44a2c flags: 0xfff80000000000(node=0|zone=1|lastcpupid=0xfff) page_type: 0xffffffff() raw: 00fff80000000000 ffffea000121c1c8 ffffea0001bbb908 0000000000000000 raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Movable, gfp_mask 0x100cca(GFP_HIGHUSER_MOVABLE), pid 28368, tgid 1633309348 (syz-executor.4), ts 28369, free_ts 2046457944337 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0x3410/0x35b0 mm/page_alloc.c:3317 __alloc_pages+0x256/0x6c0 mm/page_alloc.c:4575 alloc_pages_mpol+0x3e8/0x680 mm/mempolicy.c:2264 shmem_alloc_folio mm/shmem.c:1628 [inline] shmem_alloc_and_add_folio+0x24d/0xbc0 mm/shmem.c:1668 shmem_get_folio_gfp+0x82d/0x1f50 mm/shmem.c:2055 shmem_fault+0x254/0x6f0 mm/shmem.c:2255 __do_fault+0x135/0x460 mm/memory.c:4531 do_read_fault mm/memory.c:4894 [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+0x45fe/0x7250 mm/memory.c:5441 handle_mm_fault+0x27f/0x770 mm/memory.c:5606 faultin_page mm/gup.c:958 [inline] __get_user_pages+0x727/0x1630 mm/gup.c:1257 populate_vma_page_range+0x2ae/0x390 mm/gup.c:1697 __mm_populate+0x27a/0x460 mm/gup.c:1800 mm_populate include/linux/mm.h:3413 [inline] vm_mmap_pgoff+0x305/0x420 mm/util.c:578 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf5/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 28370 tgid 28368 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1141 [inline] free_unref_page_prepare+0x97b/0xaa0 mm/page_alloc.c:2347 free_unref_folios+0x1f2/0xc10 mm/page_alloc.c:2536 folios_put_refs+0x93a/0xa60 mm/swap.c:1034 folio_batch_release include/linux/pagevec.h:101 [inline] shmem_undo_range+0x6d9/0x1df0 mm/shmem.c:1005 shmem_truncate_range mm/shmem.c:1114 [inline] shmem_evict_inode+0x29b/0xa60 mm/shmem.c:1242 evict+0x2a8/0x630 fs/inode.c:667 __dentry_kill+0x20d/0x630 fs/dcache.c:603 dput+0x19f/0x2b0 fs/dcache.c:845 __fput+0x678/0x8a0 fs/file_table.c:430 task_work_run+0x24f/0x310 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa1b/0x27e0 kernel/exit.c:878 do_group_exit+0x207/0x2c0 kernel/exit.c:1027 get_signal+0x16a1/0x1740 kernel/signal.c:2911 arch_do_signal_or_restart+0x96/0x860 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] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0xc9/0x370 kernel/entry/common.c:218 do_syscall_64+0x102/0x240 arch/x86/entry/common.c:89 Memory state around the buggy address: ffff888044a2c080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888044a2c100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888044a2c180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888044a2c200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888044a2c280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================