================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:827 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:946 Read of size 4 at addr ffff888156fda820 by task kworker/u4:2/45 CPU: 1 PID: 45 Comm: kworker/u4:2 Not tainted 5.15.106-syzkaller-00266-g36f4f6fb72d5 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/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+0x87/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:427 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:444 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 ext4_ext_binsearch fs/ext4/extents.c:827 [inline] ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:946 ext4_ext_map_blocks+0x254/0x7250 fs/ext4/extents.c:4103 ext4_map_blocks+0xaa7/0x1e30 fs/ext4/inode.c:646 mpage_map_one_extent fs/ext4/inode.c:2419 [inline] mpage_map_and_submit_extent fs/ext4/inode.c:2472 [inline] ext4_writepages+0x1628/0x4000 fs/ext4/inode.c:2840 do_writepages+0x40e/0x670 mm/page-writeback.c:2366 __writeback_single_inode+0xdf/0xa70 fs/fs-writeback.c:1622 writeback_sb_inodes+0xb2e/0x1910 fs/fs-writeback.c:1905 wb_writeback+0x3b9/0x9e0 fs/fs-writeback.c:2079 wb_do_writeback fs/fs-writeback.c:2222 [inline] wb_workfn+0x3d9/0x1110 fs/fs-writeback.c:2263 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2313 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2460 kthread+0x421/0x510 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 The buggy address belongs to the page: page:ffffea00055bf680 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x156fda flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea00055bf388 ffffea00055bf848 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 0x100dca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO), pid 8516, ts 296800588215, free_ts 296806291732 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2595 prep_new_page mm/page_alloc.c:2601 [inline] get_page_from_freelist+0x2eab/0x2f80 mm/page_alloc.c:4394 __alloc_pages+0x386/0x7b0 mm/page_alloc.c:5679 __alloc_pages_node include/linux/gfp.h:591 [inline] alloc_pages_node include/linux/gfp.h:605 [inline] alloc_pages include/linux/gfp.h:618 [inline] wp_page_copy+0x1d4/0x1950 mm/memory.c:3171 do_wp_page+0x6fa/0xb60 handle_pte_fault+0x72e/0x2340 mm/memory.c:4832 do_handle_mm_fault+0x1fed/0x2330 mm/memory.c:5214 do_user_addr_fault arch/x86/mm/fault.c:1365 [inline] handle_page_fault arch/x86/mm/fault.c:1549 [inline] exc_page_fault+0x26f/0x830 arch/x86/mm/fault.c:1605 asm_exc_page_fault+0x27/0x30 arch/x86/include/asm/idtentry.h:568 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1466 [inline] free_pcp_prepare mm/page_alloc.c:1538 [inline] free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3502 free_unref_page_list+0x14b/0xa60 mm/page_alloc.c:3633 release_pages+0x1310/0x1370 mm/swap.c:1009 free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:320 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+0x177/0x320 mm/mmu_gather.c:338 exit_mmap+0x3ef/0x6f0 mm/mmap.c:3211 __mmput+0x95/0x310 kernel/fork.c:1171 mmput+0x5b/0x170 kernel/fork.c:1194 exit_mm kernel/exit.c:551 [inline] do_exit+0xbb4/0x2b60 kernel/exit.c:862 do_group_exit+0x141/0x310 kernel/exit.c:997 get_signal+0x7a3/0x1630 kernel/signal.c:2891 arch_do_signal_or_restart+0xbd/0x1680 arch/x86/kernel/signal.c:865 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop+0xa0/0xe0 kernel/entry/common.c:172 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:208 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline] syscall_exit_to_user_mode+0x26/0x160 kernel/entry/common.c:301 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86 Memory state around the buggy address: ffff888156fda700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888156fda780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888156fda800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888156fda880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888156fda900: 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:2431! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 45 Comm: kworker/u4:2 Tainted: G B 5.15.106-syzkaller-00266-g36f4f6fb72d5 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023 Workqueue: writeback wb_workfn (flush-7:0) RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2431 [inline] RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2472 [inline] RIP: 0010:ext4_writepages+0x3f4b/0x4000 fs/ext4/inode.c:2840 Code: 00 74 08 48 89 df e8 a4 ef c9 ff 48 8b 3b 48 8b 74 24 48 48 8b 54 24 28 44 89 e9 45 89 f8 e8 ac 42 08 00 eb 58 e8 75 95 88 ff <0f> 0b e8 6e 95 88 ff eb 3b e8 67 95 88 ff eb 72 e8 60 95 88 ff 31 RSP: 0018:ffffc900002ef000 EFLAGS: 00010293 RAX: ffffffff81e745ab RBX: dffffc0000000000 RCX: ffff8881047be2c0 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc900002ef410 R08: ffffffff81e71f6b R09: ffffed1023ad65fc R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000 R13: ffffc900002ef2e0 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000555557058728 CR3: 000000000680f000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: do_writepages+0x40e/0x670 mm/page-writeback.c:2366 __writeback_single_inode+0xdf/0xa70 fs/fs-writeback.c:1622 writeback_sb_inodes+0xb2e/0x1910 fs/fs-writeback.c:1905 wb_writeback+0x3b9/0x9e0 fs/fs-writeback.c:2079 wb_do_writeback fs/fs-writeback.c:2222 [inline] wb_workfn+0x3d9/0x1110 fs/fs-writeback.c:2263 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2313 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2460 kthread+0x421/0x510 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Modules linked in: ---[ end trace e34e4ceba8179f42 ]--- RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2431 [inline] RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2472 [inline] RIP: 0010:ext4_writepages+0x3f4b/0x4000 fs/ext4/inode.c:2840 Code: 00 74 08 48 89 df e8 a4 ef c9 ff 48 8b 3b 48 8b 74 24 48 48 8b 54 24 28 44 89 e9 45 89 f8 e8 ac 42 08 00 eb 58 e8 75 95 88 ff <0f> 0b e8 6e 95 88 ff eb 3b e8 67 95 88 ff eb 72 e8 60 95 88 ff 31 RSP: 0018:ffffc900002ef000 EFLAGS: 00010293 RAX: ffffffff81e745ab RBX: dffffc0000000000 RCX: ffff8881047be2c0 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc900002ef410 R08: ffffffff81e71f6b R09: ffffed1023ad65fc R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000 R13: ffffc900002ef2e0 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f457aa7e058 CR3: 000000011e514000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400