================================================================== 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 ffff88811cb27078 by task kworker/u4:3/391 CPU: 1 PID: 391 Comm: kworker/u4:3 Not tainted 5.10.161-syzkaller-00019-g416c4356f372 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Workqueue: writeback wb_workfn (flush-7:0) 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 mpage_map_one_extent+0x1bd/0x680 fs/ext4/inode.c:2441 mpage_map_and_submit_extent fs/ext4/inode.c:2494 [inline] ext4_writepages+0x15e9/0x3710 fs/ext4/inode.c:2862 do_writepages+0x13a/0x280 mm/page-writeback.c:2358 __writeback_single_inode+0xb8/0x6e0 fs/fs-writeback.c:1467 writeback_sb_inodes+0x999/0x1700 fs/fs-writeback.c:1730 wb_writeback+0x42f/0xc20 fs/fs-writeback.c:1905 wb_do_writeback+0x222/0xbd0 fs/fs-writeback.c:2050 wb_workfn+0xf8/0x3f0 fs/fs-writeback.c:2091 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:ffffea000472c9c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x11cb27 flags: 0x8000000000000000() raw: 8000000000000000 ffffea0004700bc8 ffffea00046efb48 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 0x1100cca(GFP_HIGHUSER_MOVABLE), pid 483, ts 25457699083, free_ts 25587682001 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] shmem_alloc_page mm/shmem.c:1582 [inline] shmem_alloc_and_acct_page+0x899/0xbf0 mm/shmem.c:1607 shmem_getpage_gfp+0x8d4/0x25e0 mm/shmem.c:1920 shmem_getpage mm/shmem.c:162 [inline] shmem_write_begin+0xc8/0x1b0 mm/shmem.c:2502 generic_perform_write+0x309/0x5b0 mm/filemap.c:3468 __generic_file_write_iter+0x23c/0x560 mm/filemap.c:3597 generic_file_write_iter+0xaf/0x1c0 mm/filemap.c:3629 call_write_iter include/linux/fs.h:1969 [inline] new_sync_write fs/read_write.c:518 [inline] vfs_write+0xc4a/0xf80 fs/read_write.c:605 ksys_write+0x198/0x2c0 fs/read_write.c:658 __do_sys_write fs/read_write.c:670 [inline] __se_sys_write fs/read_write.c:667 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:667 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 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] shmem_undo_range+0x7ac/0x18d0 mm/shmem.c:966 shmem_truncate_range mm/shmem.c:1070 [inline] shmem_evict_inode+0x228/0xa20 mm/shmem.c:1170 evict+0x2a3/0x6c0 fs/inode.c:577 iput_final fs/inode.c:1655 [inline] iput+0x61f/0x7d0 fs/inode.c:1681 dentry_unlink_inode+0x2df/0x3d0 fs/dcache.c:374 __dentry_kill+0x3e2/0x5d0 fs/dcache.c:579 dentry_kill+0xc0/0x2a0 fs/dcache.c:692 dput+0x175/0x320 fs/dcache.c:878 __fput+0x540/0x7c0 fs/file_table.c:294 ____fput+0x15/0x20 fs/file_table.c:314 task_work_run+0x147/0x1b0 kernel/task_work.c:154 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop+0xc8/0xe0 kernel/entry/common.c:164 Memory state around the buggy address: ffff88811cb26f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88811cb26f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88811cb27000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88811cb27080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88811cb27100: 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:2453! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 391 Comm: kworker/u4:3 Tainted: G B 5.10.161-syzkaller-00019-g416c4356f372 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Workqueue: writeback wb_workfn (flush-7:0) RIP: 0010:mpage_map_one_extent+0x5df/0x680 fs/ext4/inode.c:2453 Code: f6 48 0f a3 05 62 7b c1 04 0f 92 c3 40 0f 92 c6 31 ff e8 b4 a3 8f ff 84 db 75 11 e8 9b a0 8f ff e9 74 fa ff ff e8 91 a0 8f ff <0f> 0b 65 ff 05 64 ec 24 7e 48 c7 c0 68 cf 9c 86 48 c1 e8 03 42 80 RSP: 0018:ffffc9000095f068 EFLAGS: 00010293 RAX: ffffffff81dd811f RBX: 0000000000000000 RCX: ffff888106582780 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc9000095f0b0 R08: ffffffff81dd7fa8 R09: ffffed10234ef843 R10: ffffed10234ef843 R11: 1ffff110234ef842 R12: 0000000000000000 R13: ffffc9000095f3b4 R14: 0000000000000000 R15: 1ffff9200012be77 FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000200090bf CR3: 000000000620f000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: mpage_map_and_submit_extent fs/ext4/inode.c:2494 [inline] ext4_writepages+0x15e9/0x3710 fs/ext4/inode.c:2862 do_writepages+0x13a/0x280 mm/page-writeback.c:2358 __writeback_single_inode+0xb8/0x6e0 fs/fs-writeback.c:1467 writeback_sb_inodes+0x999/0x1700 fs/fs-writeback.c:1730 wb_writeback+0x42f/0xc20 fs/fs-writeback.c:1905 wb_do_writeback+0x222/0xbd0 fs/fs-writeback.c:2050 wb_workfn+0xf8/0x3f0 fs/fs-writeback.c:2091 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 Modules linked in: ---[ end trace 86d91fab0311305b ]--- RIP: 0010:mpage_map_one_extent+0x5df/0x680 fs/ext4/inode.c:2453 Code: f6 48 0f a3 05 62 7b c1 04 0f 92 c3 40 0f 92 c6 31 ff e8 b4 a3 8f ff 84 db 75 11 e8 9b a0 8f ff e9 74 fa ff ff e8 91 a0 8f ff <0f> 0b 65 ff 05 64 ec 24 7e 48 c7 c0 68 cf 9c 86 48 c1 e8 03 42 80 RSP: 0018:ffffc9000095f068 EFLAGS: 00010293 RAX: ffffffff81dd811f RBX: 0000000000000000 RCX: ffff888106582780 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc9000095f0b0 R08: ffffffff81dd7fa8 R09: ffffed10234ef843 R10: ffffed10234ef843 R11: 1ffff110234ef842 R12: 0000000000000000 R13: ffffc9000095f3b4 R14: 0000000000000000 R15: 1ffff9200012be77 FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000200090bf CR3: 000000000620f000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400