================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:837 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:953 Read of size 4 at addr ffff888126a544cc by task kworker/u4:0/8 CPU: 1 PID: 8 Comm: kworker/u4:0 Not tainted 6.1.68-syzkaller-1150912-g75266774b9c4 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024 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 mm/kasan/report.c:316 [inline] print_report+0x158/0x4e0 mm/kasan/report.c:427 kasan_report+0x13c/0x170 mm/kasan/report.c:531 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:350 ext4_ext_binsearch fs/ext4/extents.c:837 [inline] ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:953 ext4_ext_map_blocks+0x255/0x71e0 fs/ext4/extents.c:4103 ext4_map_blocks+0xa36/0x1ca0 fs/ext4/inode.c:651 mpage_map_one_extent fs/ext4/inode.c:2423 [inline] mpage_map_and_submit_extent fs/ext4/inode.c:2476 [inline] ext4_writepages+0x17b5/0x3fd0 fs/ext4/inode.c:2844 do_writepages+0x385/0x620 mm/page-writeback.c:2472 __writeback_single_inode+0xdc/0xb80 fs/fs-writeback.c:1612 writeback_sb_inodes+0xb32/0x1910 fs/fs-writeback.c:1903 wb_writeback+0x3b9/0x9f0 fs/fs-writeback.c:2077 wb_do_writeback fs/fs-writeback.c:2220 [inline] wb_workfn+0x399/0x1030 fs/fs-writeback.c:2260 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299 worker_thread+0xa60/0x1260 kernel/workqueue.c:2446 kthread+0x26d/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 The buggy address belongs to the physical page: page:ffffea00049a9500 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x126a54 flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea00049a9548 ffffea00049a94c8 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 0x141cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP|__GFP_WRITE), pid 361, tgid 360 (syz-executor.0), ts 43034460692, free_ts 43118428715 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x213/0x220 mm/page_alloc.c:2566 prep_new_page+0x1b/0x110 mm/page_alloc.c:2573 get_page_from_freelist+0x27ea/0x2870 mm/page_alloc.c:4397 __alloc_pages+0x3a1/0x780 mm/page_alloc.c:5684 __folio_alloc+0x15/0x40 mm/page_alloc.c:5716 __folio_alloc_node include/linux/gfp.h:245 [inline] folio_alloc include/linux/gfp.h:274 [inline] filemap_alloc_folio include/linux/pagemap.h:474 [inline] __filemap_get_folio+0x827/0xae0 mm/filemap.c:1983 pagecache_get_page+0x2f/0x110 mm/folio-compat.c:110 grab_cache_page_write_begin+0x42/0x60 mm/folio-compat.c:122 ext4_write_begin+0x257/0xfb0 fs/ext4/inode.c:1197 ext4_da_write_begin+0x2ff/0x920 fs/ext4/inode.c:2989 generic_perform_write+0x2f9/0x5c0 mm/filemap.c:3829 ext4_buffered_write_iter+0x360/0x640 fs/ext4/file.c:285 ext4_file_write_iter+0x194/0x1570 do_iter_write+0x6e6/0xc50 fs/read_write.c:861 vfs_iter_write+0x7c/0xa0 fs/read_write.c:902 iter_file_splice_write+0x7f8/0xf90 fs/splice.c:686 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1474 [inline] free_pcp_prepare mm/page_alloc.c:1548 [inline] free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3470 free_unref_page_list+0xf1/0x7b0 mm/page_alloc.c:3618 release_pages+0xf7f/0xfe0 mm/swap.c:1063 __pagevec_release+0x84/0x100 mm/swap.c:1083 pagevec_release include/linux/pagevec.h:71 [inline] folio_batch_release include/linux/pagevec.h:135 [inline] truncate_inode_pages_range+0x1d1/0x1020 mm/truncate.c:375 truncate_inode_pages mm/truncate.c:457 [inline] truncate_inode_pages_final+0x83/0x90 mm/truncate.c:496 ext4_evict_inode+0x684/0x1550 fs/ext4/inode.c:210 evict+0x2a3/0x630 fs/inode.c:664 dispose_list fs/inode.c:697 [inline] evict_inodes+0x5d1/0x650 fs/inode.c:747 generic_shutdown_super+0x97/0x370 fs/super.c:482 kill_block_super+0x7e/0xe0 fs/super.c:1461 deactivate_locked_super+0xad/0x110 fs/super.c:334 deactivate_super+0xbe/0xf0 fs/super.c:365 cleanup_mnt+0x485/0x510 fs/namespace.c:1186 __cleanup_mnt+0x19/0x20 fs/namespace.c:1193 task_work_run+0x24d/0x2e0 kernel/task_work.c:179 Memory state around the buggy address: ffff888126a54380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888126a54400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888126a54480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888126a54500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888126a54580: 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:2435! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 8 Comm: kworker/u4:0 Tainted: G B 6.1.68-syzkaller-1150912-g75266774b9c4 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024 Workqueue: writeback wb_workfn (flush-7:0) RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2435 [inline] RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2476 [inline] RIP: 0010:ext4_writepages+0x3d6f/0x3fd0 fs/ext4/inode.c:2844 Code: e8 a6 6d 81 ff be 00 10 00 00 48 c7 c7 50 16 6c 86 4c 89 f2 e8 12 9f ab 00 e9 0f fb ff ff e8 88 6d 81 ff 0f 0b e8 81 6d 81 ff <0f> 0b e8 2a 7e 04 03 65 8b 05 13 10 0e 7e 41 89 c7 4c 89 f8 48 c1 RSP: 0018:ffffc90000087000 EFLAGS: 00010293 RAX: ffffffff81f4013f RBX: dffffc0000000000 RCX: ffff888100383cc0 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc90000087410 R08: ffffffff81f3de4f R09: ffffed10200afdbb R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000 R13: 0000000000000000 R14: ffff88810057ee10 R15: ffffc900000872e0 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffc90072e08 CR3: 000000000640f000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: do_writepages+0x385/0x620 mm/page-writeback.c:2472 __writeback_single_inode+0xdc/0xb80 fs/fs-writeback.c:1612 writeback_sb_inodes+0xb32/0x1910 fs/fs-writeback.c:1903 wb_writeback+0x3b9/0x9f0 fs/fs-writeback.c:2077 wb_do_writeback fs/fs-writeback.c:2220 [inline] wb_workfn+0x399/0x1030 fs/fs-writeback.c:2260 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299 worker_thread+0xa60/0x1260 kernel/workqueue.c:2446 kthread+0x26d/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2435 [inline] RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2476 [inline] RIP: 0010:ext4_writepages+0x3d6f/0x3fd0 fs/ext4/inode.c:2844 Code: e8 a6 6d 81 ff be 00 10 00 00 48 c7 c7 50 16 6c 86 4c 89 f2 e8 12 9f ab 00 e9 0f fb ff ff e8 88 6d 81 ff 0f 0b e8 81 6d 81 ff <0f> 0b e8 2a 7e 04 03 65 8b 05 13 10 0e 7e 41 89 c7 4c 89 f8 48 c1 RSP: 0018:ffffc90000087000 EFLAGS: 00010293 RAX: ffffffff81f4013f RBX: dffffc0000000000 RCX: ffff888100383cc0 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc90000087410 R08: ffffffff81f3de4f R09: ffffed10200afdbb R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000 R13: 0000000000000000 R14: ffff88810057ee10 R15: ffffc900000872e0 FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffc90072e08 CR3: 000000000640f000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400