EXT4-fs error (device loop3): __ext4_get_inode_loc:4409: comm syz-executor.3: Invalid inode table block 34360905424 in block_group 0 EXT4-fs error (device loop3) in ext4_reserve_inode_write:5869: Corrupt filesystem EXT4-fs error (device loop3): ext4_truncate:4361: inode #19: comm syz-executor.3: mark_inode_dirty error ================================================================== BUG: KASAN: use-after-free in ext4_ext_insert_extent+0x403c/0x4d20 fs/ext4/extents.c:2068 Read of size 4 at addr ffff8881224dc4a4 by task syz-executor.3/540 CPU: 1 PID: 540 Comm: syz-executor.3 Not tainted 5.10.222-syzkaller-1003210-gfd58936f3c1f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 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_insert_extent+0x403c/0x4d20 fs/ext4/extents.c:2068 ext4_split_extent_at+0x812/0x1110 fs/ext4/extents.c:3225 ext4_split_extent+0x1bd/0x4e0 fs/ext4/extents.c:3326 ext4_split_convert_extents fs/ext4/extents.c:3685 [inline] ext4_ext_handle_unwritten_extents fs/ext4/extents.c:3847 [inline] ext4_ext_map_blocks+0x2206/0x6ee0 fs/ext4/extents.c:4202 ext4_map_blocks+0xa65/0x1d10 fs/ext4/inode.c:644 mpage_map_one_extent fs/ext4/inode.c:2423 [inline] mpage_map_and_submit_extent fs/ext4/inode.c:2476 [inline] ext4_writepages+0x148b/0x3c00 fs/ext4/inode.c:2844 do_writepages+0x12e/0x270 mm/page-writeback.c:2380 __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:2870 [inline] ext4_buffered_write_iter+0x565/0x610 fs/ext4/file.c:278 ext4_file_write_iter+0x193/0x1c80 fs/ext4/file.c:685 call_write_iter include/linux/fs.h:2021 [inline] new_sync_write fs/read_write.c:518 [inline] vfs_write+0xb4c/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/0xcb RIP: 0033:0x7fd03e60e859 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fd03e1910c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fd03e72df80 RCX: 00007fd03e60e859 RDX: 000000000208e24b RSI: 0000000020000040 RDI: 0000000000000006 RBP: 00007fd03e66aad0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fd03e72df80 R15: 00007ffdf16a9078 The buggy address belongs to the page: page:ffffea0004893700 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x1224dc flags: 0x4000000000000000() raw: 4000000000000000 ffffea0004893748 ffffea0004890548 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 0x100cca(GFP_HIGHUSER_MOVABLE), pid 526, ts 48363396278, free_ts 48938176744 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2456 [inline] prep_new_page+0x166/0x180 mm/page_alloc.c:2462 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348 __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] shmem_alloc_page+0x257/0x420 mm/shmem.c:1580 shmem_alloc_and_acct_page+0x395/0x8e0 mm/shmem.c:1605 shmem_getpage_gfp+0x891/0x2480 mm/shmem.c:1918 shmem_getpage mm/shmem.c:161 [inline] shmem_write_begin+0xca/0x1b0 mm/shmem.c:2500 generic_perform_write+0x2cd/0x570 mm/filemap.c:3509 __generic_file_write_iter+0x23c/0x560 mm/filemap.c:3638 generic_file_write_iter+0xaf/0x1c0 mm/filemap.c:3670 call_write_iter include/linux/fs.h:2021 [inline] new_sync_write fs/read_write.c:518 [inline] vfs_write+0xb4c/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/0xcb page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1349 [inline] free_pcp_prepare mm/page_alloc.c:1421 [inline] free_unref_page_prepare+0x2ae/0x2d0 mm/page_alloc.c:3336 free_unref_page_list+0x122/0xb20 mm/page_alloc.c:3443 release_pages+0xea0/0xef0 mm/swap.c:1103 __pagevec_release+0x84/0x100 mm/swap.c:1123 pagevec_release include/linux/pagevec.h:88 [inline] shmem_undo_range+0x7d1/0x1a60 mm/shmem.c:965 shmem_truncate_range mm/shmem.c:1069 [inline] shmem_evict_inode+0x215/0x9d0 mm/shmem.c:1169 evict+0x2a3/0x6c0 fs/inode.c:577 iput_final fs/inode.c:1697 [inline] iput+0x632/0x7e0 fs/inode.c:1723 dentry_unlink_inode+0x2ea/0x3d0 fs/dcache.c:378 __dentry_kill+0x447/0x650 fs/dcache.c:583 dentry_kill+0xc0/0x2a0 dput+0x40/0x80 fs/dcache.c:883 __fput+0x52e/0x7b0 fs/file_table.c:294 ____fput+0x15/0x20 fs/file_table.c:314 task_work_run+0x129/0x190 kernel/task_work.c:165 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop+0xbf/0xd0 kernel/entry/common.c:172 Memory state around the buggy address: ffff8881224dc380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881224dc400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8881224dc480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8881224dc500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8881224dc580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop3): ext4_ext_split:1071: inode #19: comm syz-executor.3: p_ext > EXT_MAX_EXTENT! EXT4-fs (loop3): Delayed block allocation failed for inode 19 at logical offset 0 with max blocks 16 with error 117 EXT4-fs (loop3): This should not happen!! Data will be lost