================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:840 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xb61/0xd50 fs/ext4/extents.c:955 Read of size 4 at addr ffff888075126c70 by task syz.0.54/6400 CPU: 1 UID: 0 PID: 6400 Comm: syz.0.54 Not tainted 6.14.0-rc2-syzkaller-00281-g496659003dac #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x169/0x550 mm/kasan/report.c:489 kasan_report+0x143/0x180 mm/kasan/report.c:602 ext4_ext_binsearch fs/ext4/extents.c:840 [inline] ext4_find_extent+0xb61/0xd50 fs/ext4/extents.c:955 ext4_ext_map_blocks+0x2e4/0x7d30 fs/ext4/extents.c:4205 ext4_map_create_blocks fs/ext4/inode.c:516 [inline] ext4_map_blocks+0x8bf/0x1990 fs/ext4/inode.c:702 ext4_convert_unwritten_extents+0x2f3/0x6c0 fs/ext4/extents.c:4876 ext4_dio_write_end_io+0xc5/0x1a0 fs/ext4/file.c:381 iomap_dio_complete+0x129/0x9c0 fs/iomap/direct-io.c:98 ext4_dio_write_iter fs/ext4/file.c:575 [inline] ext4_file_write_iter+0x17dc/0x1cd0 fs/ext4/file.c:715 iter_file_splice_write+0xbfa/0x1510 fs/splice.c:743 do_splice_from fs/splice.c:941 [inline] direct_splice_actor+0x11b/0x220 fs/splice.c:1164 splice_direct_to_actor+0x586/0xc80 fs/splice.c:1108 do_splice_direct_actor fs/splice.c:1207 [inline] do_splice_direct+0x289/0x3e0 fs/splice.c:1233 do_sendfile+0x564/0x8a0 fs/read_write.c:1363 __do_sys_sendfile64 fs/read_write.c:1424 [inline] __se_sys_sendfile64+0x17c/0x1e0 fs/read_write.c:1410 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f00a538cde9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f00a617c038 EFLAGS: 00000246 ORIG_RAX: 0000000000000028 RAX: ffffffffffffffda RBX: 00007f00a55a5fa0 RCX: 00007f00a538cde9 RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000004 RBP: 00007f00a540e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000800000009 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f00a55a5fa0 R15: 00007fffc2cf0388 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xb8d pfn:0x75126 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 ffffea0001d44990 0000000000000000 raw: 0000000000000b8d 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 2, migratetype Movable, gfp_mask 0x152c4a(GFP_NOFS|__GFP_HIGHMEM|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL|__GFP_MOVABLE), pid 6107, tgid 6081 (syz.0.18), ts 96609014444, free_ts 97961305513 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f4/0x240 mm/page_alloc.c:1551 prep_new_page mm/page_alloc.c:1559 [inline] get_page_from_freelist+0x3651/0x37a0 mm/page_alloc.c:3477 __alloc_frozen_pages_noprof+0x292/0x710 mm/page_alloc.c:4739 alloc_pages_mpol+0x311/0x660 mm/mempolicy.c:2270 alloc_frozen_pages_noprof mm/mempolicy.c:2341 [inline] alloc_pages_noprof+0x121/0x190 mm/mempolicy.c:2361 folio_alloc_noprof+0x1e/0x30 mm/mempolicy.c:2371 filemap_alloc_folio_noprof+0xe1/0x540 mm/filemap.c:1019 ractl_alloc_folio mm/readahead.c:187 [inline] ra_alloc_folio mm/readahead.c:442 [inline] page_cache_ra_order+0x5f4/0xca0 mm/readahead.c:510 filemap_readahead mm/filemap.c:2549 [inline] filemap_get_pages+0x9e4/0x1fb0 mm/filemap.c:2594 filemap_read+0x464/0x1260 mm/filemap.c:2691 xfs_file_buffered_read+0x1af/0x370 fs/xfs/xfs_file.c:290 xfs_file_read_iter+0x262/0x4d0 fs/xfs/xfs_file.c:315 __kernel_read+0x52e/0xa00 fs/read_write.c:523 integrity_kernel_read+0xb0/0x100 security/integrity/iint.c:28 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:480 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:511 [inline] ima_calc_file_hash+0xae6/0x1b30 security/integrity/ima/ima_crypto.c:568 ima_collect_measurement+0x529/0xb20 security/integrity/ima/ima_api.c:293 page last free pid 5825 tgid 5825 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_folios+0xe2f/0x18a0 mm/page_alloc.c:2707 folios_put_refs+0x76c/0x860 mm/swap.c:994 folio_batch_release include/linux/pagevec.h:101 [inline] truncate_inode_pages_range+0x460/0x10e0 mm/truncate.c:330 evict+0x4fd/0x9a0 fs/inode.c:798 dispose_list fs/inode.c:845 [inline] evict_inodes+0x6f6/0x790 fs/inode.c:899 generic_shutdown_super+0xa0/0x2d0 fs/super.c:627 kill_block_super+0x44/0x90 fs/super.c:1710 xfs_kill_sb+0x15/0x50 fs/xfs/xfs_super.c:2111 deactivate_locked_super+0xc4/0x130 fs/super.c:473 cleanup_mnt+0x41f/0x4b0 fs/namespace.c:1413 task_work_run+0x24f/0x310 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x13f/0x340 kernel/entry/common.c:218 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888075126b00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888075126b80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888075126c00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888075126c80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888075126d00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================