================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:827 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xba3/0xd80 fs/ext4/extents.c:946 Read of size 4 at addr ffff888124186138 by task kworker/u4:0/8 CPU: 1 PID: 8 Comm: kworker/u4:0 Not tainted 5.15.77-syzkaller-00764-g7048384c9872 #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:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description+0x87/0x3d0 mm/kasan/report.c:256 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0x1a6/0x1f0 mm/kasan/report.c:452 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 ext4_ext_binsearch fs/ext4/extents.c:827 [inline] ext4_find_extent+0xba3/0xd80 fs/ext4/extents.c:946 ext4_ext_map_blocks+0x22d/0x3cb0 fs/ext4/extents.c:4103 ext4_map_blocks+0xacd/0x1e20 fs/ext4/inode.c:640 ext4_convert_unwritten_extents+0x2ed/0x6e0 fs/ext4/extents.c:4818 ext4_convert_unwritten_io_end_vec+0x11d/0x1d0 fs/ext4/extents.c:4857 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+0x3a0/0x740 fs/ext4/page-io.c:273 process_one_work+0x6db/0xc00 kernel/workqueue.c:2313 worker_thread+0xb3e/0x1340 kernel/workqueue.c:2460 kthread+0x41c/0x500 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 The buggy address belongs to the page: page:ffffea0004906180 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x124186 flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea00048f87c8 ffffea00048181c8 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 0x101cca(GFP_HIGHUSER_MOVABLE|__GFP_WRITE), pid 478, ts 25605343424, free_ts 25856357935 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1ab/0x1b0 mm/page_alloc.c:2495 prep_new_page mm/page_alloc.c:2501 [inline] get_page_from_freelist+0x38b/0x400 mm/page_alloc.c:4281 __alloc_pages+0x3a8/0x7c0 mm/page_alloc.c:5548 __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] __page_cache_alloc include/linux/pagemap.h:305 [inline] pagecache_get_page+0xa60/0xdb0 mm/filemap.c:1940 grab_cache_page_write_begin+0x5c/0xa0 mm/filemap.c:3779 ext4_write_begin+0x292/0x1360 fs/ext4/inode.c:1188 ext4_da_write_begin+0x4ac/0xbf0 fs/ext4/inode.c:2979 generic_perform_write+0x2cd/0x5d0 mm/filemap.c:3825 ext4_buffered_write_iter+0x49b/0x630 fs/ext4/file.c:271 ext4_file_write_iter+0x448/0x1cc0 call_write_iter include/linux/fs.h:2129 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xc8d/0x1050 fs/read_write.c:594 ksys_write+0x198/0x2c0 fs/read_write.c:647 __do_sys_write fs/read_write.c:659 [inline] __se_sys_write fs/read_write.c:656 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:656 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1364 [inline] free_pcp_prepare+0x448/0x450 mm/page_alloc.c:1435 free_unref_page_prepare mm/page_alloc.c:3433 [inline] free_unref_page_list+0x16a/0xad0 mm/page_alloc.c:3554 release_pages+0xf3e/0xf90 mm/swap.c:1010 __pagevec_release+0x81/0xf0 mm/swap.c:1030 pagevec_release include/linux/pagevec.h:81 [inline] truncate_inode_pages_range+0x4b2/0x1150 mm/truncate.c:329 truncate_inode_pages mm/truncate.c:425 [inline] truncate_inode_pages_final+0x83/0x90 mm/truncate.c:464 ext4_evict_inode+0x3e9/0x1470 fs/ext4/inode.c:214 evict+0x2a3/0x630 fs/inode.c:587 dispose_list fs/inode.c:620 [inline] evict_inodes+0x638/0x6c0 fs/inode.c:670 generic_shutdown_super+0x9c/0x2d0 fs/super.c:454 kill_block_super+0x80/0xe0 fs/super.c:1395 deactivate_locked_super+0xb0/0x100 fs/super.c:335 deactivate_super+0xa5/0xd0 fs/super.c:366 cleanup_mnt+0x45f/0x510 fs/namespace.c:1143 __cleanup_mnt+0x19/0x20 fs/namespace.c:1150 task_work_run+0x147/0x1b0 kernel/task_work.c:164 Memory state around the buggy address: ffff888124186000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888124186080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888124186100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888124186180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888124186200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== ------------[ cut here ]------------ kernel BUG at fs/ext4/extents.c:3204! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 8 Comm: kworker/u4:0 Tainted: G B 5.15.77-syzkaller-00764-g7048384c9872 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work RIP: 0010:ext4_split_extent_at+0x12d4/0x1300 fs/ext4/extents.c:3204 Code: c1 38 c1 0f 8c 1b f9 ff ff 48 8b 7c 24 48 48 89 f3 e8 20 f4 c9 ff 48 89 de e9 06 f9 ff ff e8 23 90 87 ff 0f 0b e8 1c 90 87 ff <0f> 0b e8 15 90 87 ff 0f 0b e8 ee 4a d9 02 e8 09 90 87 ff 0f 0b e8 RSP: 0018:ffffc90000087400 EFLAGS: 00010293 RAX: ffffffff81e9ff74 RBX: 0000000000000000 RCX: ffff88810035e2c0 RDX: 0000000000000000 RSI: 0000000000000014 RDI: 0000000000000000 RBP: ffffc90000087570 R08: ffffffff81e9eef3 R09: ffffc90000087500 R10: fffff52000010ea2 R11: 1ffff92000010ea0 R12: 0000000000000000 R13: dffffc0000000000 R14: ffff8881241a06f4 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f146832a000 CR3: 000000011ec73000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: ext4_split_extent+0x369/0x4d0 fs/ext4/extents.c:3385 ext4_split_convert_extents fs/ext4/extents.c:3714 [inline] ext4_convert_unwritten_extents_endio fs/ext4/extents.c:3750 [inline] ext4_ext_handle_unwritten_extents+0x770/0x13e0 fs/ext4/extents.c:3898 ext4_ext_map_blocks+0xbfe/0x3cb0 fs/ext4/extents.c:4168 ext4_map_blocks+0xacd/0x1e20 fs/ext4/inode.c:640 ext4_convert_unwritten_extents+0x2ed/0x6e0 fs/ext4/extents.c:4818 ext4_convert_unwritten_io_end_vec+0x11d/0x1d0 fs/ext4/extents.c:4857 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+0x3a0/0x740 fs/ext4/page-io.c:273 process_one_work+0x6db/0xc00 kernel/workqueue.c:2313 worker_thread+0xb3e/0x1340 kernel/workqueue.c:2460 kthread+0x41c/0x500 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Modules linked in: ---[ end trace 6051cef24246704c ]--- RIP: 0010:ext4_split_extent_at+0x12d4/0x1300 fs/ext4/extents.c:3204 Code: c1 38 c1 0f 8c 1b f9 ff ff 48 8b 7c 24 48 48 89 f3 e8 20 f4 c9 ff 48 89 de e9 06 f9 ff ff e8 23 90 87 ff 0f 0b e8 1c 90 87 ff <0f> 0b e8 15 90 87 ff 0f 0b e8 ee 4a d9 02 e8 09 90 87 ff 0f 0b e8 RSP: 0018:ffffc90000087400 EFLAGS: 00010293 RAX: ffffffff81e9ff74 RBX: 0000000000000000 RCX: ffff88810035e2c0 RDX: 0000000000000000 RSI: 0000000000000014 RDI: 0000000000000000 RBP: ffffc90000087570 R08: ffffffff81e9eef3 R09: ffffc90000087500 R10: fffff52000010ea2 R11: 1ffff92000010ea0 R12: 0000000000000000 R13: dffffc0000000000 R14: ffff8881241a06f4 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f146832a000 CR3: 000000011a270000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400