syzbot


KASAN: out-of-bounds Read in insn_get_modrm

Status: closed as invalid on 2024/09/06 13:56
Subsystems: kernel
[Documentation on labels]
First crash: 154d, last: 154d

Sample crash report:
==================================================================
BUG: KASAN: out-of-bounds in insn_get_modrm+0x57d/0x730 arch/x86/lib/insn.c:388
Read of size 4 at addr ffffc9000468617c by task syz.0.15/5364

CPU: 0 UID: 0 PID: 5364 Comm: syz.0.15 Tainted: G      D            6.11.0-rc5-next-20240827-syzkaller #0
Tainted: [D]=DIE
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 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
 insn_get_modrm+0x57d/0x730 arch/x86/lib/insn.c:388
 search_extable+0xb3/0x100 lib/extable.c:116
 </TASK>

The buggy address belongs to stack of task syz.0.15/5364

The buggy address belongs to the virtual mapping at
 [ffffc90004680000, ffffc90004689000) created by:
 copy_process+0x5d1/0x3d50 kernel/fork.c:2203

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88802c6cbf50 pfn:0x2c6cb
memcg:ffff88814c21bf02
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: ffff88802c6cbf50 0000000000000000 00000001ffffffff ffff88814c21bf02
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 5359, tgid 5359 (syz.0.15), ts 63696967602, free_ts 63539973836
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1520
 prep_new_page mm/page_alloc.c:1528 [inline]
 get_page_from_freelist+0x312a/0x3270 mm/page_alloc.c:3479
 __alloc_pages_noprof+0x29e/0x780 mm/page_alloc.c:4751
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
 vm_area_alloc_pages mm/vmalloc.c:3600 [inline]
 __vmalloc_area_node mm/vmalloc.c:3669 [inline]
 __vmalloc_node_range_noprof+0xa40/0x1400 mm/vmalloc.c:3850
 alloc_thread_stack_node kernel/fork.c:314 [inline]
 dup_task_struct+0x444/0x8c0 kernel/fork.c:1115
 copy_process+0x5d1/0x3d50 kernel/fork.c:2203
 kernel_clone+0x226/0x8f0 kernel/fork.c:2784
 __do_sys_clone3 kernel/fork.c:3088 [inline]
 __se_sys_clone3+0x2cb/0x350 kernel/fork.c:3067
 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
page last free pid 5355 tgid 5355 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1101 [inline]
 free_unref_folios+0xf2d/0x1950 mm/page_alloc.c:2702
 folios_put_refs+0x76c/0x860 mm/swap.c:1007
 free_pages_and_swap_cache+0x5c8/0x690 mm/swap_state.c:335
 __tlb_batch_free_encoded_pages mm/mmu_gather.c:136 [inline]
 tlb_batch_pages_flush mm/mmu_gather.c:149 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:366 [inline]
 tlb_flush_mmu+0x3a3/0x680 mm/mmu_gather.c:373
 tlb_finish_mmu+0xd4/0x200 mm/mmu_gather.c:465
 exit_mmap+0x496/0xc40 mm/mmap.c:1878
 __mmput+0x115/0x390 kernel/fork.c:1347
 exit_mm+0x220/0x310 kernel/exit.c:571
 do_exit+0x9b2/0x28e0 kernel/exit.c:926
 do_group_exit+0x207/0x2c0 kernel/exit.c:1088
 __do_sys_exit_group kernel/exit.c:1099 [inline]
 __se_sys_exit_group kernel/exit.c:1097 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1097
 x64_sys_call+0x26a8/0x26b0 arch/x86/include/generated/asm/syscalls_64.h:232
 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:
 ffffc90004686080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc90004686100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffc90004686180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
                   ^
 ffffc90004686200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc90004686280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor instruction fetch in kernel mode
#PF: error_code(0x0010) - not-present page
PGD 800000001eff8067 P4D 800000001eff8067 PUD 787ed067 PMD 0 
Oops: Oops: 0010 [#2] PREEMPT SMP KASAN PTI
CPU: 0 UID: 0 PID: 5364 Comm: syz.0.15 Tainted: G    B D            6.11.0-rc5-next-20240827-syzkaller #0
Tainted: [B]=BAD_PAGE, [D]=DIE
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
RIP: 0010:0x0
Code: Unable to access opcode bytes at 0xffffffffffffffd6.
RSP: 0018:ffffc900046860d0 EFLAGS: 00010046
RAX: 0000000000000000 RBX: ffffffff81cdee52 RCX: f3e4d49339aee500
RDX: ffffc9000a25a000 RSI: 000000000003ffff RDI: 0000000000040000
RBP: 000000000000000e R08: ffffffff8bbcbefb R09: 1ffffffff2633814
R10: dffffc0000000000 R11: fffffbfff2633815 R12: 000000000000000e
R13: 1ffff920008d0c28 R14: ffffc90004686468 R15: 0000000000000003
FS:  00007fe641fde6c0(0000) GS:ffff8880b9000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd6 CR3: 000000001f0a4000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 </TASK>
Modules linked in:
CR2: 0000000000000000
---[ end trace 0000000000000000 ]---
RIP: 0010:0x11
Code: Unable to access opcode bytes at 0xffffffffffffffe7.
RSP: 0018:ffffc900046868a0 EFLAGS: 00010097
RAX: 00000000ffffffff RBX: ffffc90004686e08 RCX: ffff88801efa0000
RDX: ffffc9000a25a000 RSI: ffffffff812dd7f4 RDI: ffffc90004686e08
RBP: ffffffff814207a0 R08: ffffffff8bb16814 R09: ffffffff81420825
R10: 0000000000000002 R11: ffffffff8bb167a0 R12: ffffffff8e4c6160
R13: ffffc90004686920 R14: ffffc90004686958 R15: ffffffff814208a5
FS:  00007fe641fde6c0(0000) GS:ffff8880b9000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffe7 CR3: 000000001f0a4000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/27 23:52 linux-next 6f923748057a 6c853ff9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: out-of-bounds Read in insn_get_modrm
* Struck through repros no longer work on HEAD.