================================================================== BUG: KASAN: use-after-free in debug_spin_unlock kernel/locking/spinlock_debug.c:99 [inline] BUG: KASAN: use-after-free in do_raw_spin_unlock+0x1fa/0x230 kernel/locking/spinlock_debug.c:140 Read of size 4 at addr ffff888025e2d2a4 by task syz-executor.5/7128 CPU: 0 PID: 7128 Comm: syz-executor.5 Not tainted 6.1.0-rc7-syzkaller-00102-g04aa64375f48 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15e/0x45d mm/kasan/report.c:395 kasan_report+0xbf/0x1f0 mm/kasan/report.c:495 debug_spin_unlock kernel/locking/spinlock_debug.c:99 [inline] do_raw_spin_unlock+0x1fa/0x230 kernel/locking/spinlock_debug.c:140 __raw_spin_unlock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_unlock+0x1e/0x40 kernel/locking/spinlock.c:186 spin_unlock include/linux/spinlock.h:390 [inline] zap_pte_range mm/memory.c:1518 [inline] zap_pmd_range mm/memory.c:1577 [inline] zap_pud_range mm/memory.c:1606 [inline] zap_p4d_range mm/memory.c:1627 [inline] unmap_page_range+0x1368/0x3c90 mm/memory.c:1648 unmap_single_vma+0x190/0x2a0 mm/memory.c:1694 zap_page_range_single+0x2cc/0x430 mm/memory.c:1789 unmap_mapping_range_vma mm/memory.c:3494 [inline] unmap_mapping_range_tree mm/memory.c:3511 [inline] unmap_mapping_pages mm/memory.c:3577 [inline] unmap_mapping_range+0x1e7/0x280 mm/memory.c:3614 shmem_fallocate+0xcab/0xf00 mm/shmem.c:2757 vfs_fallocate+0x48b/0xe00 fs/open.c:323 madvise_remove mm/madvise.c:991 [inline] madvise_vma_behavior+0xb61/0x2050 mm/madvise.c:1015 madvise_walk_vmas+0x1c7/0x2b0 mm/madvise.c:1250 do_madvise.part.0+0x24a/0x340 mm/madvise.c:1429 do_madvise mm/madvise.c:1442 [inline] __do_sys_madvise mm/madvise.c:1442 [inline] __se_sys_madvise mm/madvise.c:1440 [inline] __x64_sys_madvise+0x117/0x150 mm/madvise.c:1440 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f0569a8c0d9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f056a841168 EFLAGS: 00000246 ORIG_RAX: 000000000000001c RAX: ffffffffffffffda RBX: 00007f0569bac050 RCX: 00007f0569a8c0d9 RDX: 0000000000000009 RSI: 000000000000ff0f RDI: 00000000201a0000 RBP: 00007f0569ae7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f0569ccfb1f R14: 00007f056a841300 R15: 0000000000022000 Allocated by task 7102: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x82/0x90 mm/kasan/common.c:325 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:737 [inline] slab_alloc_node mm/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x2b4/0x3d0 mm/slub.c:3422 ptlock_alloc+0x21/0x70 mm/memory.c:5842 ptlock_init include/linux/mm.h:2336 [inline] pgtable_pte_page_ctor include/linux/mm.h:2363 [inline] __pte_alloc_one include/asm-generic/pgalloc.h:66 [inline] pte_alloc_one+0x6c/0x230 arch/x86/mm/pgtable.c:33 do_fault_around mm/memory.c:4518 [inline] do_read_fault mm/memory.c:4549 [inline] do_fault mm/memory.c:4683 [inline] handle_pte_fault mm/memory.c:4955 [inline] __handle_mm_fault+0x3151/0x3a40 mm/memory.c:5097 handle_mm_fault+0x1cc/0x780 mm/memory.c:5218 faultin_page mm/gup.c:1009 [inline] __get_user_pages+0x497/0xf10 mm/gup.c:1230 populate_vma_page_range+0x241/0x320 mm/gup.c:1587 __mm_populate+0x105/0x3b0 mm/gup.c:1701 mm_populate include/linux/mm.h:2744 [inline] vm_mmap_pgoff+0x201/0x280 mm/util.c:525 ksys_mmap_pgoff+0x7d/0x5a0 mm/mmap.c:1458 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 7102: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:511 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] kmem_cache_free+0xee/0x5c0 mm/slub.c:3683 pgtable_pte_page_dtor include/linux/mm.h:2372 [inline] pte_free include/asm-generic/pgalloc.h:101 [inline] collapse_and_free_pmd+0x1ba/0x370 mm/khugepaged.c:1394 collapse_pte_mapped_thp+0xed7/0x1130 mm/khugepaged.c:1527 madvise_collapse+0x897/0xb60 mm/khugepaged.c:2626 madvise_vma_behavior+0x666/0x2050 mm/madvise.c:1076 madvise_walk_vmas+0x1c7/0x2b0 mm/madvise.c:1250 do_madvise.part.0+0x24a/0x340 mm/madvise.c:1429 do_madvise mm/madvise.c:1442 [inline] __do_sys_madvise mm/madvise.c:1442 [inline] __se_sys_madvise mm/madvise.c:1440 [inline] __x64_sys_madvise+0x117/0x150 mm/madvise.c:1440 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888025e2d2a0 which belongs to the cache page->ptl of size 64 The buggy address is located 4 bytes inside of 64-byte region [ffff888025e2d2a0, ffff888025e2d2e0) The buggy address belongs to the physical page: page:ffffea0000978b40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x25e2d flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0001f24480 dead000000000003 ffff88801204f780 raw: 0000000000000000 00000000002a002a 00000001ffffffff 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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 3211, tgid 3211 (dhcpcd), ts 34511286083, free_ts 27859563652 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4291 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5558 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2285 alloc_slab_page mm/slub.c:1794 [inline] allocate_slab+0x213/0x300 mm/slub.c:1939 new_slab mm/slub.c:1992 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3180 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279 slab_alloc_node mm/slub.c:3364 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x31a/0x3d0 mm/slub.c:3422 ptlock_alloc+0x21/0x70 mm/memory.c:5842 ptlock_init include/linux/mm.h:2336 [inline] pgtable_pte_page_ctor include/linux/mm.h:2363 [inline] __pte_alloc_one include/asm-generic/pgalloc.h:66 [inline] pte_alloc_one+0x6c/0x230 arch/x86/mm/pgtable.c:33 __pte_alloc+0x6d/0x260 mm/memory.c:468 copy_pte_range mm/memory.c:1036 [inline] copy_pmd_range mm/memory.c:1171 [inline] copy_pud_range mm/memory.c:1208 [inline] copy_p4d_range mm/memory.c:1232 [inline] copy_page_range+0x16e6/0x3900 mm/memory.c:1330 dup_mmap+0xc10/0x10b0 kernel/fork.c:691 dup_mm+0x91/0x370 kernel/fork.c:1526 copy_mm kernel/fork.c:1575 [inline] copy_process+0x3bc6/0x7190 kernel/fork.c:2253 kernel_clone+0xeb/0x980 kernel/fork.c:2671 __do_sys_clone+0xba/0x100 kernel/fork.c:2812 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+0x65c/0xd90 mm/page_alloc.c:1509 free_unref_page_prepare mm/page_alloc.c:3387 [inline] free_unref_page_list+0x176/0xc40 mm/page_alloc.c:3529 release_pages+0xc8a/0x1360 mm/swap.c:1055 tlb_batch_pages_flush+0xa8/0x1a0 mm/mmu_gather.c:59 tlb_flush_mmu_free mm/mmu_gather.c:256 [inline] tlb_flush_mmu mm/mmu_gather.c:263 [inline] tlb_finish_mmu+0x14b/0x7e0 mm/mmu_gather.c:363 exit_mmap+0x202/0x7b0 mm/mmap.c:3105 __mmput+0x128/0x4c0 kernel/fork.c:1185 mmput+0x60/0x70 kernel/fork.c:1207 exec_mmap fs/exec.c:1035 [inline] begin_new_exec+0xf9a/0x2e70 fs/exec.c:1294 load_elf_binary+0x801/0x4f10 fs/binfmt_elf.c:1002 search_binary_handler fs/exec.c:1727 [inline] exec_binprm fs/exec.c:1768 [inline] bprm_execve fs/exec.c:1837 [inline] bprm_execve+0x7ef/0x19f0 fs/exec.c:1799 do_execveat_common+0x724/0x890 fs/exec.c:1942 do_execve fs/exec.c:2016 [inline] __do_sys_execve fs/exec.c:2092 [inline] __se_sys_execve fs/exec.c:2087 [inline] __x64_sys_execve+0x93/0xc0 fs/exec.c:2087 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff888025e2d180: fa fb fb fb fb fb fb fb fc fc fc fc fa fb fb fb ffff888025e2d200: fb fb fb fb fc fc fc fc 00 00 00 00 00 00 00 00 >ffff888025e2d280: fc fc fc fc fa fb fb fb fb fb fb fb fc fc fc fc ^ ffff888025e2d300: 00 00 00 00 00 00 00 00 fc fc fc fc fa fb fb fb ffff888025e2d380: fb fb fb fb fc fc fc fc fa fb fb fb fb fb fb fb ==================================================================