================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:826 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xbeb/0xe20 fs/ext4/extents.c:945 Read of size 4 at addr ffff8881322bb588 by task kworker/u4:0/7 CPU: 0 PID: 7 Comm: kworker/u4:0 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Workqueue: writeback wb_workfn (flush-7:3) Call Trace: __dump_stack+0x21/0x24 lib/dump_stack.c:77 dump_stack_lvl+0x169/0x1d8 lib/dump_stack.c:118 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0xe2/0x130 mm/kasan/report.c:452 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 ext4_ext_binsearch fs/ext4/extents.c:826 [inline] ext4_find_extent+0xbeb/0xe20 fs/ext4/extents.c:945 ext4_ext_map_blocks+0x1de/0x5d40 fs/ext4/extents.c:4160 ext4_map_blocks+0x978/0x1bc0 fs/ext4/inode.c:674 mpage_map_one_extent fs/ext4/inode.c:2452 [inline] mpage_map_and_submit_extent fs/ext4/inode.c:2505 [inline] ext4_writepages+0x11d5/0x2e00 fs/ext4/inode.c:2873 do_writepages+0x12a/0x270 mm/page-writeback.c:2380 __writeback_single_inode+0xd5/0xa20 fs/fs-writeback.c:1470 writeback_sb_inodes+0x860/0x1400 fs/fs-writeback.c:1733 wb_writeback+0x3e3/0xb90 fs/fs-writeback.c:1908 wb_do_writeback fs/fs-writeback.c:2053 [inline] wb_workfn+0x38f/0xe20 fs/fs-writeback.c:2094 process_one_work+0x6e1/0xba0 kernel/workqueue.c:2301 worker_thread+0xa6a/0x13b0 kernel/workqueue.c:2447 kthread+0x346/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 The buggy address belongs to the page: page:ffffea0004c8aec0 refcount:2 mapcount:0 mapping:ffff8881256d3e38 index:0x17 pfn:0x1322bb aops:ext4_da_aops ino:f dentry name:"file1" flags: 0x400000000000201c(uptodate|dirty|lru|private) raw: 400000000000201c ffffea0004886448 ffffea00048867c8 ffff8881256d3e38 raw: 0000000000000017 ffff888125777690 00000002ffffffff ffff88810f4fe000 page dumped because: kasan: bad access detected page->mem_cgroup:ffff88810f4fe000 page_owner tracks the page as allocated page last allocated via order 0, migratetype Movable, gfp_mask 0x101cca(GFP_HIGHUSER_MOVABLE|__GFP_WRITE), pid 521, ts 47658962778, free_ts 47557564138 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2456 [inline] prep_new_page+0x179/0x180 mm/page_alloc.c:2462 get_page_from_freelist+0x2235/0x23d0 mm/page_alloc.c:4254 __alloc_pages_nodemask+0x268/0x5f0 mm/page_alloc.c:5370 __alloc_pages include/linux/gfp.h:544 [inline] __alloc_pages_node include/linux/gfp.h:557 [inline] alloc_pages_node include/linux/gfp.h:571 [inline] alloc_pages include/linux/gfp.h:590 [inline] __page_cache_alloc include/linux/pagemap.h:290 [inline] pagecache_get_page+0x642/0x930 mm/filemap.c:1848 grab_cache_page_write_begin+0x59/0xb0 mm/filemap.c:3459 ext4_write_begin+0x27b/0x15a0 fs/ext4/inode.c:1208 ext4_da_write_begin+0x455/0xe80 fs/ext4/inode.c:3033 generic_perform_write+0x2be/0x510 mm/filemap.c:3509 ext4_buffered_write_iter+0x4b8/0x640 fs/ext4/file.c:271 ext4_file_write_iter+0x536/0x1980 fs/ext4/file.c:-1 call_write_iter include/linux/fs.h:2066 [inline] new_sync_write fs/read_write.c:518 [inline] vfs_write+0x725/0xd60 fs/read_write.c:605 ksys_pwrite64 fs/read_write.c:712 [inline] __do_sys_pwrite64 fs/read_write.c:722 [inline] __se_sys_pwrite64 fs/read_write.c:719 [inline] __x64_sys_pwrite64+0x191/0x220 fs/read_write.c:719 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1349 [inline] free_pcp_prepare mm/page_alloc.c:1421 [inline] free_unref_page_prepare+0x2b7/0x2d0 mm/page_alloc.c:3336 free_unref_page_list+0x12e/0x9b0 mm/page_alloc.c:3443 release_pages+0xe38/0xe80 mm/swap.c:1103 free_pages_and_swap_cache+0x86/0xa0 mm/swap_state.c:356 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] tlb_flush_mmu_free mm/mmu_gather.c:240 [inline] tlb_flush_mmu mm/mmu_gather.c:247 [inline] tlb_finish_mmu+0x175/0x300 mm/mmu_gather.c:326 exit_mmap+0x2fc/0x540 mm/mmap.c:3387 __mmput+0x93/0x2f0 kernel/fork.c:1153 mmput+0x4e/0x150 kernel/fork.c:1176 exit_mm kernel/exit.c:539 [inline] do_exit+0x9ae/0x2480 kernel/exit.c:859 do_group_exit+0x141/0x310 kernel/exit.c:986 __do_sys_exit_group kernel/exit.c:997 [inline] __se_sys_exit_group kernel/exit.c:995 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:995 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xcb Memory state around the buggy address: ffff8881322bb480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8881322bb500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8881322bb580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff8881322bb600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8881322bb680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== EXT4-fs (loop3): Delayed block allocation failed for inode 15 at logical offset 0 with max blocks 1 with error 117 EXT4-fs (loop3): This should not happen!! Data will be lost EXT4-fs (loop3): Delayed block allocation failed for inode 15 at logical offset 36 with max blocks 1 with error 117 EXT4-fs (loop3): This should not happen!! Data will be lost ------------[ cut here ]------------ kernel BUG at fs/ext4/inode.c:2464! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 7 Comm: kworker/u4:0 Tainted: G B syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Workqueue: writeback wb_workfn (flush-7:6) RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2464 [inline] RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2505 [inline] RIP: 0010:ext4_writepages+0x2d49/0x2e00 fs/ext4/inode.c:2873 Code: 08 48 89 df e8 a8 16 ce ff 48 8b 3b 48 8b 74 24 40 48 8b 54 24 28 48 8b 4c 24 20 45 89 f0 e8 7e 42 07 00 eb 56 e8 c7 26 94 ff <0f> 0b e8 c0 26 94 ff eb 2f e8 b9 26 94 ff eb 64 e8 b2 26 94 ff 31 RSP: 0018:ffffc90000077180 EFLAGS: 00010293 RAX: ffffffff81cf7ed9 RBX: 0000000000000000 RCX: ffff888100248000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc900000774f0 R08: dffffc0000000000 R09: ffffed1024ada786 R10: ffffed1024ada786 R11: 1ffff11024ada785 R12: dffffc0000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 000000000000042b FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f337dd64000 CR3: 000000011026e000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: do_writepages+0x12a/0x270 mm/page-writeback.c:2380 __writeback_single_inode+0xd5/0xa20 fs/fs-writeback.c:1470 writeback_sb_inodes+0x860/0x1400 fs/fs-writeback.c:1733 wb_writeback+0x3e3/0xb90 fs/fs-writeback.c:1908 wb_do_writeback fs/fs-writeback.c:2053 [inline] wb_workfn+0x38f/0xe20 fs/fs-writeback.c:2094 process_one_work+0x6e1/0xba0 kernel/workqueue.c:2301 worker_thread+0xa6a/0x13b0 kernel/workqueue.c:2447 kthread+0x346/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Modules linked in: ---[ end trace 51301fd10ca8708d ]--- RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2464 [inline] RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2505 [inline] RIP: 0010:ext4_writepages+0x2d49/0x2e00 fs/ext4/inode.c:2873 Code: 08 48 89 df e8 a8 16 ce ff 48 8b 3b 48 8b 74 24 40 48 8b 54 24 28 48 8b 4c 24 20 45 89 f0 e8 7e 42 07 00 eb 56 e8 c7 26 94 ff <0f> 0b e8 c0 26 94 ff eb 2f e8 b9 26 94 ff eb 64 e8 b2 26 94 ff 31