================================================================== BUG: KASAN: use-after-free in ext4_search_dir+0xee/0x1b0 fs/ext4/namei.c:1505 Read of size 1 at addr ffff8881d81076e3 by task syz-executor.0/479 CPU: 0 PID: 479 Comm: syz-executor.0 Not tainted 5.4.283-syzkaller-04981-g1cca65ac6abc #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1d8/0x241 lib/dump_stack.c:118 print_address_description+0x8c/0x600 mm/kasan/report.c:384 __kasan_report+0xf3/0x120 mm/kasan/report.c:516 kasan_report+0x30/0x60 mm/kasan/common.c:653 ext4_search_dir+0xee/0x1b0 fs/ext4/namei.c:1505 ext4_find_inline_entry+0x4b6/0x5e0 fs/ext4/inline.c:1698 __ext4_find_entry+0x2a9/0x1b50 fs/ext4/namei.c:1578 ext4_lookup_entry fs/ext4/namei.c:1731 [inline] ext4_lookup+0x3c6/0xaa0 fs/ext4/namei.c:1799 lookup_open fs/namei.c:3358 [inline] do_last fs/namei.c:3471 [inline] path_openat+0x15c9/0x34b0 fs/namei.c:3683 do_filp_open+0x20b/0x450 fs/namei.c:3713 do_sys_open+0x39c/0x810 fs/open.c:1123 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 RIP: 0033:0x7f1928dace69 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:00007f192892e0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f1928edaf80 RCX: 00007f1928dace69 RDX: 000000000000275a RSI: 0000000020000280 RDI: ffffffffffffff9c RBP: 00007f1928df947a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f1928edaf80 R15: 00007ffc32141178 The buggy address belongs to the page: page:ffffea00076041c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 flags: 0x8000000000000000() raw: 8000000000000000 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) set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook mm/page_alloc.c:2165 [inline] prep_new_page+0x18f/0x370 mm/page_alloc.c:2171 get_page_from_freelist+0x2d13/0x2d90 mm/page_alloc.c:3794 __alloc_pages_nodemask+0x393/0x840 mm/page_alloc.c:4893 __alloc_pages include/linux/gfp.h:503 [inline] __alloc_pages_node include/linux/gfp.h:516 [inline] alloc_pages_node include/linux/gfp.h:530 [inline] shmem_alloc_page mm/shmem.c:1503 [inline] shmem_alloc_and_acct_page+0x492/0x9d0 mm/shmem.c:1528 shmem_getpage_gfp+0xf5d/0x2440 mm/shmem.c:1852 shmem_getpage mm/shmem.c:154 [inline] shmem_write_begin+0xc9/0x1a0 mm/shmem.c:2447 generic_perform_write+0x2c7/0x560 mm/filemap.c:3450 __generic_file_write_iter+0x224/0x530 mm/filemap.c:3579 generic_file_write_iter+0x455/0x5f0 mm/filemap.c:3611 call_write_iter include/linux/fs.h:1989 [inline] new_sync_write fs/read_write.c:483 [inline] __vfs_write+0x5d3/0x750 fs/read_write.c:496 vfs_write+0x206/0x4e0 fs/read_write.c:558 ksys_write+0x199/0x2c0 fs/read_write.c:611 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1176 [inline] free_pcp_prepare mm/page_alloc.c:1233 [inline] free_unref_page_prepare+0x297/0x380 mm/page_alloc.c:3085 free_unref_page_list+0x10a/0x590 mm/page_alloc.c:3154 release_pages+0xad8/0xb20 mm/swap.c:842 __pagevec_release+0xc3/0x150 mm/swap.c:862 pagevec_release include/linux/pagevec.h:88 [inline] shmem_undo_range+0x8a5/0x1ad0 mm/shmem.c:875 shmem_truncate_range mm/shmem.c:997 [inline] shmem_evict_inode+0x218/0x9a0 mm/shmem.c:1097 evict+0x4ea/0x960 fs/inode.c:610 __dentry_kill+0x429/0x630 fs/dcache.c:583 dentry_kill+0xb8/0x280 fs/dcache.c:677 dput+0x3c/0x80 fs/dcache.c:864 __fput+0x443/0x680 fs/file_table.c:294 task_work_run+0x140/0x170 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0xcaf/0x2bc0 kernel/exit.c:861 do_group_exit+0x138/0x300 kernel/exit.c:984 __do_sys_exit_group kernel/exit.c:995 [inline] __se_sys_exit_group kernel/exit.c:993 [inline] __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:993 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 Memory state around the buggy address: ffff8881d8107580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881d8107600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8881d8107680: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8881d8107700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881d8107780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop0): ext4_find_dest_de:2064: inode #12: block 5: comm syz-executor.0: bad entry in directory: rec_len % 4 != 0 - offset=0, inode=1375716473, rec_len=40042, size=56 fake=0