================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:826 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:945 Read of size 4 at addr ffff888173e1125c by task syz-executor.5/9146 CPU: 0 PID: 9146 Comm: syz-executor.5 Not tainted 5.10.178-syzkaller-00127-g43c801dc3325 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:452 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 ext4_ext_binsearch fs/ext4/extents.c:826 [inline] ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:945 ext4_ext_map_blocks+0x26d/0x6be0 fs/ext4/extents.c:4097 ext4_map_blocks+0xaa7/0x1f00 fs/ext4/inode.c:646 mpage_map_one_extent fs/ext4/inode.c:2450 [inline] mpage_map_and_submit_extent fs/ext4/inode.c:2503 [inline] ext4_writepages+0x148b/0x3c00 fs/ext4/inode.c:2871 do_writepages+0x12e/0x270 mm/page-writeback.c:2358 __filemap_fdatawrite_range+0x33c/0x3f0 mm/filemap.c:427 file_write_and_wait_range+0x89/0x120 mm/filemap.c:766 ext4_sync_file+0x1a2/0xa30 fs/ext4/fsync.c:151 vfs_fsync_range+0x17b/0x190 fs/sync.c:202 generic_write_sync include/linux/fs.h:2825 [inline] ext4_buffered_write_iter+0x567/0x610 fs/ext4/file.c:280 ext4_file_write_iter+0x193/0x1ca0 fs/ext4/file.c:689 do_iter_readv_writev+0x58e/0x790 do_iter_write+0x183/0x650 fs/read_write.c:866 vfs_iter_write+0x7c/0xa0 fs/read_write.c:907 iter_file_splice_write+0x7f1/0xf80 fs/splice.c:686 do_splice_from fs/splice.c:764 [inline] direct_splice_actor+0xff/0x130 fs/splice.c:933 splice_direct_to_actor+0x4d1/0xba0 fs/splice.c:888 do_splice_direct+0x27f/0x3c0 fs/splice.c:976 do_sendfile+0x8f4/0x10e0 fs/read_write.c:1257 __do_sys_sendfile64 fs/read_write.c:1318 [inline] __se_sys_sendfile64 fs/read_write.c:1304 [inline] __x64_sys_sendfile64+0x1ce/0x230 fs/read_write.c:1304 do_syscall_64+0x34/0x70 entry_SYSCALL_64_after_hwframe+0x61/0xc6 RIP: 0033:0x7f244ad6f169 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f24416e0168 EFLAGS: 00000246 ORIG_RAX: 0000000000000028 RAX: ffffffffffffffda RBX: 00007f244ae8f120 RCX: 00007f244ad6f169 RDX: 0000000000000000 RSI: 0000000000000006 RDI: 0000000000000006 RBP: 00007f244adcaca1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000009 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd91a2bbbf R14: 00007f24416e0300 R15: 0000000000022000 The buggy address belongs to the page: page:ffffea0005cf8440 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x173e11 flags: 0x4000000000000000() raw: 4000000000000000 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 0x101cca(GFP_HIGHUSER_MOVABLE|__GFP_WRITE), pid 30751, ts 3222104512484, free_ts 3222444796012 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2455 [inline] prep_new_page+0x166/0x180 mm/page_alloc.c:2461 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4253 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5345 __alloc_pages include/linux/gfp.h:544 [inline] __alloc_pages_node include/linux/gfp.h:557 [inline] alloc_pages_node include/linux/gfp.h:571 [inline] alloc_pages include/linux/gfp.h:590 [inline] __page_cache_alloc include/linux/pagemap.h:290 [inline] pagecache_get_page+0x669/0x950 mm/filemap.c:1848 grab_cache_page_write_begin+0x5d/0xa0 mm/filemap.c:3451 ext4_da_write_begin+0x587/0xf60 fs/ext4/inode.c:3065 generic_perform_write+0x2cd/0x570 mm/filemap.c:3501 ext4_buffered_write_iter+0x47d/0x610 fs/ext4/file.c:272 ext4_file_write_iter+0x193/0x1ca0 fs/ext4/file.c:689 call_write_iter include/linux/fs.h:1976 [inline] new_sync_write fs/read_write.c:518 [inline] vfs_write+0xb55/0xe70 fs/read_write.c:605 ksys_write+0x199/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 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:1348 [inline] free_pcp_prepare mm/page_alloc.c:1420 [inline] free_unref_page_prepare+0x2ae/0x2d0 mm/page_alloc.c:3335 free_unref_page_list+0x122/0xb20 mm/page_alloc.c:3442 release_pages+0xea0/0xef0 mm/swap.c:1103 __pagevec_release+0x84/0x100 mm/swap.c:1123 pagevec_release include/linux/pagevec.h:88 [inline] truncate_inode_pages_range+0xa81/0x1ae0 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+0x4e0/0x1730 fs/ext4/inode.c:225 evict+0x2a3/0x6c0 fs/inode.c:577 iput_final fs/inode.c:1655 [inline] iput+0x632/0x7e0 fs/inode.c:1681 do_unlinkat+0x48e/0x8b0 fs/namei.c:4048 __do_sys_unlink fs/namei.c:4088 [inline] __se_sys_unlink fs/namei.c:4086 [inline] __x64_sys_unlink+0x49/0x50 fs/namei.c:4086 do_syscall_64+0x34/0x70 entry_SYSCALL_64_after_hwframe+0x61/0xc6 Memory state around the buggy address: ffff888173e11100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888173e11180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888173e11200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888173e11280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888173e11300: 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:2462! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 9146 Comm: syz-executor.5 Tainted: G B 5.10.178-syzkaller-00127-g43c801dc3325 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023 RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2462 [inline] RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2503 [inline] RIP: 0010:ext4_writepages+0x3b44/0x3c00 fs/ext4/inode.c:2871 Code: 00 74 08 48 89 df e8 1b 0f ca ff 48 8b 3b 48 8b 74 24 28 48 8b 54 24 50 44 89 e1 45 89 f8 e8 f3 e3 07 00 eb 5d e8 7c 01 8d ff <0f> 0b e8 75 01 8d ff eb 3b e8 6e 01 8d ff eb 77 e8 67 01 8d ff 31 RSP: 0018:ffffc900075bece0 EFLAGS: 00010293 RAX: ffffffff81dd71a4 RBX: dffffc0000000000 RCX: ffff888116cc2780 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc900075bf0d0 R08: ffffffff81dd4da9 R09: ffffed102b25d3d5 R10: 0000000000000000 R11: dffffc0000000001 R12: ffffc900075beff0 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 FS: 00007f24416e0700(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffc8f1b2c58 CR3: 000000011ec69000 CR4: 00000000003526b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: do_writepages+0x12e/0x270 mm/page-writeback.c:2358 __filemap_fdatawrite_range+0x33c/0x3f0 mm/filemap.c:427 file_write_and_wait_range+0x89/0x120 mm/filemap.c:766 ext4_sync_file+0x1a2/0xa30 fs/ext4/fsync.c:151 vfs_fsync_range+0x17b/0x190 fs/sync.c:202 generic_write_sync include/linux/fs.h:2825 [inline] ext4_buffered_write_iter+0x567/0x610 fs/ext4/file.c:280 ext4_file_write_iter+0x193/0x1ca0 fs/ext4/file.c:689 do_iter_readv_writev+0x58e/0x790 do_iter_write+0x183/0x650 fs/read_write.c:866 vfs_iter_write+0x7c/0xa0 fs/read_write.c:907 iter_file_splice_write+0x7f1/0xf80 fs/splice.c:686 do_splice_from fs/splice.c:764 [inline] direct_splice_actor+0xff/0x130 fs/splice.c:933 splice_direct_to_actor+0x4d1/0xba0 fs/splice.c:888 do_splice_direct+0x27f/0x3c0 fs/splice.c:976 do_sendfile+0x8f4/0x10e0 fs/read_write.c:1257 __do_sys_sendfile64 fs/read_write.c:1318 [inline] __se_sys_sendfile64 fs/read_write.c:1304 [inline] __x64_sys_sendfile64+0x1ce/0x230 fs/read_write.c:1304 do_syscall_64+0x34/0x70 entry_SYSCALL_64_after_hwframe+0x61/0xc6 RIP: 0033:0x7f244ad6f169 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f24416e0168 EFLAGS: 00000246 ORIG_RAX: 0000000000000028 RAX: ffffffffffffffda RBX: 00007f244ae8f120 RCX: 00007f244ad6f169 RDX: 0000000000000000 RSI: 0000000000000006 RDI: 0000000000000006 RBP: 00007f244adcaca1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000009 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd91a2bbbf R14: 00007f24416e0300 R15: 0000000000022000 Modules linked in: ---[ end trace c2dc98c678087bec ]--- RIP: 0010:mpage_map_one_extent fs/ext4/inode.c:2462 [inline] RIP: 0010:mpage_map_and_submit_extent fs/ext4/inode.c:2503 [inline] RIP: 0010:ext4_writepages+0x3b44/0x3c00 fs/ext4/inode.c:2871 Code: 00 74 08 48 89 df e8 1b 0f ca ff 48 8b 3b 48 8b 74 24 28 48 8b 54 24 50 44 89 e1 45 89 f8 e8 f3 e3 07 00 eb 5d e8 7c 01 8d ff <0f> 0b e8 75 01 8d ff eb 3b e8 6e 01 8d ff eb 77 e8 67 01 8d ff 31 RSP: 0018:ffffc900075bece0 EFLAGS: 00010293 RAX: ffffffff81dd71a4 RBX: dffffc0000000000 RCX: ffff888116cc2780 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc900075bf0d0 R08: ffffffff81dd4da9 R09: ffffed102b25d3d5 R10: 0000000000000000 R11: dffffc0000000001 R12: ffffc900075beff0 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 FS: 00007f24416e0700(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f0ac28c46be CR3: 000000011ec69000 CR4: 00000000003526a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400