================================================================== BUG: KASAN: slab-use-after-free in handle_mm_fault+0x14f0/0x19a0 mm/memory.c:5842 Read of size 8 at addr ffff88806dec9118 by task syz.2.455/6372 CPU: 0 UID: 0 PID: 6372 Comm: syz.2.455 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:do_strncpy_from_user lib/strncpy_from_user.c:41 [inline] RIP: 0010:strncpy_from_user+0x110/0x2f0 lib/strncpy_from_user.c:139 Code: 00 00 00 4c 89 e6 e8 1f bf a7 fc 49 83 fc 07 0f 86 9a 00 00 00 48 89 6c 24 08 48 c7 44 24 10 f8 ff ff ff 45 31 ed 4c 89 3c 24 <4f> 8b 3c 2f 48 b8 ff fe fe fe fe fe fe fe 49 8d 1c 07 4c 89 fd 48 RSP: 0018:ffffc9000a177ca8 EFLAGS: 00050246 RAX: 0000000000000000 RBX: ffff88802d03b300 RCX: ffff888020128000 RDX: 0000000000000000 RSI: 0000000000000fe0 RDI: 0000000000000007 RBP: 0000000000000fe0 R08: ffffffff84ec10b1 R09: 1ffffffff1f5ffad R10: dffffc0000000000 R11: fffffbfff1f5ffae R12: 0000000000000fe0 R13: 0000000000000000 R14: ffff88802d03b320 R15: 00000000200002c0 getname_flags+0xf1/0x540 fs/namei.c:150 do_sys_openat2+0xd2/0x1d0 fs/open.c:1410 do_sys_open fs/open.c:1431 [inline] __do_sys_openat fs/open.c:1447 [inline] __se_sys_openat fs/open.c:1442 [inline] __x64_sys_openat+0x247/0x2a0 fs/open.c:1442 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:0x7f389f375bd9 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:00007f38a0141048 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f389f503f60 RCX: 00007f389f375bd9 RDX: 0000000000000042 RSI: 00000000200002c0 RDI: ffffffffffffff9c RBP: 00007f389f3e4e60 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f389f503f60 R15: 00007ffca5301538 Allocated by task 6373: 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 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 6376: 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+0xa6/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+0x544/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 ffff88806dec90f8 which belongs to the cache vm_area_struct of size 184 The buggy address is located 32 bytes inside of freed 184-byte region [ffff88806dec90f8, ffff88806dec91b0) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6dec9 memcg:ffff88802ef2c101 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 00fff00000000000 ffff888015eefb40 ffffea0000a3a440 dead00000000000a raw: 0000000000000000 0000000000100010 00000001fdffffff ffff88802ef2c101 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5091, tgid 5091 (sshd), ts 81689048209, free_ts 75926000063 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 dup_mmap kernel/fork.c:696 [inline] dup_mm kernel/fork.c:1674 [inline] copy_mm+0xc7b/0x1f30 kernel/fork.c:1723 copy_process+0x186b/0x3d90 kernel/fork.c:2376 kernel_clone+0x226/0x8f0 kernel/fork.c:2788 __do_sys_clone kernel/fork.c:2931 [inline] __se_sys_clone kernel/fork.c:2915 [inline] __x64_sys_clone+0x258/0x2a0 kernel/fork.c:2915 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 page last free pid 5087 tgid 5087 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 __folio_put+0x2c8/0x440 mm/swap.c:128 pipe_buf_release include/linux/pipe_fs_i.h:219 [inline] pipe_update_tail fs/pipe.c:224 [inline] pipe_read+0x6f2/0x13e0 fs/pipe.c:344 new_sync_read fs/read_write.c:395 [inline] vfs_read+0x9bd/0xbc0 fs/read_write.c:476 ksys_read+0x1a0/0x2c0 fs/read_write.c:619 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 Memory state around the buggy address: ffff88806dec9000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806dec9080: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fa >ffff88806dec9100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806dec9180: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fa fb ffff88806dec9200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 00 00 add %al,(%rax) 2: 00 4c 89 e6 add %cl,-0x1a(%rcx,%rcx,4) 6: e8 1f bf a7 fc call 0xfca7bf2a b: 49 83 fc 07 cmp $0x7,%r12 f: 0f 86 9a 00 00 00 jbe 0xaf 15: 48 89 6c 24 08 mov %rbp,0x8(%rsp) 1a: 48 c7 44 24 10 f8 ff movq $0xfffffffffffffff8,0x10(%rsp) 21: ff ff 23: 45 31 ed xor %r13d,%r13d 26: 4c 89 3c 24 mov %r15,(%rsp) * 2a: 4f 8b 3c 2f mov (%r15,%r13,1),%r15 <-- trapping instruction 2e: 48 b8 ff fe fe fe fe movabs $0xfefefefefefefeff,%rax 35: fe fe fe 38: 49 8d 1c 07 lea (%r15,%rax,1),%rbx 3c: 4c 89 fd mov %r15,%rbp 3f: 48 rex.W