================================================================== BUG: KASAN: use-after-free in ext4_search_dir+0x1b7/0x1d0 fs/ext4/namei.c:1539 Read of size 1 at addr ffff88809b3491ec by task syz-executor.2/11729 CPU: 0 PID: 11729 Comm: syz-executor.2 Not tainted 6.6.0-rc1-next-20230915-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 ext4_search_dir+0x1b7/0x1d0 fs/ext4/namei.c:1539 ext4_find_inline_entry+0x432/0x4f0 fs/ext4/inline.c:1694 __ext4_find_entry+0x85e/0x1050 fs/ext4/namei.c:1612 ext4_lookup_entry fs/ext4/namei.c:1767 [inline] ext4_lookup+0x543/0x740 fs/ext4/namei.c:1835 lookup_open.isra.0+0x926/0x13b0 fs/namei.c:3454 open_last_lookups fs/namei.c:3544 [inline] path_openat+0x931/0x29c0 fs/namei.c:3774 do_filp_open+0x1de/0x430 fs/namei.c:3804 do_sys_openat2+0x176/0x1e0 fs/open.c:1422 do_sys_open fs/open.c:1437 [inline] __do_sys_creat fs/open.c:1513 [inline] __se_sys_creat fs/open.c:1507 [inline] __x64_sys_creat+0xcd/0x120 fs/open.c:1507 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fb3f6e7cae9 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:00007fb3f7b0b0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000055 RAX: ffffffffffffffda RBX: 00007fb3f6f9bf80 RCX: 00007fb3f6e7cae9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000940 RBP: 00007fb3f6ec847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fb3f6f9bf80 R15: 00007ffd0441cdd8 The buggy address belongs to the physical page: page:ffffea00026cd240 refcount:0 mapcount:0 mapping:0000000000000000 index:0xb36 pfn:0x9b349 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000 raw: 0000000000000b36 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 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 10721, tgid 10720 (syz-executor.0), ts 1032652847004, free_ts 1033458295051 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1535 prep_new_page mm/page_alloc.c:1542 [inline] get_page_from_freelist+0xdcd/0x2d10 mm/page_alloc.c:3224 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4480 __folio_alloc+0x16/0x40 mm/page_alloc.c:4512 vma_alloc_folio+0x156/0x890 mm/mempolicy.c:2259 shmem_alloc_folio+0xb5/0x170 mm/shmem.c:1675 shmem_alloc_and_acct_folio+0xcb/0x140 mm/shmem.c:1700 shmem_get_folio_gfp+0xbd9/0x1870 mm/shmem.c:2037 shmem_get_folio mm/shmem.c:2160 [inline] shmem_write_begin+0x15c/0x370 mm/shmem.c:2705 generic_perform_write+0x278/0x600 mm/filemap.c:3955 shmem_file_write_iter+0x110/0x140 mm/shmem.c:2882 call_write_iter include/linux/fs.h:1986 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x650/0xe40 fs/read_write.c:584 ksys_write+0x12f/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1138 [inline] free_unref_page_list+0x4eb/0x1050 mm/page_alloc.c:2507 release_pages+0x32a/0x14e0 mm/swap.c:1042 __folio_batch_release+0x77/0xe0 mm/swap.c:1062 folio_batch_release include/linux/pagevec.h:83 [inline] shmem_undo_range+0x580/0x1140 mm/shmem.c:1022 shmem_truncate_range mm/shmem.c:1131 [inline] shmem_evict_inode+0x392/0xb50 mm/shmem.c:1260 evict+0x2ed/0x6b0 fs/inode.c:666 iput_final fs/inode.c:1777 [inline] iput.part.0+0x55e/0x7a0 fs/inode.c:1803 iput+0x5c/0x80 fs/inode.c:1793 dentry_unlink_inode+0x292/0x430 fs/dcache.c:401 __dentry_kill+0x3b8/0x640 fs/dcache.c:607 dentry_kill fs/dcache.c:733 [inline] dput+0x8b7/0xf80 fs/dcache.c:913 __fput+0x536/0xa70 fs/file_table.c:392 __fput_sync+0x47/0x50 fs/file_table.c:465 __do_sys_close fs/open.c:1572 [inline] __se_sys_close fs/open.c:1557 [inline] __x64_sys_close+0x87/0xf0 fs/open.c:1557 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88809b349080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88809b349100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88809b349180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88809b349200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88809b349280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================