================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:837 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xbcc/0xe00 fs/ext4/extents.c:953 Read of size 4 at addr ffff88807becfe18 by task syz.0.93/4854 CPU: 0 PID: 4854 Comm: syz.0.93 Not tainted 6.1.141-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: dump_stack_lvl+0x168/0x22e lib/dump_stack.c:106 print_address_description mm/kasan/report.c:316 [inline] print_report+0xa8/0x220 mm/kasan/report.c:427 kasan_report+0x10b/0x140 mm/kasan/report.c:531 ext4_ext_binsearch fs/ext4/extents.c:837 [inline] ext4_find_extent+0xbcc/0xe00 fs/ext4/extents.c:953 ext4_ext_map_blocks+0x27d/0x66d0 fs/ext4/extents.c:4165 ext4_map_blocks+0x9d1/0x1b60 fs/ext4/inode.c:679 _ext4_get_block+0x1d7/0x4e0 fs/ext4/inode.c:822 ext4_get_block_unwritten+0x2a/0x100 fs/ext4/inode.c:855 __block_write_begin_int+0x54b/0x1a70 fs/buffer.c:1991 __block_write_begin fs/buffer.c:2041 [inline] block_page_mkwrite+0x2d8/0x5f0 fs/buffer.c:2510 ext4_page_mkwrite+0x3b2/0x10c0 fs/ext4/inode.c:6313 do_page_mkwrite+0x16b/0x5c0 mm/memory.c:3011 wp_page_shared+0x167/0x370 mm/memory.c:3360 handle_pte_fault mm/memory.c:5049 [inline] __handle_mm_fault mm/memory.c:5173 [inline] handle_mm_fault+0x1ca6/0x3e70 mm/memory.c:5294 do_user_addr_fault+0x51f/0xb10 arch/x86/mm/fault.c:1340 handle_page_fault arch/x86/mm/fault.c:1431 [inline] exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1487 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:608 RIP: 0010:copy_user_enhanced_fast_string+0xa/0x40 arch/x86/lib/copy_user_64.S:166 Code: ff c9 75 f2 89 d1 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 31 c0 0f 01 ca c3 8d 0c ca 89 ca eb 20 0f 01 cb 83 fa 40 72 38 89 d1 a4 31 c0 0f 01 ca c3 89 ca eb 0a 90 90 90 90 90 90 90 90 90 90 RSP: 0018:ffffc90003e17a88 EFLAGS: 00050246 RAX: ffffffff8407c001 RBX: 0000000000000040 RCX: 0000000000000040 RDX: 0000000000000040 RSI: ffffc90003e17b20 RDI: 000020000008b000 RBP: 0000000000000000 R08: dffffc0000000000 R09: fffff520007c2f6c R10: fffff520007c2f6c R11: 1ffff920007c2f64 R12: 00007fffffffefc0 R13: 000000007ffa7a80 R14: 000020000008b000 R15: ffffc90003e17b20 copy_user_generic arch/x86/include/asm/uaccess_64.h:37 [inline] raw_copy_to_user arch/x86/include/asm/uaccess_64.h:58 [inline] _copy_to_user+0xea/0x130 lib/usercopy.c:41 copy_to_user include/linux/uaccess.h:169 [inline] rng_dev_read+0x3c5/0x710 drivers/char/hw_random/core.c:267 do_loop_readv_writev fs/read_write.c:-1 [inline] do_iter_read+0x49f/0xb10 fs/read_write.c:798 vfs_readv fs/read_write.c:916 [inline] do_preadv+0x1f6/0x330 fs/read_write.c:1008 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f467338e929 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:00007f4674248038 EFLAGS: 00000246 ORIG_RAX: 0000000000000127 RAX: ffffffffffffffda RBX: 00007f46735b5fa0 RCX: 00007f467338e929 RDX: 0000000000000001 RSI: 0000200000000240 RDI: 0000000000000003 RBP: 00007f4673410b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f46735b5fa0 R15: 00007ffc84bf59f8 The buggy address belongs to the physical page: page:ffffea0001efb3c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x7becf flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 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 3, migratetype Unmovable, gfp_mask 0x52a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 4118, tgid 4118 (sshd-session), ts 66231421797, free_ts 159619756289 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2532 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x1a26/0x1ac0 mm/page_alloc.c:4328 __alloc_pages+0x1df/0x4e0 mm/page_alloc.c:5614 skb_page_frag_refill+0x175/0x310 net/core/sock.c:2876 add_recvbuf_mergeable drivers/net/virtio_net.c:1419 [inline] try_fill_recv+0x55b/0x1850 drivers/net/virtio_net.c:1460 virtnet_receive drivers/net/virtio_net.c:1574 [inline] virtnet_poll+0x712/0x1150 drivers/net/virtio_net.c:1680 __napi_poll+0xc0/0x460 net/core/dev.c:6578 napi_poll net/core/dev.c:6645 [inline] net_rx_action+0x5b1/0xad0 net/core/dev.c:6759 handle_softirqs+0x2a1/0x920 kernel/softirq.c:596 __do_softirq kernel/softirq.c:630 [inline] invoke_softirq kernel/softirq.c:470 [inline] __irq_exit_rcu+0x12f/0x220 kernel/softirq.c:679 irq_exit_rcu+0x5/0x20 kernel/softirq.c:691 common_interrupt+0xb5/0xd0 arch/x86/kernel/irq.c:242 asm_common_interrupt+0x22/0x40 arch/x86/include/asm/idtentry.h:682 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1459 [inline] free_pcp_prepare mm/page_alloc.c:1509 [inline] free_unref_page_prepare+0x8b4/0x9a0 mm/page_alloc.c:3384 free_unref_page+0x2e/0x3f0 mm/page_alloc.c:3479 skb_free_frag include/linux/skbuff.h:3241 [inline] skb_free_head net/core/skbuff.c:760 [inline] skb_release_data+0x646/0x7c0 net/core/skbuff.c:791 skb_release_all net/core/skbuff.c:856 [inline] __kfree_skb net/core/skbuff.c:870 [inline] skb_attempt_defer_free+0x107/0x410 net/core/skbuff.c:6676 tcp_eat_recv_skb net/ipv4/tcp.c:1661 [inline] tcp_recvmsg_locked+0x1190/0x22f0 net/ipv4/tcp.c:2674 tcp_recvmsg+0x212/0x810 net/ipv4/tcp.c:2720 inet_recvmsg+0x12c/0x1e0 net/ipv4/af_inet.c:890 sock_recvmsg_nosec net/socket.c:1022 [inline] sock_recvmsg net/socket.c:1040 [inline] sock_read_iter+0x2bf/0x370 net/socket.c:1121 call_read_iter include/linux/fs.h:2259 [inline] new_sync_read fs/read_write.c:389 [inline] vfs_read+0x434/0x920 fs/read_write.c:470 ksys_read+0x143/0x240 fs/read_write.c:613 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Memory state around the buggy address: ffff88807becfd00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88807becfd80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88807becfe00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88807becfe80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88807becff00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== ---------------- Code disassembly (best guess): 0: ff c9 dec %ecx 2: 75 f2 jne 0xfffffff6 4: 89 d1 mov %edx,%ecx 6: c1 e9 03 shr $0x3,%ecx 9: 83 e2 07 and $0x7,%edx c: f3 48 a5 rep movsq %ds:(%rsi),%es:(%rdi) f: 89 d1 mov %edx,%ecx 11: f3 a4 rep movsb %ds:(%rsi),%es:(%rdi) 13: 31 c0 xor %eax,%eax 15: 0f 01 ca clac 18: c3 ret 19: 8d 0c ca lea (%rdx,%rcx,8),%ecx 1c: 89 ca mov %ecx,%edx 1e: eb 20 jmp 0x40 20: 0f 01 cb stac 23: 83 fa 40 cmp $0x40,%edx 26: 72 38 jb 0x60 28: 89 d1 mov %edx,%ecx * 2a: f3 a4 rep movsb %ds:(%rsi),%es:(%rdi) <-- trapping instruction 2c: 31 c0 xor %eax,%eax 2e: 0f 01 ca clac 31: c3 ret 32: 89 ca mov %ecx,%edx 34: eb 0a jmp 0x40 36: 90 nop 37: 90 nop 38: 90 nop 39: 90 nop 3a: 90 nop 3b: 90 nop 3c: 90 nop 3d: 90 nop 3e: 90 nop 3f: 90 nop