================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:827 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xbea/0xe30 fs/ext4/extents.c:946 Read of size 4 at addr ffff88811d896064 by task kworker/u4:2/45 CPU: 1 PID: 45 Comm: kworker/u4:2 Not tainted 5.15.170-syzkaller-1076645-g431fb5556be3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: writeback wb_workfn (flush-7:0) Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1c0 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+0xbea/0xe30 fs/ext4/extents.c:946 ext4_ext_map_blocks+0x269/0x7450 fs/ext4/extents.c:4165 ext4_map_blocks+0xa60/0x1c70 fs/ext4/inode.c:673 mpage_map_one_extent fs/ext4/inode.c:2420 [inline] mpage_map_and_submit_extent fs/ext4/inode.c:2473 [inline] ext4_writepages+0x1628/0x4000 fs/ext4/inode.c:2841 do_writepages+0x40e/0x670 mm/page-writeback.c:2388 __writeback_single_inode+0xdf/0xa70 fs/fs-writeback.c:1647 writeback_sb_inodes+0xb2a/0x1920 fs/fs-writeback.c:1930 wb_writeback+0x3b9/0x9e0 fs/fs-writeback.c:2104 wb_do_writeback fs/fs-writeback.c:2247 [inline] wb_workfn+0x3d9/0x1110 fs/fs-writeback.c:2288 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472 kthread+0x421/0x510 kernel/kthread.c:337 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 The buggy address belongs to the page: page:ffffea0004762580 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x11d896 flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea00048ba3c8 ffffea0004762548 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 294, ts 28733002771, free_ts 30005734762 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2605 prep_new_page+0x1b/0x110 mm/page_alloc.c:2611 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4485 __alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5779 __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] do_anonymous_page mm/memory.c:4054 [inline] handle_pte_fault+0xe7e/0x25c0 mm/memory.c:4891 do_handle_mm_fault+0x20bc/0x2400 mm/memory.c:5315 do_user_addr_fault arch/x86/mm/fault.c:1325 [inline] handle_page_fault arch/x86/mm/fault.c:1509 [inline] exc_page_fault+0x26f/0x7f0 arch/x86/mm/fault.c:1565 asm_exc_page_fault+0x27/0x30 arch/x86/include/asm/idtentry.h:606 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1472 [inline] free_pcp_prepare mm/page_alloc.c:1544 [inline] free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3534 free_unref_page_list+0x14b/0xa60 mm/page_alloc.c:3671 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+0xd0/0x180 mm/mmu_gather.c:247 zap_pte_range mm/memory.c:1513 [inline] zap_pmd_range mm/memory.c:1562 [inline] zap_pud_range mm/memory.c:1591 [inline] zap_p4d_range mm/memory.c:1612 [inline] unmap_page_range+0x1c70/0x1ed0 mm/memory.c:1633 unmap_single_vma mm/memory.c:1678 [inline] unmap_vmas+0x389/0x560 mm/memory.c:1710 exit_mmap+0x3e4/0x940 mm/mmap.c:3215 __mmput+0x95/0x310 kernel/fork.c:1179 mmput+0x5b/0x170 kernel/fork.c:1202 exit_mm kernel/exit.c:554 [inline] do_exit+0xb9c/0x2ca0 kernel/exit.c:867 do_group_exit+0x141/0x310 kernel/exit.c:1002 get_signal+0x7a3/0x1630 kernel/signal.c:2907 arch_do_signal_or_restart+0xbd/0x1680 arch/x86/kernel/signal.c:867 handle_signal_work kernel/entry/common.c:154 [inline] exit_to_user_mode_loop+0xa0/0xe0 kernel/entry/common.c:178 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:214 Memory state around the buggy address: ffff88811d895f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88811d895f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88811d896000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88811d896080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88811d896100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop0): ext4_map_blocks:739: inode #16: block 1752346656768: comm kworker/u4:2: lblock 0 mapped to illegal pblock 1752346656768 (length 1) EXT4-fs (loop0): Delayed block allocation failed for inode 16 at logical offset 0 with max blocks 1 with error 117 EXT4-fs (loop0): This should not happen!! Data will be lost EXT4-fs error (device loop0): ext4_map_blocks:739: inode #16: block 1752346656770: comm kworker/u4:2: lblock 2 mapped to illegal pblock 1752346656770 (length 1) EXT4-fs (loop0): Delayed block allocation failed for inode 16 at logical offset 2 with max blocks 1 with error 117 EXT4-fs (loop0): This should not happen!! Data will be lost EXT4-fs error (device loop0): ext4_map_blocks:739: inode #16: block 116077965005016: comm kworker/u4:2: lblock 0 mapped to illegal pblock 116077965005016 (length 1) EXT4-fs (loop0): Delayed block allocation failed for inode 16 at logical offset 0 with max blocks 1 with error 117 EXT4-fs (loop0): This should not happen!! Data will be lost EXT4-fs error (device loop0): ext4_map_blocks:739: inode #16: block 116077965005018: comm kworker/u4:2: lblock 2 mapped to illegal pblock 116077965005018 (length 1) EXT4-fs (loop0): Delayed block allocation failed for inode 16 at logical offset 2 with max blocks 1 with error 117 EXT4-fs (loop0): This should not happen!! Data will be lost ------------[ cut here ]------------ kernel BUG at fs/ext4/inode.c:2432! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 45 Comm: kworker/u4:2 Tainted: G B 5.15.170-syzkaller-1076645-g431fb5556be3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: writeback wb_workfn (flush-7:0) RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2432 [inline] RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2473 [inline] RIP: 0010:ext4_writepages+0x3f4b/0x4000 fs/ext4/inode.c:2841 Code: 00 74 08 48 89 df e8 84 b5 c9 ff 48 8b 3b 48 8b 74 24 48 48 8b 54 24 28 44 89 e9 45 89 f8 e8 fc 3f 08 00 eb 58 e8 f5 5c 87 ff <0f> 0b e8 ee 5c 87 ff eb 3b e8 e7 5c 87 ff eb 72 e8 e0 5c 87 ff 31 RSP: 0018:ffffc900002ef000 EFLAGS: 00010293 RAX: ffffffff81e9092b RBX: dffffc0000000000 RCX: ffff8881055ba780 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc900002ef410 R08: ffffffff81e8e2eb R09: ffffed1024429486 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: 0000000020009000 CR3: 000000010ef1c000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: do_writepages+0x40e/0x670 mm/page-writeback.c:2388 __writeback_single_inode+0xdf/0xa70 fs/fs-writeback.c:1647 writeback_sb_inodes+0xb2a/0x1920 fs/fs-writeback.c:1930 wb_writeback+0x3b9/0x9e0 fs/fs-writeback.c:2104 wb_do_writeback fs/fs-writeback.c:2247 [inline] wb_workfn+0x3d9/0x1110 fs/fs-writeback.c:2288 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472 kthread+0x421/0x510 kernel/kthread.c:337 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Modules linked in: ---[ end trace 597f6aba9b6508e7 ]--- RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2432 [inline] RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2473 [inline] RIP: 0010:ext4_writepages+0x3f4b/0x4000 fs/ext4/inode.c:2841 Code: 00 74 08 48 89 df e8 84 b5 c9 ff 48 8b 3b 48 8b 74 24 48 48 8b 54 24 28 44 89 e9 45 89 f8 e8 fc 3f 08 00 eb 58 e8 f5 5c 87 ff <0f> 0b e8 ee 5c 87 ff eb 3b e8 e7 5c 87 ff eb 72 e8 e0 5c 87 ff 31 RSP: 0018:ffffc900002ef000 EFLAGS: 00010293 RAX: ffffffff81e9092b RBX: dffffc0000000000 RCX: ffff8881055ba780 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc900002ef410 R08: ffffffff81e8e2eb R09: ffffed1024429486 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: 0000555578bba818 CR3: 000000010d03e000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400