================================================================== 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 ffff888125223db8 by task syz-executor198/290 CPU: 0 PID: 290 Comm: syz-executor198 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:0x7fc9c6435d57 Code: 73 01 c3 48 c7 c1 b8 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fff16909478 EFLAGS: 00000206 ORIG_RAX: 0000000000000057 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc9c6435d57 RDX: 00007fff169094a0 RSI: 00007fff16909530 RDI: 00007fff16909530 RBP: 00007fff16909530 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000100 R11: 0000000000000206 R12: 00007fff1690a620 R13: 0000555567c28700 R14: 431bde82d7b634db R15: 00007fff1690b6b0 The buggy address belongs to the physical page: page:ffffea00049488c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x125223 flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea0004948188 ffffea0004948888 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 0x141cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP|__GFP_WRITE), pid 292, tgid 292 (syz-executor198), ts 49273010715, free_ts 49414771602 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] filemap_alloc_folio include/linux/pagemap.h:513 [inline] __filemap_get_folio+0x6ec/0x980 mm/filemap.c:2018 pagecache_get_page+0x2b/0x110 mm/folio-compat.c:110 grab_cache_page_write_begin+0x43/0x60 mm/folio-compat.c:122 ext4_write_begin+0x24b/0xf70 fs/ext4/inode.c:1221 ext4_da_write_begin+0x3e1/0x8b0 fs/ext4/inode.c:3001 generic_perform_write+0x2f6/0x6d0 mm/filemap.c:3882 ext4_buffered_write_iter+0x36f/0x660 fs/ext4/file.c:285 ext4_file_write_iter+0x18f/0x13d0 fs/ext4/file.c:-1 call_write_iter include/linux/fs.h:2282 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x5db/0xca0 fs/read_write.c:584 ksys_write+0x140/0x240 fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:646 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] truncate_inode_pages_range+0x309/0xcc0 mm/truncate.c:374 truncate_inode_pages mm/truncate.c:456 [inline] truncate_pagecache+0x6c/0x90 mm/truncate.c:762 ext4_setattr+0xf9b/0x1a50 fs/ext4/inode.c:5626 notify_change+0xcc3/0xf80 fs/attr.c:499 do_truncate fs/open.c:66 [inline] do_sys_ftruncate+0x58f/0x7f0 fs/open.c:194 __do_sys_ftruncate fs/open.c:205 [inline] __se_sys_ftruncate fs/open.c:203 [inline] __x64_sys_ftruncate+0x60/0x70 fs/open.c:203 x64_sys_call+0x2f9/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:78 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: ffff888125223c80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888125223d00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888125223d80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888125223e00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888125223e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs (loop0): unmounting filesystem. EXT4-fs (loop0): unmounting filesystem. EXT4-fs (loop0): unmounting filesystem. EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 140893315144832, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 140893315137536, count = 7307 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 140893315137536, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 80024906794123, count = 2377 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 80024906794112, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 2303251696, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 2303250943, count = 768 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 2303250928, count = 16 EXT4-fs (loop0): unmounting filesystem. EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 83565302031497, count = 0 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 83565302031488, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 211262059322496, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 211262059315200, count = 7307 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 83565973116043, count = 0 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 83565973116032, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 202465966308368, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 202465966292992, count = 15377 EXT4-fs (loop0): unmounting filesystem. EXT4-fs (loop0): unmounting filesystem. EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 2207646876672, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 2207646876163, count = 514 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 2207646876160, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 2211941909504, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 2211941908994, count = 514 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 2211941908992, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 2211941909504, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor198: Freeing blocks not in datazone - block = 2211941908995, count = 514