================================================================== BUG: KASAN: use-after-free in ext4_read_inline_data fs/ext4/inline.c:209 [inline] BUG: KASAN: use-after-free in ext4_inlinedir_to_tree+0x555/0x1160 fs/ext4/inline.c:1399 Read of size 68 at addr ffff8881ef40dec9 by task syz-executor.0/426 CPU: 0 PID: 426 Comm: syz-executor.0 Not tainted 5.4.276-syzkaller-04917-g58de09405d1e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/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 check_memory_region_inline mm/kasan/generic.c:141 [inline] check_memory_region+0x272/0x280 mm/kasan/generic.c:191 memcpy+0x25/0x50 mm/kasan/common.c:123 ext4_read_inline_data fs/ext4/inline.c:209 [inline] ext4_inlinedir_to_tree+0x555/0x1160 fs/ext4/inline.c:1399 ext4_htree_fill_tree+0x5b2/0x1770 fs/ext4/namei.c:1174 ext4_dx_readdir fs/ext4/dir.c:599 [inline] ext4_readdir+0x2c1d/0x3610 fs/ext4/dir.c:142 iterate_dir+0x266/0x4e0 fs/readdir.c:64 ksys_getdents64+0x21b/0x4c0 fs/readdir.c:374 __do_sys_getdents64 fs/readdir.c:395 [inline] __se_sys_getdents64 fs/readdir.c:392 [inline] __x64_sys_getdents64+0x76/0x80 fs/readdir.c:392 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 RIP: 0033:0x7fca15b0d363 Code: c1 66 0f 1f 44 00 00 48 83 c4 08 48 89 ef 5b 5d e9 62 8b fa ff 66 90 b8 ff ff ff 7f 48 39 c2 48 0f 47 d0 b8 d9 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 05 c3 0f 1f 40 00 48 c7 c2 b0 ff ff ff f7 d8 RSP: 002b:00007ffff7c24418 EFLAGS: 00000293 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 0000555556ac1890 RCX: 00007fca15b0d363 RDX: 0000000000008000 RSI: 0000555556ac1890 RDI: 0000000000000006 RBP: 0000555556ac1864 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000001000 R11: 0000000000000293 R12: ffffffffffffffb0 R13: 0000000000000016 R14: 0000555556ac1860 R15: 0000000000000008 The buggy address belongs to the page: page:ffffea0007bd0340 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 flags: 0x8000000000000000() raw: 8000000000000000 ffffea0007c2fe48 ffffea0007bd0308 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Unmovable, gfp_mask 0x500dc0(GFP_USER|__GFP_ZERO|__GFP_ACCOUNT) 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] __get_free_pages mm/page_alloc.c:4937 [inline] get_zeroed_page+0x15/0x40 mm/page_alloc.c:4946 pud_alloc_one arch/x86/include/asm/pgalloc.h:156 [inline] __pud_alloc+0x33/0x180 mm/memory.c:4237 pud_alloc include/linux/mm.h:1995 [inline] __handle_mm_fault mm/memory.c:4093 [inline] handle_mm_fault+0x228d/0x4990 mm/memory.c:4189 do_user_addr_fault arch/x86/mm/fault.c:1469 [inline] __do_page_fault+0x509/0xbb0 arch/x86/mm/fault.c:1530 page_fault+0x2f/0x40 arch/x86/entry/entry_64.S:1206 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 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] tlb_flush_mmu_free mm/mmu_gather.c:189 [inline] tlb_flush_mmu mm/mmu_gather.c:196 [inline] tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:277 exit_mmap+0x2dc/0x520 mm/mmap.c:3193 __mmput+0x8e/0x2c0 kernel/fork.c:1101 exit_mm kernel/exit.c:536 [inline] do_exit+0xc08/0x2bc0 kernel/exit.c:846 do_group_exit+0x138/0x300 kernel/exit.c:982 get_signal+0xdb1/0x1440 kernel/signal.c:2735 do_signal+0xb0/0x11f0 arch/x86/kernel/signal.c:809 exit_to_usermode_loop+0xc0/0x1a0 arch/x86/entry/common.c:159 prepare_exit_to_usermode+0x199/0x200 arch/x86/entry/common.c:194 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 Memory state around the buggy address: ffff8881ef40dd80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881ef40de00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8881ef40de80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8881ef40df00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881ef40df80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop0): ext4_inlinedir_to_tree:1437: inode #12: block 7: comm syz-executor.0: path /root/syzkaller-testdir2355078154/syzkaller.OTSYfB/0/file0/file0: bad entry in directory: directory entry overrun - offset=34816, inode=2538880996, rec_len=34812, size=128 fake=0 EXT4-fs error (device loop0): empty_inline_dir:1832: inode #12: block 7: comm syz-executor.0: bad entry in directory: directory entry overrun - offset=4, inode=2538880996, rec_len=34812, size=60 fake=0 EXT4-fs warning (device loop0): empty_inline_dir:1839: bad inline directory (dir #12) - inode 2538880996, rec_len 34812, name_len 234inline size 60 EXT4-fs error (device loop0): __ext4_iget:5217: inode #16: block 786432: comm syz-executor.0: invalid block EXT4-fs error (device loop0): __ext4_iget:5217: inode #16: block 786432: comm syz-executor.0: invalid block