================================================================== BUG: KASAN: use-after-free in ext4_search_dir+0xf2/0x1b0 fs/ext4/namei.c:1539 Read of size 1 at addr ffff88809798a3ed by task syz-executor.5/27048 CPU: 0 PID: 27048 Comm: syz-executor.5 Not tainted 6.4.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:351 [inline] print_report+0x163/0x540 mm/kasan/report.c:462 kasan_report+0x176/0x1b0 mm/kasan/report.c:572 ext4_search_dir+0xf2/0x1b0 fs/ext4/namei.c:1539 ext4_find_inline_entry+0x4ba/0x5e0 fs/ext4/inline.c:1719 __ext4_find_entry+0x2b4/0x1b30 fs/ext4/namei.c:1612 ext4_lookup_entry fs/ext4/namei.c:1767 [inline] ext4_lookup+0x17a/0x750 fs/ext4/namei.c:1835 lookup_open fs/namei.c:3470 [inline] open_last_lookups fs/namei.c:3560 [inline] path_openat+0x11e9/0x3170 fs/namei.c:3788 do_filp_open+0x234/0x490 fs/namei.c:3818 do_sys_openat2+0x13f/0x500 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_open fs/open.c:1380 [inline] __se_sys_open fs/open.c:1376 [inline] __x64_sys_open+0x225/0x270 fs/open.c:1376 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f1d37e8c169 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f1d38c17168 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 00007f1d37fabf80 RCX: 00007f1d37e8c169 RDX: 0000000000000000 RSI: 0000000000141042 RDI: 0000000020000100 RBP: 00007f1d37ee7ca1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffea45b49cf R14: 00007f1d38c17300 R15: 0000000000022000 The buggy address belongs to the physical page: page:ffffea00025e6280 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x9798a 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 0x141cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP|__GFP_WRITE), pid 26797, tgid 26797 (syz-executor.0), ts 900205314825, free_ts 902005847563 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1731 prep_new_page mm/page_alloc.c:1738 [inline] get_page_from_freelist+0x321c/0x33a0 mm/page_alloc.c:3502 __alloc_pages+0x255/0x670 mm/page_alloc.c:4768 folio_alloc+0x1e/0x60 mm/mempolicy.c:2289 filemap_alloc_folio+0xde/0x500 mm/filemap.c:976 __filemap_get_folio+0x323/0xa00 mm/filemap.c:1965 ext4_da_write_begin+0x5b5/0xa40 fs/ext4/inode.c:2909 generic_perform_write+0x300/0x5e0 mm/filemap.c:3923 ext4_buffered_write_iter+0x122/0x3a0 fs/ext4/file.c:289 ext4_file_write_iter+0x1d6/0x1930 __kernel_write_iter+0x303/0x710 fs/read_write.c:517 dump_emit_page fs/coredump.c:886 [inline] dump_user_range+0x46c/0x920 fs/coredump.c:913 elf_core_dump+0x3b6c/0x4480 fs/binfmt_elf.c:2142 do_coredump+0x19eb/0x2980 fs/coredump.c:762 get_signal+0x145e/0x17e0 kernel/signal.c:2860 arch_do_signal_or_restart+0x91/0x670 arch/x86/kernel/signal.c:306 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2564 free_unref_page_list+0x596/0x830 mm/page_alloc.c:2705 release_pages+0x2193/0x2470 mm/swap.c:1042 __pagevec_release+0x84/0x100 mm/swap.c:1062 pagevec_release include/linux/pagevec.h:63 [inline] folio_batch_release include/linux/pagevec.h:132 [inline] truncate_inode_pages_range+0x45d/0x11b0 mm/truncate.c:372 ext4_evict_inode+0x21c/0xf20 fs/ext4/inode.c:193 evict+0x2a4/0x620 fs/inode.c:665 __dentry_kill+0x436/0x650 fs/dcache.c:607 dentry_kill+0xbb/0x290 dput+0x1f3/0x420 fs/dcache.c:913 __fput+0x5e4/0x890 fs/file_table.c:329 task_work_run+0x24a/0x300 kernel/task_work.c:179 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0x68f/0x2290 kernel/exit.c:871 do_group_exit+0x206/0x2c0 kernel/exit.c:1021 get_signal+0x1701/0x17e0 kernel/signal.c:2874 arch_do_signal_or_restart+0x91/0x670 arch/x86/kernel/signal.c:306 Memory state around the buggy address: ffff88809798a280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88809798a300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88809798a380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88809798a400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88809798a480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================