EXT4-fs warning (device loop4): ext4_convert_unwritten_extents:4817: inode #19: block 1: len 1: ext4_ext_map_blocks returned -117 EXT4-fs error (device loop4) in ext4_reserve_inode_write:5851: Out of memory EXT4-fs error (device loop4): ext4_convert_unwritten_extents:4818: inode #19: comm kworker/u4:2: mark_inode_dirty error EXT4-fs (loop4): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117) ================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:826 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xba3/0xd80 fs/ext4/extents.c:945 Read of size 4 at addr ffff88817cf0f138 by task kworker/u4:2/177 CPU: 0 PID: 177 Comm: kworker/u4:2 Not tainted 5.10.158-syzkaller-01201-g202ee063496e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3c0 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 ext4_ext_binsearch fs/ext4/extents.c:826 [inline] ext4_find_extent+0xba3/0xd80 fs/ext4/extents.c:945 ext4_ext_map_blocks+0x219/0x3a30 fs/ext4/extents.c:4097 ext4_map_blocks+0xa93/0x1ee0 fs/ext4/inode.c:638 ext4_convert_unwritten_extents+0x2ad/0x5d0 fs/ext4/extents.c:4810 ext4_convert_unwritten_io_end_vec+0x11d/0x1d0 fs/ext4/extents.c:4849 ext4_end_io_end fs/ext4/page-io.c:189 [inline] ext4_do_flush_completed_IO fs/ext4/page-io.c:262 [inline] ext4_end_io_rsv_work+0x3a0/0x710 fs/ext4/page-io.c:276 process_one_work+0x726/0xc10 kernel/workqueue.c:2296 worker_thread+0xb27/0x1550 kernel/workqueue.c:2442 kthread+0x349/0x3d0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:299 The buggy address belongs to the page: page:ffffea0005f3c3c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x17cf0f flags: 0x8000000000000000() raw: 8000000000000000 dead000000000100 dead000000000122 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 0x1101cca(GFP_HIGHUSER_MOVABLE|__GFP_WRITE), pid 9287, ts 359403026812, free_ts 359907102908 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2386 [inline] prep_new_page mm/page_alloc.c:2392 [inline] get_page_from_freelist+0x755/0x810 mm/page_alloc.c:4073 __alloc_pages_nodemask+0x3b6/0x890 mm/page_alloc.c:5160 __alloc_pages include/linux/gfp.h:529 [inline] __alloc_pages_node include/linux/gfp.h:542 [inline] alloc_pages_node include/linux/gfp.h:556 [inline] alloc_pages include/linux/gfp.h:575 [inline] __page_cache_alloc include/linux/pagemap.h:290 [inline] pagecache_get_page+0x567/0x850 mm/filemap.c:1848 grab_cache_page_write_begin+0x5c/0xa0 mm/filemap.c:3418 ext4_da_write_begin+0x5c2/0xf10 fs/ext4/inode.c:3056 generic_perform_write+0x309/0x5b0 mm/filemap.c:3468 ext4_buffered_write_iter+0x47c/0x610 fs/ext4/file.c:272 ext4_file_write_iter+0x192/0x1c70 fs/ext4/file.c:689 __kernel_write+0x5ad/0x9d0 fs/read_write.c:550 dump_emit fs/coredump.c:849 [inline] dump_user_range+0x25b/0x3b0 fs/coredump.c:902 elf_core_dump+0x3156/0x3cd0 fs/binfmt_elf.c:2287 do_coredump+0x1f7c/0x2dc0 fs/coredump.c:811 get_signal+0xdde/0x1440 kernel/signal.c:2774 arch_do_signal+0x8e/0x650 arch/x86/kernel/signal.c:805 exit_to_user_mode_loop+0xa3/0xe0 kernel/entry/common.c:161 exit_to_user_mode_prepare kernel/entry/common.c:191 [inline] syscall_exit_to_user_mode+0x77/0xa0 kernel/entry/common.c:266 page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1332 [inline] free_pcp_prepare+0x18c/0x1c0 mm/page_alloc.c:1406 free_unref_page_prepare mm/page_alloc.c:3293 [inline] free_unref_page_list+0x11d/0x660 mm/page_alloc.c:3367 release_pages+0xc24/0xc60 mm/swap.c:1082 __pagevec_release+0x81/0xf0 mm/swap.c:1102 pagevec_release include/linux/pagevec.h:88 [inline] truncate_inode_pages_range+0x9f8/0x1940 mm/truncate.c:367 truncate_inode_pages mm/truncate.c:473 [inline] truncate_inode_pages_final+0xc1/0xd0 mm/truncate.c:524 ext4_evict_inode+0x41f/0x1730 fs/ext4/inode.c:223 evict+0x2a3/0x6c0 fs/inode.c:577 iput_final fs/inode.c:1655 [inline] iput+0x61f/0x7d0 fs/inode.c:1681 do_unlinkat+0x51a/0x920 fs/namei.c:3982 __do_sys_unlink fs/namei.c:4022 [inline] __se_sys_unlink fs/namei.c:4020 [inline] __x64_sys_unlink+0x49/0x50 fs/namei.c:4020 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 Memory state around the buggy address: ffff88817cf0f000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88817cf0f080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88817cf0f100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88817cf0f180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88817cf0f200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop4): ext4_map_blocks:718: inode #19: block 2: comm kworker/u4:2: lblock 2 mapped to illegal pblock 2 (length 1) EXT4-fs warning (device loop4): ext4_convert_unwritten_extents:4817: inode #19: block 2: len 1: ext4_ext_map_blocks returned -117 EXT4-fs error (device loop4) in ext4_reserve_inode_write:5851: Out of memory EXT4-fs error (device loop4): ext4_convert_unwritten_extents:4818: inode #19: comm kworker/u4:2: mark_inode_dirty error EXT4-fs (loop4): failed to convert unwritten extents to written extents -- potential data loss! (inode 19, error -117)