================================================================== 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 ffff888125c46d2c by task kworker/u4:3/389 CPU: 1 PID: 389 Comm: kworker/u4:3 Not tainted 5.15.122-syzkaller-06757-g1463976ddc64 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work 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/0x1e00 fs/ext4/inode.c:646 ext4_convert_unwritten_extents+0x2e0/0x6c0 fs/ext4/extents.c:4815 ext4_convert_unwritten_io_end_vec+0x104/0x180 fs/ext4/extents.c:4854 ext4_end_io_end fs/ext4/page-io.c:186 [inline] ext4_do_flush_completed_IO fs/ext4/page-io.c:259 [inline] ext4_end_io_rsv_work+0x358/0x690 fs/ext4/page-io.c:273 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2317 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2464 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:ffffea0004971180 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x125c46 flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea000479fd08 ffffea0004971048 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 0x100cca(GFP_HIGHUSER_MOVABLE), pid 409, ts 44874991825, free_ts 45861594204 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2600 prep_new_page mm/page_alloc.c:2606 [inline] get_page_from_freelist+0x2ed2/0x2f90 mm/page_alloc.c:4474 __alloc_pages+0x206/0x5e0 mm/page_alloc.c:5765 __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+0x200/0x1b00 mm/memory.c:3185 do_wp_page+0x6fa/0xb60 handle_pte_fault+0x72e/0x2340 mm/memory.c:4858 do_handle_mm_fault+0x1fed/0x2330 mm/memory.c:5240 handle_mm_fault include/linux/mm.h:1836 [inline] do_user_addr_fault arch/x86/mm/fault.c:1458 [inline] handle_page_fault arch/x86/mm/fault.c:1549 [inline] exc_page_fault+0x3b5/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:1467 [inline] free_pcp_prepare mm/page_alloc.c:1539 [inline] free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3523 free_unref_page_list+0x14b/0xa60 mm/page_alloc.c:3660 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: ffff888125c46c00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888125c46c80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888125c46d00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888125c46d80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888125c46e00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop0): ext4_ext_split:1072: inode #19: comm kworker/u4:3: p_ext > EXT_MAX_EXTENT! EXT4-fs warning (device loop0): ext4_convert_unwritten_extents:4822: inode #19: block 32: len 1: ext4_ext_map_blocks returned -117 EXT4-fs error (device loop0): __ext4_get_inode_loc:4340: comm kworker/u4:3: Invalid inode table block 34360905424 in block_group 0 EXT4-fs error (device loop0) in ext4_reserve_inode_write:5820: Corrupt filesystem EXT4-fs error (device loop0): ext4_convert_unwritten_extents:4823: inode #19: comm kworker/u4:3: mark_inode_dirty error EXT4-fs (loop0): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117) EXT4-fs error (device loop0): ext4_ext_split:1072: inode #19: comm kworker/u4:3: p_ext > EXT_MAX_EXTENT! EXT4-fs warning (device loop0): ext4_convert_unwritten_extents:4822: inode #19: block 33: len 1: ext4_ext_map_blocks returned -117 EXT4-fs error (device loop0): __ext4_get_inode_loc:4340: comm kworker/u4:3: Invalid inode table block 34360905424 in block_group 0 EXT4-fs error (device loop0) in ext4_reserve_inode_write:5820: Corrupt filesystem EXT4-fs error (device loop0): ext4_convert_unwritten_extents:4823: inode #19: comm kworker/u4:3: mark_inode_dirty error EXT4-fs (loop0): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117) EXT4-fs error (device loop5): ext4_map_blocks:716: inode #19: block 193: comm kworker/u4:3: lblock 1 mapped to illegal pblock 193 (length 1) EXT4-fs warning (device loop5): ext4_convert_unwritten_extents:4822: inode #19: block 1: len 1: ext4_ext_map_blocks returned -117 EXT4-fs error (device loop5): __ext4_get_inode_loc:4340: comm kworker/u4:3: Invalid inode table block 34360905424 in block_group 0 EXT4-fs error (device loop5) in ext4_reserve_inode_write:5820: Corrupt filesystem EXT4-fs error (device loop5): ext4_convert_unwritten_extents:4823: inode #19: comm kworker/u4:3: mark_inode_dirty error EXT4-fs (loop5): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117) EXT4-fs error (device loop5): ext4_find_extent:929: inode #19: comm kworker/u4:3: pblk 208 bad header/extent: invalid magic - magic 6f69, entries 29795, max 9324(0), depth 20297(0) EXT4-fs warning (device loop5): ext4_convert_unwritten_extents:4822: inode #19: block 2: len 1: ext4_ext_map_blocks returned -117 EXT4-fs error (device loop5): __ext4_get_inode_loc:4340: comm kworker/u4:3: Invalid inode table block 34360905424 in block_group 0 EXT4-fs error (device loop5) in ext4_reserve_inode_write:5820: Corrupt filesystem EXT4-fs error (device loop5): ext4_convert_unwritten_extents:4823: inode #19: comm kworker/u4:3: mark_inode_dirty error EXT4-fs (loop5): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117) EXT4-fs error (device loop5): ext4_find_extent:929: inode #19: comm kworker/u4:3: pblk 208 bad header/extent: invalid magic - magic 6f69, entries 29795, max 9324(0), depth 20297(0) EXT4-fs warning (device loop5): ext4_convert_unwritten_extents:4822: inode #19: block 3: len 1: ext4_ext_map_blocks returned -117 EXT4-fs (loop5): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117) EXT4-fs warning (device loop5): ext4_convert_unwritten_extents:4822: inode #19: block 4: len 1: ext4_ext_map_blocks returned -117 EXT4-fs (loop5): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117) EXT4-fs warning (device loop5): ext4_convert_unwritten_extents:4822: inode #19: block 5: len 1: ext4_ext_map_blocks returned -117 EXT4-fs (loop5): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117) EXT4-fs warning (device loop5): ext4_convert_unwritten_extents:4822: inode #19: block 6: len 1: ext4_ext_map_blocks returned -117 EXT4-fs (loop5): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117) EXT4-fs warning (device loop5): ext4_convert_unwritten_extents:4822: inode #19: block 7: len 1: ext4_ext_map_blocks returned -117 EXT4-fs (loop5): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117)