================================================================== 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 ffff8881252cddb8 by task syz-executor345/290 CPU: 1 PID: 290 Comm: syz-executor345 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:0x7f28f287bd17 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:00007ffd410e29d8 EFLAGS: 00000206 ORIG_RAX: 0000000000000057 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f28f287bd17 RDX: 00007ffd410e2a00 RSI: 00007ffd410e2a90 RDI: 00007ffd410e2a90 RBP: 00007ffd410e2a90 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000100 R11: 0000000000000206 R12: 00007ffd410e3b80 R13: 000055558a51a700 R14: 431bde82d7b634db R15: 00007ffd410e4c10 The buggy address belongs to the physical page: page:ffffea000494b340 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x1252cd flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea000494b388 ffffea000494b308 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 292, tgid 292 (syz-executor345), ts 25028822502, free_ts 25354457353 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 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 x64_sys_call+0x27b/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:2 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 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 dentry_unlink_inode+0x33d/0x3f0 fs/dcache.c:405 __dentry_kill+0x460/0x670 fs/dcache.c:611 dentry_kill+0xc0/0x2a0 fs/dcache.c:-1 dput+0x42/0x80 fs/dcache.c:918 __fput+0x5be/0x8f0 fs/file_table.c:328 ____fput+0x15/0x20 fs/file_table.c:348 task_work_run+0x1db/0x240 kernel/task_work.c:203 ptrace_notify+0x221/0x250 kernel/signal.c:2377 Memory state around the buggy address: ffff8881252cdc80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881252cdd00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8881252cdd80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8881252cde00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881252cde80: 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-executor345: Freeing blocks not in datazone - block = 1121070427392, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 1121070426627, count = 772 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 1121070426624, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 6296506030080, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 6296506009100, count = 20995 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 6296506009088, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 1121070428672, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 1121070427907, count = 772 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-executor345: Freeing blocks not in datazone - block = 115750969595360, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 115750969565550, count = 29811 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 115750969565536, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 435390827168, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 435390797381, count = 29793 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 435390797376, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 75176748627888, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 75176748607337, count = 20566 EXT4-fs (loop0): unmounting filesystem. EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 2564649124240, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 2564649123955, count = 290 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 3846, count = 0 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 3840, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 52781440325632, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 52781440303104, count = 22529 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 175934745372720, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 175934745370346, count = 2386 EXT4-fs (loop0): unmounting filesystem. EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 145199959378768, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 145199959377500, count = 1272 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 145199959377488, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 144318559300976, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 144318559289343, count = 11636 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 144318559289328, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 1408828379520, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 1408828379072, count = 453 EXT4-fs (loop0): unmounting filesystem. EXT4-fs (loop0): unmounting filesystem. EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 1657912335, count = 0 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 1657912320, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 259287954137760, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 259287954122388, count = 15375 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 259287954122384, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 213871852398880, count = 19969 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 213871852398880, count = 16 EXT4-fs error (device loop0): ext4_free_blocks:6210: comm syz-executor345: Freeing blocks not in datazone - block = 16930761109760, count = 16