================================================================== BUG: KASAN: use-after-free in sysv_new_inode+0xecc/0x1190 fs/sysv/ialloc.c:153 Read of size 2 at addr ffff888029afd1ce by task syz-executor.0/11108 CPU: 3 PID: 11108 Comm: syz-executor.0 Not tainted 6.9.0-rc6-syzkaller-00005-gb947cc5bf6d7 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 sysv_new_inode+0xecc/0x1190 fs/sysv/ialloc.c:153 sysv_mknod fs/sysv/namei.c:53 [inline] sysv_create+0x20/0xf0 fs/sysv/namei.c:67 lookup_open.isra.0+0x10a1/0x13c0 fs/namei.c:3497 open_last_lookups fs/namei.c:3566 [inline] path_openat+0x92f/0x2990 fs/namei.c:3796 do_filp_open+0x1dc/0x430 fs/namei.c:3826 do_sys_openat2+0x17a/0x1e0 fs/open.c:1406 do_sys_open fs/open.c:1421 [inline] __do_compat_sys_openat fs/open.c:1481 [inline] __se_compat_sys_openat fs/open.c:1479 [inline] __ia32_compat_sys_openat+0x16e/0x210 fs/open.c:1479 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf729c579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f5e8e5ac EFLAGS: 00000292 ORIG_RAX: 0000000000000127 RAX: ffffffffffffffda RBX: 00000000ffffff9c RCX: 00000000200000c0 RDX: 00000000000026e1 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x29afd flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000000 dead000000000100 dead000000000122 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 11301, tgid 914787395 (syz-executor.1), ts 11305, free_ts 155901381904 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317 __alloc_pages_slowpath mm/page_alloc.c:4108 [inline] __alloc_pages+0x6ad/0x2460 mm/page_alloc.c:4588 alloc_pages_mpol+0x275/0x610 mm/mempolicy.c:2264 shmem_alloc_folio+0x114/0x150 mm/shmem.c:1628 shmem_alloc_and_add_folio+0x14f/0x6f0 mm/shmem.c:1668 shmem_get_folio_gfp+0x685/0x13e0 mm/shmem.c:2055 shmem_get_folio mm/shmem.c:2160 [inline] shmem_write_begin+0x15a/0x370 mm/shmem.c:2744 generic_perform_write+0x272/0x620 mm/filemap.c:3974 shmem_file_write_iter+0x114/0x140 mm/shmem.c:2920 call_write_iter include/linux/fs.h:2110 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6db/0x1100 fs/read_write.c:590 ksys_write+0x12f/0x260 fs/read_write.c:643 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e page last free pid 110 tgid 110 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+0x527/0xb10 mm/page_alloc.c:2347 free_unref_folios+0x256/0xad0 mm/page_alloc.c:2536 shrink_folio_list+0x32e8/0x3f00 mm/vmscan.c:1428 evict_folios+0x6e6/0x1bb0 mm/vmscan.c:4537 try_to_shrink_lruvec+0x618/0x9b0 mm/vmscan.c:4733 shrink_one+0x3f8/0x7c0 mm/vmscan.c:4772 shrink_many mm/vmscan.c:4835 [inline] lru_gen_shrink_node+0x89f/0x1750 mm/vmscan.c:4935 shrink_node mm/vmscan.c:5894 [inline] kswapd_shrink_node mm/vmscan.c:6704 [inline] balance_pgdat+0x10d1/0x1a10 mm/vmscan.c:6895 kswapd+0x5ea/0xbf0 mm/vmscan.c:7164 kthread+0x2c1/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff888029afd080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888029afd100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888029afd180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888029afd200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888029afd280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 10 06 adc %al,(%rsi) 2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 6: 10 07 adc %al,(%rdi) 8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi c: 10 08 adc %cl,(%rax) e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1e: 00 51 52 add %dl,0x52(%rcx) 21: 55 push %rbp 22: 89 e5 mov %esp,%ebp 24: 0f 34 sysenter 26: cd 80 int $0x80 * 28: 5d pop %rbp <-- trapping instruction 29: 5a pop %rdx 2a: 59 pop %rcx 2b: c3 ret 2c: 90 nop 2d: 90 nop 2e: 90 nop 2f: 90 nop 30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi