[syzbot] [mm?] KASAN: use-after-free Read in ptdump_pte_entry
From: syzbot
Date: Mon Jan 20 2025 - 11:49:44 EST
Hello,
syzbot found the following issue on:
HEAD commit: fbfd64d25c7a Merge tag 'vfs-6.13-rc7.fixes' of git://git.k..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=17b3f6f8580000
kernel config: https://syzkaller.appspot.com/x/.config?x=ad08f7f48e13abcd
dashboard link: https://syzkaller.appspot.com/bug?extid=5de79efe17a3a69f3f42
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/f3a88252bb2e/disk-fbfd64d2.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6da96fcb8b08/vmlinux-fbfd64d2.xz
kernel image: https://storage.googleapis.com/syzbot-assets/31096786c237/bzImage-fbfd64d2.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+5de79efe17a3a69f3f42@xxxxxxxxxxxxxxxxxxxxxxxxx
==================================================================
BUG: KASAN: use-after-free in ptep_get include/linux/pgtable.h:338 [inline]
BUG: KASAN: use-after-free in ptep_get_lockless include/linux/pgtable.h:608 [inline]
BUG: KASAN: use-after-free in ptdump_pte_entry+0xf6/0x100 mm/ptdump.c:123
Read of size 8 at addr ffff888063ceb250 by task syz.5.1535/13402
CPU: 1 UID: 0 PID: 13402 Comm: syz.5.1535 Not tainted 6.13.0-rc6-syzkaller-00036-gfbfd64d25c7a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0xc3/0x620 mm/kasan/report.c:489
kasan_report+0xd9/0x110 mm/kasan/report.c:602
ptep_get include/linux/pgtable.h:338 [inline]
ptep_get_lockless include/linux/pgtable.h:608 [inline]
ptdump_pte_entry+0xf6/0x100 mm/ptdump.c:123
walk_pte_range_inner+0x256/0x360 mm/pagewalk.c:50
walk_pte_range mm/pagewalk.c:81 [inline]
walk_pmd_range mm/pagewalk.c:156 [inline]
walk_pud_range mm/pagewalk.c:226 [inline]
walk_p4d_range mm/pagewalk.c:264 [inline]
walk_pgd_range+0xfe4/0x1a70 mm/pagewalk.c:305
walk_page_range_novma+0x1b5/0x260 mm/pagewalk.c:648
ptdump_walk_pgd+0xec/0x2f0 mm/ptdump.c:158
ptdump_walk_pgd_level_core+0x15f/0x220 arch/x86/mm/dump_pagetables.c:391
ptdump_walk_pgd_level_checkwx+0x63/0x90 arch/x86/mm/dump_pagetables.c:444
check_wx_show+0x13/0x70 mm/ptdump.c:170
seq_read_iter+0x4f4/0x12b0 fs/seq_file.c:230
seq_read+0x39f/0x4e0 fs/seq_file.c:162
full_proxy_read+0xfb/0x1b0 fs/debugfs/file.c:351
do_loop_readv_writev fs/read_write.c:840 [inline]
do_loop_readv_writev fs/read_write.c:828 [inline]
vfs_readv+0x6bf/0x890 fs/read_write.c:1013
do_readv+0x133/0x340 fs/read_write.c:1073
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f502dd85d29
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:00007f502eb19038 EFLAGS: 00000246 ORIG_RAX: 0000000000000013
RAX: ffffffffffffffda RBX: 00007f502df76160 RCX: 00007f502dd85d29
RDX: 0000000000000003 RSI: 0000000020000080 RDI: 0000000000000005
RBP: 00007f502de01b08 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f502df76160 R15: 00007ffd027c0568
</TASK>
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x63ceb
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea00018f3a88 ffffea00018f3b08 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), pid 5829, tgid 5829 (syz-executor), ts 88137978099, free_ts 552862775146
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1558
prep_new_page mm/page_alloc.c:1566 [inline]
get_page_from_freelist+0xfce/0x2f80 mm/page_alloc.c:3476
__alloc_pages_noprof+0x223/0x25b0 mm/page_alloc.c:4753
alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2269
pagetable_alloc_noprof include/linux/mm.h:2899 [inline]
__pte_alloc_one_kernel_noprof include/asm-generic/pgalloc.h:21 [inline]
pte_alloc_one_kernel_noprof include/asm-generic/pgalloc.h:39 [inline]
__pte_alloc_kernel+0x22/0x200 mm/memory.c:458
vmap_pages_pte_range mm/vmalloc.c:497 [inline]
vmap_pages_pmd_range mm/vmalloc.c:529 [inline]
vmap_pages_pud_range mm/vmalloc.c:547 [inline]
vmap_pages_p4d_range mm/vmalloc.c:565 [inline]
vmap_small_pages_range_noflush+0xb38/0xd30 mm/vmalloc.c:587
__vmap_pages_range_noflush+0x67d/0x700 mm/vmalloc.c:616
vmap_pages_range_noflush mm/vmalloc.c:641 [inline]
vmap_pages_range mm/vmalloc.c:661 [inline]
__vmalloc_area_node mm/vmalloc.c:3713 [inline]
__vmalloc_node_range_noprof+0xbb8/0x1530 mm/vmalloc.c:3846
vmalloc_user_noprof+0x6b/0x90 mm/vmalloc.c:4000
kcov_ioctl+0x4c/0x730 kernel/kcov.c:716
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl fs/ioctl.c:892 [inline]
__x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 13404 tgid 13403 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1127 [inline]
free_unref_page+0x661/0x1080 mm/page_alloc.c:2659
pmd_free_pte_page+0xb0/0xe0 arch/x86/mm/pgtable.c:883
vmap_try_huge_pmd mm/vmalloc.c:153 [inline]
vmap_pmd_range mm/vmalloc.c:172 [inline]
vmap_pud_range mm/vmalloc.c:228 [inline]
vmap_p4d_range mm/vmalloc.c:279 [inline]
vmap_range_noflush+0x579/0x1060 mm/vmalloc.c:303
__vmap_pages_range_noflush+0x104/0x700 mm/vmalloc.c:621
vmap_pages_range_noflush mm/vmalloc.c:641 [inline]
vmap_pages_range mm/vmalloc.c:661 [inline]
__vmalloc_area_node mm/vmalloc.c:3713 [inline]
__vmalloc_node_range_noprof+0xbb8/0x1530 mm/vmalloc.c:3846
__kvmalloc_node_noprof+0x14f/0x1a0 mm/util.c:667
kvmalloc_array_node_noprof include/linux/slab.h:1063 [inline]
__do_sys_listmount+0x1be/0xe90 fs/namespace.c:5590
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff888063ceb100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888063ceb180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888063ceb200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff888063ceb280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888063ceb300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup