EXT4-fs warning (device loop9): dx_probe:893: inode #2: comm syz.9.1445: dx entry: limit 0 != root limit 124 EXT4-fs warning (device loop9): dx_probe:966: inode #2: comm syz.9.1445: Corrupt directory, running e2fsck is recommended ================================================================== BUG: KASAN: use-after-free in __ext4_check_dir_entry+0x700/0x880 fs/ext4/dir.c:85 Read of size 2 at addr ffff88812aea3003 by task syz.9.1445/4650 CPU: 0 PID: 4650 Comm: syz.9.1445 Not tainted 5.15.167-syzkaller-android13-5.15.167_r00 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1c0 lib/dump_stack.c:106 print_address_description+0x87/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:427 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:444 __asan_report_load2_noabort+0x14/0x20 mm/kasan/report_generic.c:307 __ext4_check_dir_entry+0x700/0x880 fs/ext4/dir.c:85 ext4_readdir+0x1490/0x38d0 fs/ext4/dir.c:258 iterate_dir+0x265/0x600 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64+0x1c1/0x460 fs/readdir.c:354 __x64_sys_getdents64+0x7b/0x90 fs/readdir.c:354 x64_sys_call+0x5ae/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:218 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7fa67b269719 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fa67acea038 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 00007fa67b420f80 RCX: 00007fa67b269719 RDX: 0000000000000010 RSI: 0000000000000000 RDI: 0000000000000008 RBP: 00007fa67b2dc32e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fa67b420f80 R15: 00007ffca7cb1e08 The buggy address belongs to the page: page:ffffea0004aba8c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x12aea3 flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea0004aba908 ffffea0004aba848 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 4639, ts 345575038768, free_ts 346103955976 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2605 prep_new_page+0x1b/0x110 mm/page_alloc.c:2611 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4485 __alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5779 __alloc_pages_node include/linux/gfp.h:591 [inline] alloc_pages_node include/linux/gfp.h:605 [inline] alloc_pages include/linux/gfp.h:618 [inline] shmem_alloc_page mm/shmem.c:1587 [inline] shmem_alloc_and_acct_page+0x4bd/0xa80 mm/shmem.c:1612 shmem_getpage_gfp+0x1388/0x23c0 mm/shmem.c:1908 shmem_getpage mm/shmem.c:152 [inline] shmem_write_begin+0xca/0x1b0 mm/shmem.c:2479 generic_perform_write+0x2bc/0x5a0 mm/filemap.c:3849 __generic_file_write_iter+0x25b/0x4b0 mm/filemap.c:3976 generic_file_write_iter+0xaf/0x1c0 mm/filemap.c:4008 call_write_iter include/linux/fs.h:2204 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xd5d/0x1110 fs/read_write.c:594 ksys_write+0x199/0x2c0 fs/read_write.c:647 __do_sys_write fs/read_write.c:659 [inline] __se_sys_write fs/read_write.c:656 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:656 x64_sys_call+0x2f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:2 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1472 [inline] free_pcp_prepare mm/page_alloc.c:1544 [inline] free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3534 free_unref_page_list+0x14b/0xa60 mm/page_alloc.c:3671 release_pages+0x1310/0x1370 mm/swap.c:1009 __pagevec_release+0x84/0x100 mm/swap.c:1029 pagevec_release include/linux/pagevec.h:81 [inline] shmem_undo_range+0x604/0x1560 mm/shmem.c:965 shmem_truncate_range mm/shmem.c:1064 [inline] shmem_evict_inode+0x215/0x9d0 mm/shmem.c:1146 evict+0x529/0x930 fs/inode.c:622 iput_final fs/inode.c:1740 [inline] iput+0x63b/0x7e0 fs/inode.c:1766 dentry_unlink_inode+0x34e/0x430 fs/dcache.c:380 __dentry_kill+0x447/0x660 fs/dcache.c:586 dentry_kill+0xc0/0x2a0 dput+0x45/0x80 fs/dcache.c:893 __fput+0x59d/0x8c0 fs/file_table.c:288 ____fput+0x15/0x20 fs/file_table.c:308 task_work_run+0x129/0x190 kernel/task_work.c:188 exit_task_work include/linux/task_work.h:33 [inline] do_exit+0xc48/0x2ca0 kernel/exit.c:880 Memory state around the buggy address: ffff88812aea2f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88812aea2f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88812aea3000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88812aea3080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88812aea3100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop9): ext4_readdir:260: inode #2: block 59: comm syz.9.1445: path (unknown): bad entry in directory: rec_len % 4 != 0 - offset=1023, inode=1931491414, rec_len=31353, size=1024 fake=0