BUG: Bad page map in process syz-executor.1 pte:a95a8027 pmd:1d602067
page:ffffea0002a56a00 refcount:1025 mapcount:-1 mapping:ffff888074a33c38 index:0x1a8 pfn:0xa95a8
head:ffffea0002a50000 order:9 compound_mapcount:0 compound_pincount:0
memcg:ffff8880271c0000
aops:shmem_aops ino:665 dentry name:"dev/zero"
flags: 0xfff0000009003f(locked|referenced|uptodate|dirty|lru|active|head|swapbacked|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0002a50001 dead000000000122 dead000000000400
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
head: 00fff0000009003e ffffea0000c42d88 ffff888077d89010 ffff888074a33c38
head: 0000000000000000 0000000000000000 0000020900000000 ffff8880271c0000
page dumped because: bad pte
page_owner tracks the page as allocated
page last allocated via order 9, migratetype Movable, gfp_mask 0x3c24ca(GFP_TRANSHUGE|__GFP_THISNODE), pid 25968, tgid 25964 (syz-executor.1), ts 783783271860, free_ts 757384091937
prep_new_page mm/page_alloc.c:2539 [inline]
get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4288
__alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5555
__alloc_pages_node include/linux/gfp.h:223 [inline]
hpage_collapse_alloc_page mm/khugepaged.c:807 [inline]
alloc_charge_hpage+0x2b8/0xaa0 mm/khugepaged.c:963
collapse_file+0x1ca/0x5780 mm/khugepaged.c:1715
hpage_collapse_scan_file+0xd6c/0x17a0 mm/khugepaged.c:2156
madvise_collapse+0x53d/0xb60 mm/khugepaged.c:2611
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
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
__pagevec_release+0x7b/0x110 mm/swap.c:1075
pagevec_release include/linux/pagevec.h:71 [inline]
folio_batch_release include/linux/pagevec.h:135 [inline]
shmem_undo_range+0x8eb/0x12a0 mm/shmem.c:946
shmem_truncate_range mm/shmem.c:1034 [inline]
shmem_evict_inode+0x3ca/0xc30 mm/shmem.c:1143
evict+0x2ed/0x6b0 fs/inode.c:664
iput_final fs/inode.c:1747 [inline]
iput.part.0+0x59b/0x880 fs/inode.c:1773
iput+0x5c/0x80 fs/inode.c:1763
dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401
__dentry_kill+0x3c0/0x640 fs/dcache.c:607
dentry_kill fs/dcache.c:733 [inline]
dput+0x80a/0xdb0 fs/dcache.c:913
__fput+0x3cc/0xa90 fs/file_table.c:328
task_work_run+0x16f/0x270 kernel/task_work.c:179
get_signal+0x1c7/0x2440 kernel/signal.c:2635
arch_do_signal_or_restart+0x86/0x2300 arch/x86/kernel/signal.c:869
addr:00000000201a8000 vm_flags:080000ff anon_vma:0000000000000000 mapping:ffff888074a33c38 index:1a8
file:dev/zero fault:shmem_fault mmap:shmem_mmap read_folio:0x0
CPU: 1 PID: 25969 Comm: syz-executor.1 Not tainted 6.1.0-rc5-syzkaller-00307-gfe24a97cf254 #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_bad_pte.cold+0x2a7/0x2d0 mm/memory.c:566
zap_pte_range mm/memory.c:1458 [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+0x2947/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:0x7fbf7dc8b639
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:00007fbf7ea12168 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
RAX: ffffffffffffffda RBX: 00007fbf7ddac120 RCX: 00007fbf7dc8b639
RDX: 0000000000000009 RSI: 000000000000ff0f RDI: 00000000201a0000
RBP: 00007fbf7dce6ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fbf7decfb1f R14: 00007fbf7ea12300 R15: 0000000000022000
==================================================================
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 ffff88801ff169c4 by task syz-executor.1/25969
CPU: 1 PID: 25969 Comm: syz-executor.1 Tainted: G B 6.1.0-rc5-syzkaller-00307-gfe24a97cf254 #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:0x7fbf7dc8b639
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:00007fbf7ea12168 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
RAX: ffffffffffffffda RBX: 00007fbf7ddac120 RCX: 00007fbf7dc8b639
RDX: 0000000000000009 RSI: 000000000000ff0f RDI: 00000000201a0000
RBP: 00007fbf7dce6ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fbf7decfb1f R14: 00007fbf7ea12300 R15: 0000000000022000
Allocated by task 25966:
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 25968:
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:1399
collapse_pte_mapped_thp+0xed7/0x1130 mm/khugepaged.c:1532
madvise_collapse+0x898/0xb60 mm/khugepaged.c:2631
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 ffff88801ff169c0
which belongs to the cache page->ptl of size 64
The buggy address is located 4 bytes inside of
64-byte region [ffff88801ff169c0, ffff88801ff16a00)
The buggy address belongs to the physical page:
page:ffffea00007fc580 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1ff16
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea0001dcb8c0 dead000000000003 ffff88801204f780
raw: 0000000000000000 00000000802a002a 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 3693, tgid 3693 (syz-executor.4), ts 194384373546, free_ts 194361968835
prep_new_page mm/page_alloc.c:2539 [inline]
get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4288
__alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5555
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
exit_mm kernel/exit.c:516 [inline]
do_exit+0xa41/0x2a30 kernel/exit.c:807
do_group_exit+0xd4/0x2a0 kernel/exit.c:950
get_signal+0x21b1/0x2440 kernel/signal.c:2858
arch_do_signal_or_restart+0x86/0x2300 arch/x86/kernel/signal.c:869
exit_to_user_mode_loop kernel/entry/common.c:168 [inline]
exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:203
__syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296
do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Memory state around the buggy address:
ffff88801ff16880: fc fc fc fc 00 00 00 00 00 00 00 00 fc fc fc fc
ffff88801ff16900: 00 00 00 00 00 00 00 00 fc fc fc fc 00 00 00 00
>ffff88801ff16980: 00 00 00 00 fc fc fc fc fa fb fb fb fb fb fb fb
^
ffff88801ff16a00: fc fc fc fc 00 00 00 00 00 00 00 00 fc fc fc fc
ffff88801ff16a80: 00 00 00 00 00 00 00 00 fc fc fc fc 00 00 00 00
==================================================================