BUG: KASAN: use-after-free in ext4_ext_rm_leaf fs/ext4/extents.c:2601 [inline] BUG: KASAN: use-after-free in ext4_ext_remove_space+0x2f43/0x3fb0 fs/ext4/extents.c:2939 Read of size 4 at addr ffff88814664ddb8 by task syz-executor/284 CPU: 1 PID: 284 Comm: syz-executor Not tainted 6.1.141-syzkaller-00039-g145c7fad733f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: __dump_stack+0x21/0x24 lib/dump_stack.c:88 dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106 print_address_description+0x71/0x210 mm/kasan/report.c:316 print_report+0x4a/0x60 mm/kasan/report.c:427 kasan_report+0x122/0x150 mm/kasan/report.c:531 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:350 ext4_ext_rm_leaf fs/ext4/extents.c:2601 [inline] ext4_ext_remove_space+0x2f43/0x3fb0 fs/ext4/extents.c:2939 ext4_ext_truncate+0x200/0x320 fs/ext4/extents.c:4469 ext4_truncate+0x9a6/0xf90 fs/ext4/inode.c:4291 ext4_evict_inode+0xcc3/0x1460 fs/ext4/inode.c:286 evict+0x493/0x890 fs/inode.c:705 iput_final fs/inode.c:1834 [inline] iput+0x620/0x670 fs/inode.c:1860 do_unlinkat+0x375/0x6b0 fs/namei.c:4396 __do_sys_unlink fs/namei.c:4437 [inline] __se_sys_unlink fs/namei.c:4435 [inline] __x64_sys_unlink+0x49/0x50 fs/namei.c:4435 x64_sys_call+0x958/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:88 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f5cdcd8df57 Code: 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 57 00 00 00 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:00007fff81de80a8 EFLAGS: 00000206 ORIG_RAX: 0000000000000057 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5cdcd8df57 RDX: 00007fff81de80d0 RSI: 00007fff81de8160 RDI: 00007fff81de8160 RBP: 00007fff81de8160 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000100 R11: 0000000000000206 R12: 00007fff81de9250 R13: 00007f5cdce10b55 R14: 000000000001b5f6 R15: 00007fff81dea320 The buggy address belongs to the physical page: page:ffffea0005199340 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x14664d flags: 0x4000000000000000(zone=1) raw: 4000000000000000 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 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 1325, tgid 1322 (syz.1.262), ts 98535430352, free_ts 98944626125 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1f5/0x210 mm/page_alloc.c:2637 prep_new_page+0x1c/0x110 mm/page_alloc.c:2644 get_page_from_freelist+0x2c7b/0x2cf0 mm/page_alloc.c:4539 __alloc_pages+0x19e/0x3a0 mm/page_alloc.c:5850 __folio_alloc+0x12/0x40 mm/page_alloc.c:5882 __folio_alloc_node include/linux/gfp.h:245 [inline] folio_alloc include/linux/gfp.h:274 [inline] shmem_alloc_folio mm/shmem.c:1601 [inline] shmem_alloc_and_acct_folio+0x650/0x870 mm/shmem.c:1626 shmem_get_folio_gfp+0x119f/0x2230 mm/shmem.c:1955 shmem_get_folio mm/shmem.c:2086 [inline] shmem_write_begin+0xea/0x2c0 mm/shmem.c:2571 generic_perform_write+0x2f6/0x6d0 mm/filemap.c:3882 __generic_file_write_iter+0x227/0x580 mm/filemap.c:4011 generic_file_write_iter+0xae/0x310 mm/filemap.c:4043 __kernel_write_iter+0x27e/0x640 fs/read_write.c:517 dump_emit_page fs/coredump.c:886 [inline] dump_user_range+0x3da/0x600 fs/coredump.c:913 elf_core_dump+0x29e7/0x2ef0 fs/binfmt_elf.c:2354 do_coredump+0x1557/0x21b0 fs/coredump.c:760 get_signal+0x11db/0x1520 kernel/signal.c:2875 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1545 [inline] free_pcp_prepare mm/page_alloc.c:1619 [inline] free_unref_page_prepare+0x742/0x750 mm/page_alloc.c:3581 free_unref_page_list+0xba/0x7c0 mm/page_alloc.c:3729 release_pages+0xad1/0xb20 mm/swap.c:1043 __pagevec_release+0x71/0xe0 mm/swap.c:1063 pagevec_release include/linux/pagevec.h:71 [inline] folio_batch_release include/linux/pagevec.h:135 [inline] shmem_undo_range+0x51a/0x1470 mm/shmem.c:955 shmem_truncate_range mm/shmem.c:1071 [inline] shmem_evict_inode+0x242/0xa10 mm/shmem.c:1180 evict+0x493/0x890 fs/inode.c:705 iput_final fs/inode.c:1834 [inline] iput+0x620/0x670 fs/inode.c:1860 do_unlinkat+0x375/0x6b0 fs/namei.c:4396 __do_sys_unlink fs/namei.c:4437 [inline] __se_sys_unlink fs/namei.c:4435 [inline] __x64_sys_unlink+0x49/0x50 fs/namei.c:4435 x64_sys_call+0x958/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:88 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Memory state around the buggy address: ffff88814664dc80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88814664dd00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88814664dd80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88814664de00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88814664de80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop4): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856764345, count = 32767 EXT4-fs error (device loop4): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856312000, count = 16 EXT4-fs error (device loop4): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856279245, count = 32767 EXT4-fs error (device loop4): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856656077, count = 32767 EXT4-fs error (device loop4): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856178416, count = 16 EXT4-fs error (device loop4): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856145663, count = 32767 EXT4-fs error (device loop4): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856324016, count = 16 EXT4-fs error (device loop4): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856291255, count = 32767 Trying to write to read-only block-device loop4 Trying to write to read-only block-device loop4 Trying to write to read-only block-device loop4 Trying to write to read-only block-device loop4 Trying to write to read-only block-device loop4 Trying to write to read-only block-device loop4 Trying to write to read-only block-device loop4 Trying to write to read-only block-device loop4 Trying to write to read-only block-device loop4 EXT4-fs (loop4): unmounting filesystem. Trying to write to read-only block-device loop4