================================================================== 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 ffff888125c5f6f4 by task kworker/u4:1/10 CPU: 1 PID: 10 Comm: kworker/u4:1 Not tainted 6.1.99-syzkaller-1151572-ga874ed06eb34 #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/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+0x257/0x7390 fs/ext4/extents.c:4142 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:2494 __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:386 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 The buggy address belongs to the physical page: page:ffffea00049717c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x125c5f flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea00048be988 ffffea0004971788 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 0x152c4a(GFP_NOFS|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL|__GFP_MOVABLE), pid 374, tgid 373 (syz-executor.0), ts 45578425862, free_ts 45658659482 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x213/0x220 mm/page_alloc.c:2590 prep_new_page+0x1b/0x110 mm/page_alloc.c:2597 get_page_from_freelist+0x2980/0x2a10 mm/page_alloc.c:4432 __alloc_pages+0x234/0x610 mm/page_alloc.c:5721 __folio_alloc+0x15/0x40 mm/page_alloc.c:5753 __folio_alloc_node include/linux/gfp.h:245 [inline] folio_alloc include/linux/gfp.h:274 [inline] filemap_alloc_folio include/linux/pagemap.h:513 [inline] page_cache_ra_unbounded+0x2a4/0x690 mm/readahead.c:259 do_page_cache_ra mm/readahead.c:311 [inline] page_cache_ra_order+0x987/0xc40 mm/readahead.c:575 ondemand_readahead+0x91a/0xee0 mm/readahead.c:699 page_cache_sync_ra+0x3d6/0x450 mm/readahead.c:726 page_cache_sync_readahead include/linux/pagemap.h:1257 [inline] filemap_get_pages mm/filemap.c:2660 [inline] filemap_read+0x7fa/0x2600 mm/filemap.c:2755 generic_file_read_iter+0xad/0x4e0 mm/filemap.c:2910 ext4_file_read_iter+0x330/0x470 call_read_iter include/linux/fs.h:2268 [inline] generic_file_splice_read+0x23c/0x630 fs/splice.c:308 do_splice_to fs/splice.c:792 [inline] splice_direct_to_actor+0x3fc/0xbb0 fs/splice.c:864 do_splice_direct+0x27f/0x3c0 fs/splice.c:973 do_sendfile+0x613/0xfe0 fs/read_write.c:1255 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1498 [inline] free_pcp_prepare mm/page_alloc.c:1572 [inline] free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3504 free_unref_page_list+0xf1/0x7b0 mm/page_alloc.c:3652 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:374 truncate_inode_pages mm/truncate.c:456 [inline] truncate_inode_pages_final+0x83/0x90 mm/truncate.c:495 ext4_evict_inode+0x684/0x1550 fs/ext4/inode.c:210 evict+0x2a3/0x630 fs/inode.c:666 dispose_list fs/inode.c:699 [inline] evict_inodes+0x5d1/0x650 fs/inode.c:749 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: ffff888125c5f580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888125c5f600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888125c5f680: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888125c5f700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888125c5f780: 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: 1 PID: 10 Comm: kworker/u4:1 Tainted: G B 6.1.99-syzkaller-1151572-ga874ed06eb34 #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: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 26 6b 80 ff be 00 10 00 00 48 c7 c7 f0 27 2c 87 4c 89 f2 e8 a2 2a ac 00 e9 0f fb ff ff e8 08 6b 80 ff 0f 0b e8 01 6b 80 ff <0f> 0b e8 ea a7 24 03 65 8b 05 13 d9 0c 7e 41 89 c7 4c 89 f8 48 c1 RSP: 0018:ffffc900000a7000 EFLAGS: 00010293 RAX: ffffffff81f5383f RBX: dffffc0000000000 RCX: ffff88810039d100 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc900000a7410 R08: ffffffff81f5154f R09: ffffed102175eadf R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000 R13: 0000000000000000 R14: ffff88810baf5730 R15: ffffc900000a72e0 FS: 0000000000000000(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f2f6ab0640e CR3: 000000010f4a9000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: do_writepages+0x385/0x620 mm/page-writeback.c:2494 __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:386 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 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 26 6b 80 ff be 00 10 00 00 48 c7 c7 f0 27 2c 87 4c 89 f2 e8 a2 2a ac 00 e9 0f fb ff ff e8 08 6b 80 ff 0f 0b e8 01 6b 80 ff <0f> 0b e8 ea a7 24 03 65 8b 05 13 d9 0c 7e 41 89 c7 4c 89 f8 48 c1 RSP: 0018:ffffc900000a7000 EFLAGS: 00010293 RAX: ffffffff81f5383f RBX: dffffc0000000000 RCX: ffff88810039d100 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc900000a7410 R08: ffffffff81f5154f R09: ffffed102175eadf R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000 R13: 0000000000000000 R14: ffff88810baf5730 R15: ffffc900000a72e0 FS: 0000000000000000(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000555555be3818 CR3: 000000010f4a9000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400