mmap: syz-executor.3 (6717) uses deprecated remap_file_pages() syscall. See Documentation/mm/remap_file_pages.rst. ================================================================== BUG: KASAN: slab-use-after-free in ptep_get include/linux/pgtable.h:317 [inline] BUG: KASAN: slab-use-after-free in ptep_get_lockless include/linux/pgtable.h:581 [inline] BUG: KASAN: slab-use-after-free in pte_range_none mm/memory.c:4409 [inline] BUG: KASAN: slab-use-after-free in finish_fault+0xf87/0x1460 mm/memory.c:4905 Read of size 8 at addr ffff88806ad78000 by task syz-executor.3/6717 CPU: 1 PID: 6717 Comm: syz-executor.3 Not tainted 6.10.0-rc3-next-20240611-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 Call Trace: __dump_stack lib/dump_stack.c:91 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:117 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 ptep_get include/linux/pgtable.h:317 [inline] ptep_get_lockless include/linux/pgtable.h:581 [inline] pte_range_none mm/memory.c:4409 [inline] finish_fault+0xf87/0x1460 mm/memory.c:4905 do_read_fault mm/memory.c:5052 [inline] do_fault mm/memory.c:5178 [inline] do_pte_missing mm/memory.c:3948 [inline] handle_pte_fault+0x3db5/0x7130 mm/memory.c:5502 __handle_mm_fault mm/memory.c:5645 [inline] handle_mm_fault+0x10df/0x1ba0 mm/memory.c:5810 faultin_page mm/gup.c:1339 [inline] __get_user_pages+0x6ef/0x1590 mm/gup.c:1638 populate_vma_page_range+0x264/0x330 mm/gup.c:2078 __mm_populate+0x27a/0x460 mm/gup.c:2181 mm_populate include/linux/mm.h:3442 [inline] __do_sys_remap_file_pages mm/mmap.c:3177 [inline] __se_sys_remap_file_pages+0x7a1/0x9a0 mm/mmap.c:3103 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:0x7f20fa87cea9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f20fb6b50c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000d8 RAX: ffffffffffffffda RBX: 00007f20fa9b3f80 RCX: 00007f20fa87cea9 RDX: 0000000000000000 RSI: 0000000000200000 RDI: 00000000202ec000 RBP: 00007f20fa8ebff4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f20fa9b3f80 R15: 00007ffee7b755c8 Allocated by task 6581: 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:3959 [inline] slab_alloc_node mm/slub.c:4019 [inline] kmem_cache_alloc_noprof+0x135/0x2a0 mm/slub.c:4026 ptlock_alloc+0x20/0x70 mm/memory.c:6562 ptlock_init include/linux/mm.h:2946 [inline] pagetable_pte_ctor include/linux/mm.h:2969 [inline] __pte_alloc_one_noprof include/asm-generic/pgalloc.h:73 [inline] pte_alloc_one+0xcd/0x5d0 arch/x86/mm/pgtable.c:33 __pte_alloc+0x79/0x3a0 mm/memory.c:448 do_anonymous_page mm/memory.c:4515 [inline] do_pte_missing mm/memory.c:3946 [inline] handle_pte_fault+0x55b4/0x7130 mm/memory.c:5502 __handle_mm_fault mm/memory.c:5645 [inline] handle_mm_fault+0x10df/0x1ba0 mm/memory.c:5810 do_user_addr_fault arch/x86/mm/fault.c:1338 [inline] handle_page_fault arch/x86/mm/fault.c:1481 [inline] exc_page_fault+0x459/0x8c0 arch/x86/mm/fault.c:1539 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 Freed by task 6581: 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:2214 [inline] slab_free mm/slub.c:4455 [inline] kmem_cache_free+0x145/0x350 mm/slub.c:4530 pagetable_pte_dtor include/linux/mm.h:2980 [inline] ___pte_free_tlb+0x2d/0x130 arch/x86/mm/pgtable.c:55 __pte_free_tlb arch/x86/include/asm/pgalloc.h:61 [inline] free_pte_range mm/memory.c:194 [inline] free_pmd_range mm/memory.c:212 [inline] free_pud_range mm/memory.c:246 [inline] free_p4d_range mm/memory.c:280 [inline] free_pgd_range+0x727/0xdd0 mm/memory.c:360 free_pgtables+0x719/0x840 exit_mmap+0x447/0xc80 mm/mmap.c:3393 __mmput+0x115/0x390 kernel/fork.c:1341 exit_mm+0x220/0x310 kernel/exit.c:565 do_exit+0x9aa/0x28e0 kernel/exit.c:861 do_group_exit+0x207/0x2c0 kernel/exit.c:1023 __do_sys_exit_group kernel/exit.c:1034 [inline] __se_sys_exit_group kernel/exit.c:1032 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1032 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 ffff88806ad78000 which belongs to the cache page->ptl of size 64 The buggy address is located 0 bytes inside of freed 64-byte region [ffff88806ad78000, ffff88806ad78040) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6ad78 anon flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 00fff00000000000 ffff88801504f780 0000000000000000 dead000000000001 raw: 0000000000000000 00000000002a002a 00000001fdffffff 0000000000000000 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 5826, tgid 5826 (syz-executor.0), ts 176796132919, free_ts 175851129675 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1470 prep_new_page mm/page_alloc.c:1478 [inline] get_page_from_freelist+0x2cbd/0x2d70 mm/page_alloc.c:3457 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4715 __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:2283 allocate_slab+0x5a/0x2f0 mm/slub.c:2446 new_slab mm/slub.c:2499 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3685 __slab_alloc+0x58/0xa0 mm/slub.c:3775 __slab_alloc_node mm/slub.c:3828 [inline] slab_alloc_node mm/slub.c:4007 [inline] kmem_cache_alloc_noprof+0x1c1/0x2a0 mm/slub.c:4026 ptlock_alloc mm/memory.c:6562 [inline] ptlock_init include/linux/mm.h:2946 [inline] pmd_ptlock_init include/linux/mm.h:3046 [inline] pagetable_pmd_ctor include/linux/mm.h:3084 [inline] pmd_alloc_one_noprof include/asm-generic/pgalloc.h:141 [inline] __pmd_alloc+0x110/0x630 mm/memory.c:6047 pmd_alloc include/linux/mm.h:2844 [inline] copy_pmd_range+0x8049/0x8500 mm/memory.c:1232 copy_pud_range mm/memory.c:1289 [inline] copy_p4d_range mm/memory.c:1313 [inline] copy_page_range+0x99f/0xe90 mm/memory.c:1411 dup_mmap kernel/fork.c:746 [inline] dup_mm kernel/fork.c:1669 [inline] copy_mm+0x11ea/0x1f30 kernel/fork.c:1718 copy_process+0x187a/0x3dc0 kernel/fork.c:2371 kernel_clone+0x226/0x8f0 kernel/fork.c:2778 __do_sys_clone kernel/fork.c:2921 [inline] __se_sys_clone kernel/fork.c:2905 [inline] __x64_sys_clone+0x258/0x2a0 kernel/fork.c:2905 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 page last free pid 5299 tgid 5299 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1089 [inline] free_unref_page+0xd22/0xea0 mm/page_alloc.c:2621 vfree+0x186/0x2e0 mm/vmalloc.c:3347 kcov_put kernel/kcov.c:429 [inline] kcov_close+0x2b/0x50 kernel/kcov.c:525 __fput+0x406/0x8b0 fs/file_table.c:422 task_work_run+0x24f/0x310 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa27/0x28e0 kernel/exit.c:874 do_group_exit+0x207/0x2c0 kernel/exit.c:1023 __do_sys_exit_group kernel/exit.c:1034 [inline] __se_sys_exit_group kernel/exit.c:1032 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1032 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: ffff88806ad77f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88806ad77f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88806ad78000: fa fb fb fb fb fb fb fb fc fc fc fc fa fb fb fb ^ ffff88806ad78080: fb fb fb fb fc fc fc fc fa fb fb fb fb fb fb fb ffff88806ad78100: fc fc fc fc fa fb fb fb fb fb fb fb fc fc fc fc ==================================================================