EXT4-fs warning (device loop2): dx_probe:892: inode #2: comm syz-executor.2: dx entry: limit 0 != root limit 124 EXT4-fs warning (device loop2): dx_probe:965: inode #2: comm syz-executor.2: Corrupt directory, running e2fsck is recommended ================================================================== BUG: KASAN: use-after-free in __ext4_check_dir_entry+0x6f3/0x870 fs/ext4/dir.c:85 Read of size 2 at addr ffff88804e889003 by task syz-executor.2/4603 CPU: 1 PID: 4603 Comm: syz-executor.2 Not tainted 6.1.92-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15f/0x4f0 mm/kasan/report.c:395 kasan_report+0x136/0x160 mm/kasan/report.c:495 __ext4_check_dir_entry+0x6f3/0x870 fs/ext4/dir.c:85 ext4_readdir+0x139e/0x3950 fs/ext4/dir.c:258 iterate_dir+0x224/0x560 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64+0x209/0x4f0 fs/readdir.c:354 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f547b47cf69 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:00007f547c1540c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 00007f547b5b3f80 RCX: 00007f547b47cf69 RDX: 0000000000000010 RSI: 0000000000000000 RDI: 0000000000000008 RBP: 00007f547b4da6fe R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f547b5b3f80 R15: 00007ffd3ada3588 The buggy address belongs to the physical page: page:ffffea00013a2240 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x4e889 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea00013a2288 ffffea00014b81c8 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 0x152c4a(GFP_NOFS|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL|__GFP_MOVABLE), pid 4579, tgid 4578 (syz-executor.4), ts 148041899521, free_ts 148581762267 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513 prep_new_page mm/page_alloc.c:2520 [inline] get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5547 folio_alloc+0x1a/0x50 mm/mempolicy.c:2292 filemap_alloc_folio+0xda/0x4f0 mm/filemap.c:971 page_cache_ra_unbounded+0x1ee/0x7b0 mm/readahead.c:248 filemap_readahead mm/filemap.c:2611 [inline] filemap_get_pages mm/filemap.c:2652 [inline] filemap_read+0xaad/0x31d0 mm/filemap.c:2730 __kernel_read+0x41e/0x8a0 fs/read_write.c:428 integrity_kernel_read+0xac/0xf0 security/integrity/iint.c:228 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline] ima_calc_file_hash+0xa57/0x1c00 security/integrity/ima/ima_crypto.c:573 ima_collect_measurement+0x59a/0xc30 security/integrity/ima/ima_api.c:293 process_measurement+0x135c/0x21b0 security/integrity/ima/ima_main.c:351 ima_file_check+0xed/0x170 security/integrity/ima/ima_main.c:534 do_open fs/namei.c:3630 [inline] path_openat+0x2687/0x2e60 fs/namei.c:3785 do_filp_open+0x230/0x480 fs/namei.c:3812 do_sys_openat2+0x13b/0x500 fs/open.c:1318 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1440 [inline] free_pcp_prepare mm/page_alloc.c:1490 [inline] free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3358 free_unref_page_list+0x663/0x900 mm/page_alloc.c:3499 release_pages+0x2836/0x2b40 mm/swap.c:1055 __pagevec_release+0x80/0xf0 mm/swap.c:1075 pagevec_release include/linux/pagevec.h:71 [inline] folio_batch_release include/linux/pagevec.h:135 [inline] truncate_inode_pages_range+0x48a/0x1340 mm/truncate.c:372 ext4_evict_inode+0x39c/0x1150 fs/ext4/inode.c:221 evict+0x2a4/0x620 fs/inode.c:666 do_unlinkat+0x509/0x820 fs/namei.c:4399 __do_sys_unlink fs/namei.c:4440 [inline] __se_sys_unlink fs/namei.c:4438 [inline] __x64_sys_unlink+0x45/0x50 fs/namei.c:4438 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Memory state around the buggy address: ffff88804e888f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88804e888f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88804e889000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88804e889080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88804e889100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================