================================================================== BUG: KASAN: use-after-free in __vma_adjust+0x18ee/0x1900 mm/mmap.c:766 Read of size 8 at addr ffff8880228ef568 by task syz-executor.1/15551 CPU: 1 PID: 15551 Comm: syz-executor.1 Not tainted 5.19.0-rc4-next-20220628-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:317 [inline] print_report.cold+0x2ba/0x719 mm/kasan/report.c:433 kasan_report+0xbe/0x1f0 mm/kasan/report.c:495 __vma_adjust+0x18ee/0x1900 mm/mmap.c:766 vma_merge+0x590/0x870 mm/mmap.c:1122 userfaultfd_unregister fs/userfaultfd.c:1621 [inline] userfaultfd_ioctl+0x3342/0x41d0 fs/userfaultfd.c:2001 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x7fc26c889209 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fc26d9cb168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fc26c99bf60 RCX: 00007fc26c889209 RDX: 00000000200000c0 RSI: 000000008010aa01 RDI: 0000000000000003 RBP: 00007fc26d9cb1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffed14b468f R14: 00007fc26d9cb300 R15: 0000000000022000 Allocated by task 3636: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:469 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:736 [inline] slab_alloc_node mm/slub.c:3243 [inline] slab_alloc mm/slub.c:3251 [inline] __kmem_cache_alloc_lru mm/slub.c:3258 [inline] kmem_cache_alloc+0x2d6/0x4c0 mm/slub.c:3268 vm_area_dup+0x81/0x380 kernel/fork.c:466 dup_mmap+0x642/0x1070 kernel/fork.c:640 dup_mm+0x91/0x370 kernel/fork.c:1520 copy_mm kernel/fork.c:1569 [inline] copy_process+0x3ca8/0x7080 kernel/fork.c:2237 kernel_clone+0xe7/0xab0 kernel/fork.c:2652 __do_sys_clone+0xba/0x100 kernel/fork.c:2786 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Freed by task 15551: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x166/0x1c0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1754 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1780 slab_free mm/slub.c:3534 [inline] kmem_cache_free+0xeb/0x5b0 mm/slub.c:3551 __vma_adjust+0x9ab/0x1900 mm/mmap.c:889 vma_merge+0x590/0x870 mm/mmap.c:1122 userfaultfd_unregister fs/userfaultfd.c:1621 [inline] userfaultfd_ioctl+0x3342/0x41d0 fs/userfaultfd.c:2001 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:870 [inline] __se_sys_ioctl fs/ioctl.c:856 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 The buggy address belongs to the object at ffff8880228ef510 which belongs to the cache vm_area_struct of size 152 The buggy address is located 88 bytes inside of 152-byte region [ffff8880228ef510, ffff8880228ef5a8) The buggy address belongs to the physical page: page:ffffea00008a3bc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x228ef memcg:ffff888076201d01 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea00006f0b40 dead000000000002 ffff888140006b40 raw: 0000000000000000 0000000000120012 00000001ffffffff ffff888076201d01 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 13009, tgid 13009 (syz-executor.3), ts 496084633286, free_ts 495246720911 prep_new_page mm/page_alloc.c:2535 [inline] get_page_from_freelist+0x210d/0x3a30 mm/page_alloc.c:4282 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5506 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2280 alloc_slab_page mm/slub.c:1824 [inline] allocate_slab+0x27e/0x3d0 mm/slub.c:1969 new_slab mm/slub.c:2029 [inline] ___slab_alloc+0x89d/0xef0 mm/slub.c:3031 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118 slab_alloc_node mm/slub.c:3209 [inline] slab_alloc mm/slub.c:3251 [inline] __kmem_cache_alloc_lru mm/slub.c:3258 [inline] kmem_cache_alloc+0x3fb/0x4c0 mm/slub.c:3268 vm_area_dup+0x81/0x380 kernel/fork.c:466 __split_vma+0x9f/0x530 mm/mmap.c:2276 split_vma+0x9f/0xe0 mm/mmap.c:2335 mprotect_fixup+0x746/0x960 mm/mprotect.c:613 do_mprotect_pkey+0x70f/0xa80 mm/mprotect.c:781 __do_sys_mprotect mm/mprotect.c:808 [inline] __se_sys_mprotect mm/mprotect.c:805 [inline] __x64_sys_mprotect+0x74/0xb0 mm/mprotect.c:805 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1453 [inline] free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1503 free_unref_page_prepare mm/page_alloc.c:3383 [inline] free_unref_page+0x19/0x4d0 mm/page_alloc.c:3479 tlb_batch_list_free mm/mmu_gather.c:74 [inline] tlb_finish_mmu+0x1a3/0x7e0 mm/mmu_gather.c:356 exit_mmap+0x1fe/0x720 mm/mmap.c:3212 __mmput+0x128/0x4c0 kernel/fork.c:1180 mmput+0x5c/0x70 kernel/fork.c:1201 exit_mm kernel/exit.c:510 [inline] do_exit+0xa09/0x29f0 kernel/exit.c:782 do_group_exit+0xd2/0x2f0 kernel/exit.c:925 get_signal+0x2542/0x2600 kernel/signal.c:2857 arch_do_signal_or_restart+0x82/0x2300 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop kernel/entry/common.c:166 [inline] exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Memory state around the buggy address: ffff8880228ef400: fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00 00 ffff8880228ef480: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc >ffff8880228ef500: fc fc fa fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880228ef580: fb fb fb fb fb fc fc fc fc fc fc fc fc 00 00 00 ffff8880228ef600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================