================================================================== BUG: KASAN: use-after-free in ext4_ext_rm_leaf fs/ext4/extents.c:2627 [inline] BUG: KASAN: use-after-free in ext4_ext_remove_space+0x3211/0x42f0 fs/ext4/extents.c:2965 Read of size 4 at addr ffff88804c926c18 by task syz.2.186/7323 CPU: 1 UID: 0 PID: 7323 Comm: syz.2.186 Tainted: G W syzkaller #0 PREEMPT_{RT,(full)} Tainted: [W]=WARN Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xca/0x240 mm/kasan/report.c:482 kasan_report+0x118/0x150 mm/kasan/report.c:595 ext4_ext_rm_leaf fs/ext4/extents.c:2627 [inline] ext4_ext_remove_space+0x3211/0x42f0 fs/ext4/extents.c:2965 ext4_ext_truncate+0x17e/0x300 fs/ext4/extents.c:4484 ext4_truncate+0x9c1/0x1120 fs/ext4/inode.c:4643 ext4_evict_inode+0x8cf/0xee0 fs/ext4/inode.c:261 evict+0x501/0x9c0 fs/inode.c:810 __dentry_kill+0x209/0x660 fs/dcache.c:669 dput+0x19f/0x2b0 fs/dcache.c:911 __fput+0x69d/0xa80 fs/file_table.c:476 task_work_run+0x1d4/0x260 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop+0xec/0x110 kernel/entry/common.c:43 exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:175 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:210 [inline] do_syscall_64+0x2bd/0x3b0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fbe97c4ebe9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fffac99f2a8 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007fbe97e77da0 RCX: 00007fbe97c4ebe9 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007fbe97e77da0 R08: 0000000000040490 R09: 0000001eac99f59f R10: 00007fbe97e77cb0 R11: 0000000000000246 R12: 0000000000026512 R13: 00007fbe97e76090 R14: ffffffffffffffff R15: 00007fffac99f3c0 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x913 pfn:0x4c926 flags: 0x80000000000000(node=0|zone=1) raw: 0080000000000000 dead000000000100 dead000000000122 0000000000000000 raw: 0000000000000913 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 7324, tgid 7323 (syz.2.186), ts 156785685568, free_ts 156975375247 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851 prep_new_page mm/page_alloc.c:1859 [inline] get_page_from_freelist+0x2119/0x21b0 mm/page_alloc.c:3858 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5148 alloc_pages_mpol+0xd1/0x380 mm/mempolicy.c:2416 folio_alloc_mpol_noprof+0x39/0xe0 mm/mempolicy.c:2435 shmem_alloc_folio mm/shmem.c:1908 [inline] shmem_alloc_and_add_folio mm/shmem.c:1947 [inline] shmem_get_folio_gfp+0x633/0x1a70 mm/shmem.c:2597 shmem_get_folio mm/shmem.c:2703 [inline] shmem_write_begin+0xef/0x2a0 mm/shmem.c:3353 generic_perform_write+0x29d/0x8c0 mm/filemap.c:4175 shmem_file_write_iter+0xfb/0x120 mm/shmem.c:3528 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x5d5/0xb40 fs/read_write.c:686 ksys_write+0x14b/0x260 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 7324 tgid 7323 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1395 [inline] free_unref_folios+0xd66/0x1460 mm/page_alloc.c:2952 folios_put_refs+0x569/0x670 mm/swap.c:997 folio_batch_release include/linux/pagevec.h:101 [inline] shmem_undo_range+0x49e/0x14b0 mm/shmem.c:1157 shmem_truncate_range mm/shmem.c:1269 [inline] shmem_evict_inode+0x272/0xa70 mm/shmem.c:1397 evict+0x501/0x9c0 fs/inode.c:810 __dentry_kill+0x209/0x660 fs/dcache.c:669 dput+0x19f/0x2b0 fs/dcache.c:911 __fput+0x69d/0xa80 fs/file_table.c:476 fput_close_sync+0x119/0x200 fs/file_table.c:573 __do_sys_close fs/open.c:1587 [inline] __se_sys_close fs/open.c:1572 [inline] __x64_sys_close+0x7f/0x110 fs/open.c:1572 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88804c926b00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88804c926b80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88804c926c00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88804c926c80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88804c926d00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================