================================================================== BUG: KASAN: slab-use-after-free in handle_mm_fault+0x14f0/0x19a0 mm/memory.c:5842 Read of size 8 at addr ffff8880694ee118 by task syz.4.1202/9666 CPU: 1 UID: 0 PID: 9666 Comm: syz.4.1202 Not tainted 6.10.0-rc7-next-20240712-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/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:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 handle_mm_fault+0x14f0/0x19a0 mm/memory.c:5842 do_user_addr_fault arch/x86/mm/fault.c:1389 [inline] handle_page_fault arch/x86/mm/fault.c:1481 [inline] exc_page_fault+0x2b9/0x8c0 arch/x86/mm/fault.c:1539 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 RIP: 0010:fault_in_readable+0x165/0x2b0 mm/gup.c:2244 Code: b4 ff 4c 8d b3 ff 0f 00 00 48 89 d8 4d 01 e6 49 81 e6 00 f0 ff ff 49 39 c6 72 6b e8 15 a8 b4 ff 4c 39 f3 74 6e 4c 89 64 24 10 <44> 8a 23 43 0f b6 04 2f 84 c0 75 18 44 88 64 24 40 48 81 c3 00 10 RSP: 0000:ffffc90003f47a20 EFLAGS: 00050246 RAX: ffffffff81df2307 RBX: 0000000020929000 RCX: 0000000000040000 RDX: ffffc90009b89000 RSI: 000000000003ffff RDI: 0000000000040000 RBP: ffffc90003f47ad8 R08: ffffffff81df2278 R09: ffffffff84ae9859 R10: 0000000000000002 R11: ffff88802a348000 R12: 0000000000100000 R13: dffffc0000000000 R14: 0000000020a00000 R15: 1ffff920007e8f4c fault_in_iov_iter_readable+0x229/0x280 lib/iov_iter.c:94 generic_perform_write+0x29f/0x840 mm/filemap.c:4009 shmem_file_write_iter+0xfc/0x120 mm/shmem.c:3078 new_sync_write fs/read_write.c:497 [inline] vfs_write+0xa72/0xc90 fs/read_write.c:590 ksys_write+0x1a0/0x2c0 fs/read_write.c:643 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:0x7f8f02775bd9 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:00007f8f0352d048 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f8f02903f60 RCX: 00007f8f02775bd9 RDX: 000000000208e24b RSI: 0000000020000000 RDI: 0000000000000003 RBP: 00007f8f027e4e60 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f8f02903f60 R15: 00007ffe706d59f8 Allocated by task 9671: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:312 [inline] __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:338 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3988 [inline] slab_alloc_node mm/slub.c:4037 [inline] kmem_cache_alloc_noprof+0x135/0x2a0 mm/slub.c:4044 vm_area_alloc+0x24/0x1d0 kernel/fork.c:472 mmap_region+0xc3d/0x2090 mm/mmap.c:2944 do_mmap+0x8f9/0x1010 mm/mmap.c:1468 vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:588 ksys_mmap_pgoff+0x4f1/0x720 mm/mmap.c:1514 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 Freed by task 9662: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xe0/0x150 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2252 [inline] slab_free mm/slub.c:4473 [inline] kmem_cache_free+0x145/0x350 mm/slub.c:4548 rcu_do_batch kernel/rcu/tree.c:2569 [inline] rcu_core+0xafd/0x1830 kernel/rcu/tree.c:2843 handle_softirqs+0x2c4/0x970 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0x57/0xc0 arch/x86/kernel/apic/apic.c:1043 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702 Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47 __kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:541 __call_rcu_common kernel/rcu/tree.c:3106 [inline] call_rcu+0x167/0xa70 kernel/rcu/tree.c:3210 remove_vma mm/mmap.c:189 [inline] remove_mt mm/mmap.c:2415 [inline] do_vmi_align_munmap+0x155c/0x18c0 mm/mmap.c:2758 do_vmi_munmap+0x261/0x2f0 mm/mmap.c:2830 mmap_region+0x72f/0x2090 mm/mmap.c:2881 do_mmap+0x8f9/0x1010 mm/mmap.c:1468 vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:588 ksys_mmap_pgoff+0x4f1/0x720 mm/mmap.c:1514 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 The buggy address belongs to the object at ffff8880694ee0f8 which belongs to the cache vm_area_struct of size 184 The buggy address is located 32 bytes inside of freed 184-byte region [ffff8880694ee0f8, ffff8880694ee1b0) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x694ee memcg:ffff88802b173f01 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 00fff00000000000 ffff888015eefb40 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000100010 00000001fdffffff ffff88802b173f01 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x152cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 9671, tgid 9662 (syz.4.1202), ts 259817579308, free_ts 259425545983 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1493 prep_new_page mm/page_alloc.c:1501 [inline] get_page_from_freelist+0x2ccb/0x2d80 mm/page_alloc.c:3474 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4732 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x5f/0x120 mm/slub.c:2321 allocate_slab+0x5a/0x2f0 mm/slub.c:2484 new_slab mm/slub.c:2537 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3723 __slab_alloc+0x58/0xa0 mm/slub.c:3813 __slab_alloc_node mm/slub.c:3866 [inline] slab_alloc_node mm/slub.c:4025 [inline] kmem_cache_alloc_noprof+0x1c1/0x2a0 mm/slub.c:4044 vm_area_dup+0x27/0x290 kernel/fork.c:487 __split_vma+0x1a9/0xc30 mm/mmap.c:2465 do_vmi_align_munmap+0x433/0x18c0 mm/mmap.c:2676 do_vmi_munmap+0x261/0x2f0 mm/mmap.c:2830 mmap_region+0x72f/0x2090 mm/mmap.c:2881 do_mmap+0x8f9/0x1010 mm/mmap.c:1468 vm_mmap_pgoff+0x1dd/0x3d0 mm/util.c:588 ksys_mmap_pgoff+0x4f1/0x720 mm/mmap.c:1514 page last free pid 9640 tgid 9623 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1094 [inline] free_unref_page+0xd22/0xea0 mm/page_alloc.c:2644 tlb_batch_list_free mm/mmu_gather.c:159 [inline] tlb_finish_mmu+0x11f/0x200 mm/mmu_gather.c:468 exit_mmap+0x44f/0xc80 mm/mmap.c:3425 __mmput+0x115/0x390 kernel/fork.c:1347 exit_mm+0x220/0x310 kernel/exit.c:571 do_exit+0x9b2/0x27f0 kernel/exit.c:869 do_group_exit+0x207/0x2c0 kernel/exit.c:1031 get_signal+0x16a1/0x1740 kernel/signal.c:2917 arch_do_signal_or_restart+0x96/0x830 arch/x86/kernel/signal.c:310 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0xc9/0x370 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: ffff8880694ee000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880694ee080: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fa >ffff8880694ee100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880694ee180: fb fb fb fb fb fb fc fc fc fc fc fc fc fc 00 00 ffff8880694ee200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== ---------------- Code disassembly (best guess): 0: b4 ff mov $0xff,%ah 2: 4c 8d b3 ff 0f 00 00 lea 0xfff(%rbx),%r14 9: 48 89 d8 mov %rbx,%rax c: 4d 01 e6 add %r12,%r14 f: 49 81 e6 00 f0 ff ff and $0xfffffffffffff000,%r14 16: 49 39 c6 cmp %rax,%r14 19: 72 6b jb 0x86 1b: e8 15 a8 b4 ff call 0xffb4a835 20: 4c 39 f3 cmp %r14,%rbx 23: 74 6e je 0x93 25: 4c 89 64 24 10 mov %r12,0x10(%rsp) * 2a: 44 8a 23 mov (%rbx),%r12b <-- trapping instruction 2d: 43 0f b6 04 2f movzbl (%r15,%r13,1),%eax 32: 84 c0 test %al,%al 34: 75 18 jne 0x4e 36: 44 88 64 24 40 mov %r12b,0x40(%rsp) 3b: 48 rex.W 3c: 81 .byte 0x81 3d: c3 ret 3e: 00 10 add %dl,(%rax)