================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:837 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:953 Read of size 4 at addr ffff8881218f0788 by task kworker/u4:0/8 CPU: 0 PID: 8 Comm: kworker/u4:0 Not tainted 6.1.25-syzkaller-00088-gcd94fe67fd33 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 Workqueue: writeback wb_workfn (flush-7:0) Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:316 [inline] print_report+0x158/0x4e0 mm/kasan/report.c:427 kasan_report+0x13c/0x170 mm/kasan/report.c:531 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:350 ext4_ext_binsearch fs/ext4/extents.c:837 [inline] ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:953 ext4_ext_map_blocks+0x255/0x71e0 fs/ext4/extents.c:4103 ext4_map_blocks+0xa42/0x1ce0 fs/ext4/inode.c:651 mpage_map_one_extent fs/ext4/inode.c:2421 [inline] mpage_map_and_submit_extent fs/ext4/inode.c:2474 [inline] ext4_writepages+0x17b5/0x3fd0 fs/ext4/inode.c:2842 do_writepages+0x385/0x620 mm/page-writeback.c:2472 __writeback_single_inode+0xdc/0xb80 fs/fs-writeback.c:1590 writeback_sb_inodes+0xb33/0x18f0 fs/fs-writeback.c:1881 wb_writeback+0x3b9/0x9f0 fs/fs-writeback.c:2055 wb_do_writeback fs/fs-writeback.c:2198 [inline] wb_workfn+0x399/0x1030 fs/fs-writeback.c:2238 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2296 worker_thread+0xa60/0x1260 kernel/workqueue.c:2443 kthread+0x26d/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 The buggy address belongs to the physical page: page:ffffea0004863c00 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x1218f0 flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea0004863c48 ffffea0004863bc8 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 0x8140dca(GFP_HIGHUSER_MOVABLE|__GFP_COMP|__GFP_ZERO|__GFP_CMA), pid 261, tgid 261 (sshd), ts 17873501342, free_ts 17925146961 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x213/0x220 mm/page_alloc.c:2582 prep_new_page+0x1b/0x110 mm/page_alloc.c:2589 get_page_from_freelist+0x2762/0x27f0 mm/page_alloc.c:4387 __alloc_pages+0x3a1/0x780 mm/page_alloc.c:5664 __folio_alloc+0x15/0x40 mm/page_alloc.c:5696 __folio_alloc_node include/linux/gfp.h:245 [inline] folio_alloc include/linux/gfp.h:274 [inline] alloc_page_vma include/linux/gfp.h:283 [inline] do_anonymous_page mm/memory.c:4170 [inline] handle_pte_fault mm/memory.c:5049 [inline] __handle_mm_fault mm/memory.c:5193 [inline] handle_mm_fault+0x1fb0/0x2f40 mm/memory.c:5333 do_user_addr_fault arch/x86/mm/fault.c:1363 [inline] handle_page_fault arch/x86/mm/fault.c:1504 [inline] exc_page_fault+0x3a6/0x6e0 arch/x86/mm/fault.c:1560 asm_exc_page_fault+0x27/0x30 arch/x86/include/asm/idtentry.h:570 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1494 [inline] free_pcp_prepare mm/page_alloc.c:1568 [inline] free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3486 free_unref_page_list+0xf6/0x6c0 mm/page_alloc.c:3628 release_pages+0xf7f/0xfe0 mm/swap.c:1055 free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:314 tlb_batch_pages_flush mm/mmu_gather.c:59 [inline] tlb_flush_mmu_free mm/mmu_gather.c:254 [inline] tlb_flush_mmu mm/mmu_gather.c:261 [inline] tlb_finish_mmu+0x1e0/0x3f0 mm/mmu_gather.c:361 unmap_region+0x2c1/0x310 mm/mmap.c:2389 do_mas_align_munmap+0xd05/0x1400 mm/mmap.c:2654 do_mas_munmap+0x23e/0x2b0 mm/mmap.c:2712 __vm_munmap+0x263/0x3a0 mm/mmap.c:3002 __do_sys_munmap mm/mmap.c:3028 [inline] __se_sys_munmap mm/mmap.c:3024 [inline] __x64_sys_munmap+0x6b/0x80 mm/mmap.c:3024 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff8881218f0680: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881218f0700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8881218f0780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8881218f0800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881218f0880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== ------------[ cut here ]------------ kernel BUG at fs/ext4/inode.c:2433! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 8 Comm: kworker/u4:0 Tainted: G B 6.1.25-syzkaller-00088-gcd94fe67fd33 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 Workqueue: writeback wb_workfn (flush-7:0) RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2433 [inline] RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2474 [inline] RIP: 0010:ext4_writepages+0x3d6f/0x3fd0 fs/ext4/inode.c:2842 Code: e8 a6 f9 81 ff be 00 10 00 00 48 c7 c7 10 e3 cb 86 4c 89 f2 e8 02 5d ab 00 e9 0f fb ff ff e8 88 f9 81 ff 0f 0b e8 81 f9 81 ff <0f> 0b e8 da 9d 01 03 65 8b 05 db 30 0f 7e 41 89 c7 4c 89 f8 48 c1 RSP: 0018:ffffc90000087000 EFLAGS: 00010293 RAX: ffffffff81f2e06f RBX: dffffc0000000000 RCX: ffff88810037e540 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc90000087410 R08: ffffffff81f2bd7f R09: ffffed10200ad24b R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000 R13: 0000000000000000 R14: ffff888100569290 R15: ffffc900000872e0 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffc64833d68 CR3: 00000001225e0000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: do_writepages+0x385/0x620 mm/page-writeback.c:2472 __writeback_single_inode+0xdc/0xb80 fs/fs-writeback.c:1590 writeback_sb_inodes+0xb33/0x18f0 fs/fs-writeback.c:1881 wb_writeback+0x3b9/0x9f0 fs/fs-writeback.c:2055 wb_do_writeback fs/fs-writeback.c:2198 [inline] wb_workfn+0x399/0x1030 fs/fs-writeback.c:2238 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2296 worker_thread+0xa60/0x1260 kernel/workqueue.c:2443 kthread+0x26d/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2433 [inline] RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2474 [inline] RIP: 0010:ext4_writepages+0x3d6f/0x3fd0 fs/ext4/inode.c:2842 Code: e8 a6 f9 81 ff be 00 10 00 00 48 c7 c7 10 e3 cb 86 4c 89 f2 e8 02 5d ab 00 e9 0f fb ff ff e8 88 f9 81 ff 0f 0b e8 81 f9 81 ff <0f> 0b e8 da 9d 01 03 65 8b 05 db 30 0f 7e 41 89 c7 4c 89 f8 48 c1 RSP: 0018:ffffc90000087000 EFLAGS: 00010293 RAX: ffffffff81f2e06f RBX: dffffc0000000000 RCX: ffff88810037e540 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc90000087410 R08: ffffffff81f2bd7f R09: ffffed10200ad24b R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000 R13: 0000000000000000 R14: ffff888100569290 R15: ffffc900000872e0 FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020006000 CR3: 000000010e83f000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400