EXT4-fs error (device loop4): ext4_truncate:4292: inode #19: comm syz-executor.4: mark_inode_dirty error ================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:827 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:946 Read of size 4 at addr ffff888126431a58 by task syz-executor.4/406 CPU: 1 PID: 406 Comm: syz-executor.4 Not tainted 5.15.156-syzkaller-1070798-g29d153aabd54 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1c0 lib/dump_stack.c:106 print_address_description+0x87/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:427 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:444 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 ext4_ext_binsearch fs/ext4/extents.c:827 [inline] ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:946 ext4_ext_map_blocks+0x269/0x74a0 fs/ext4/extents.c:4142 ext4_map_blocks+0xaa7/0x1e00 fs/ext4/inode.c:646 mpage_map_one_extent fs/ext4/inode.c:2409 [inline] mpage_map_and_submit_extent fs/ext4/inode.c:2462 [inline] ext4_writepages+0x1628/0x4000 fs/ext4/inode.c:2830 do_writepages+0x40e/0x670 mm/page-writeback.c:2366 filemap_fdatawrite_wbc+0x248/0x2a0 mm/filemap.c:404 __filemap_fdatawrite_range mm/filemap.c:437 [inline] file_write_and_wait_range+0x1cb/0x2b0 mm/filemap.c:814 ext4_sync_file+0x1a2/0xa50 fs/ext4/fsync.c:151 vfs_fsync_range+0x17b/0x190 fs/sync.c:188 generic_write_sync include/linux/fs.h:3025 [inline] ext4_buffered_write_iter+0x568/0x610 fs/ext4/file.c:277 ext4_file_write_iter+0x443/0x1c80 call_write_iter include/linux/fs.h:2204 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xd5d/0x1110 fs/read_write.c:594 ksys_write+0x199/0x2c0 fs/read_write.c:647 __do_sys_write fs/read_write.c:659 [inline] __se_sys_write fs/read_write.c:656 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:656 x64_sys_call+0x2f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:2 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7fa33da9c859 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:00007fa33d61f0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fa33dbbbf80 RCX: 00007fa33da9c859 RDX: 000000000208e24b RSI: 0000000020000040 RDI: 0000000000000006 RBP: 00007fa33daf8ad0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fa33dbbbf80 R15: 00007ffca2ddd968 The buggy address belongs to the page: page:ffffea0004990c40 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x126431 flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea0004990c88 ffffea0004990c08 0000000000000000 raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner info is not present (never set?) Memory state around the buggy address: ffff888126431900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888126431980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888126431a00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888126431a80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888126431b00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop4): ext4_map_blocks:716: inode #19: comm syz-executor.4: lblock 0 mapped to illegal pblock 0 (length 16) EXT4-fs (loop4): Delayed block allocation failed for inode 19 at logical offset 0 with max blocks 16 with error 117 EXT4-fs (loop4): This should not happen!! Data will be lost