BUG: KASAN: out-of-bounds in ext4_ext_binsearch fs/ext4/extents.c:837 [inline] BUG: KASAN: out-of-bounds in ext4_find_extent+0xcc0/0xd20 fs/ext4/extents.c:953 Read of size 4 at addr ffff88811a383400 by task syz-executor.3/23467 CPU: 1 PID: 23467 Comm: syz-executor.3 Not tainted 6.4.0-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351 print_report mm/kasan/report.c:462 [inline] kasan_report+0x11c/0x130 mm/kasan/report.c:572 ext4_ext_binsearch fs/ext4/extents.c:837 [inline] ext4_find_extent+0xcc0/0xd20 fs/ext4/extents.c:953 ext4_ext_map_blocks+0x1e1/0x5be0 fs/ext4/extents.c:4102 ext4_map_blocks+0xa7f/0x18d0 fs/ext4/inode.c:548 _ext4_get_block+0x241/0x580 fs/ext4/inode.c:779 ext4_get_block fs/ext4/inode.c:796 [inline] __ext4_block_zero_page_range fs/ext4/inode.c:3652 [inline] ext4_block_zero_page_range+0x849/0x9e0 fs/ext4/inode.c:3732 ext4_block_truncate_page fs/ext4/inode.c:3756 [inline] ext4_truncate+0xf28/0x1340 fs/ext4/inode.c:4133 ext4_setattr+0x1b24/0x2880 fs/ext4/inode.c:5460 notify_change+0xb2c/0x1180 fs/attr.c:483 do_truncate+0x143/0x200 fs/open.c:66 do_sys_ftruncate+0x53a/0x770 fs/open.c:194 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f4c45c8c389 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:00007f4c46915168 EFLAGS: 00000246 ORIG_RAX: 000000000000004d RAX: ffffffffffffffda RBX: 00007f4c45dac120 RCX: 00007f4c45c8c389 RDX: 0000000000000000 RSI: 0000000002007ffb RDI: 0000000000000005 RBP: 00007f4c45cd7493 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffe3e73a86f R14: 00007f4c46915300 R15: 0000000000022000 The buggy address belongs to the physical page: page:ffffea000468e0c0 refcount:1 mapcount:0 mapping:ffff888026edeff0 index:0xe86 pfn:0x11a383 memcg:ffff88810fcdc000 aops:shmem_aops ino:71c dentry name:"memfd:syzkaller" flags: 0x57ff4000008001e(referenced|uptodate|dirty|lru|swapbacked|node=1|zone=2|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 057ff4000008001e ffffea000468e088 ffffea000468e108 ffff888026edeff0 raw: 0000000000000e86 0000000000000000 00000001ffffffff ffff88810fcdc000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Movable, gfp_mask 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 23457, tgid 23456 (syz-executor.2), ts 430446073926, free_ts 430292695275 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731 prep_new_page mm/page_alloc.c:1738 [inline] get_page_from_freelist+0xf41/0x2c00 mm/page_alloc.c:3502 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4768 __folio_alloc+0x16/0x40 mm/page_alloc.c:4800 vma_alloc_folio+0x155/0x890 mm/mempolicy.c:2240 shmem_alloc_folio+0x119/0x1e0 mm/shmem.c:1579 shmem_alloc_and_acct_folio+0x15e/0x5d0 mm/shmem.c:1603 shmem_get_folio_gfp+0x9cc/0x1a80 mm/shmem.c:1948 shmem_get_folio mm/shmem.c:2079 [inline] shmem_write_begin+0x14a/0x380 mm/shmem.c:2573 generic_perform_write+0x256/0x570 mm/filemap.c:3929 __generic_file_write_iter+0x2ae/0x500 mm/filemap.c:4057 generic_file_write_iter+0xe3/0x350 mm/filemap.c:4089 call_write_iter include/linux/fs.h:1868 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x945/0xd50 fs/read_write.c:584 ksys_write+0x12b/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x62e/0xcb0 mm/page_alloc.c:2564 free_unref_page_list+0xe3/0xa70 mm/page_alloc.c:2705 release_pages+0xcd8/0x1380 mm/swap.c:1042 __pagevec_release+0x77/0xe0 mm/swap.c:1062 pagevec_release include/linux/pagevec.h:63 [inline] folio_batch_release include/linux/pagevec.h:132 [inline] shmem_undo_range+0x583/0x1130 mm/shmem.c:954 shmem_truncate_range mm/shmem.c:1049 [inline] shmem_evict_inode+0x32f/0xb60 mm/shmem.c:1164 evict+0x2ed/0x6b0 fs/inode.c:665 iput_final fs/inode.c:1747 [inline] iput.part.0+0x50a/0x740 fs/inode.c:1773 iput+0x5c/0x80 fs/inode.c:1763 dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401 __dentry_kill+0x3c0/0x640 fs/dcache.c:607 dentry_kill fs/dcache.c:733 [inline] dput+0x865/0xe10 fs/dcache.c:913 __fput+0x3cc/0xa90 fs/file_table.c:329 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 Memory state around the buggy address: ffff88811a383300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88811a383380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88811a383400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff88811a383480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88811a383500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================