syzbot


WARNING: bad usercopy in __kvm_write_guest_page

Status: fixed on 2018/08/24 18:06
Subsystems: mm hardening
[Documentation on labels]
Reported-by: syzbot+083f3b88782aa3a46bdb@syzkaller.appspotmail.com
Fix commit: 0a06d4256674 KVM: vmx: use local variable for current_vmptr when emulating VMPTRST
First crash: 2394d, last: 2329d
Discussions (1)
Title Replies (including bot) Last reply
WARNING: bad usercopy in __kvm_write_guest_page 1 (2) 2018/05/27 00:58

Sample crash report:
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
------------[ cut here ]------------
Bad or missing usercopy whitelist? Kernel memory exposure attempt detected from SLAB object 'kvm_vcpu' (offset 23192, size 8)!
WARNING: CPU: 0 PID: 4554 at mm/usercopy.c:81 usercopy_warn+0xf5/0x120 mm/usercopy.c:76
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 4554 Comm: syz-executor726 Not tainted 4.17.0-rc5+ #58
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1b9/0x294 lib/dump_stack.c:113
 panic+0x22f/0x4de kernel/panic.c:184
 __warn.cold.8+0x163/0x1b3 kernel/panic.c:536
 report_bug+0x252/0x2d0 lib/bug.c:186
 fixup_bug arch/x86/kernel/traps.c:178 [inline]
 do_error_trap+0x1de/0x490 arch/x86/kernel/traps.c:296
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
 invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:992
RIP: 0010:usercopy_warn+0xf5/0x120 mm/usercopy.c:76
RSP: 0018:ffff8801ad54f0b0 EFLAGS: 00010286
RAX: 000000000000007e RBX: ffffffff889d52f0 RCX: ffffffff8160aa5d
RDX: 0000000000000000 RSI: ffffffff8160f711 RDI: ffff8801ad54ec10
RBP: ffff8801ad54f110 R08: ffff8801d96c8680 R09: 0000000000000006
R10: ffff8801d96c8680 R11: 0000000000000000 R12: ffffffff87d2fa60
R13: ffffffff87c19ec0 R14: 0000000000000000 R15: 0000000000000008
 __check_heap_object+0x89/0xb5 mm/slab.c:4440
 check_heap_object mm/usercopy.c:236 [inline]
 __check_object_size+0x4c7/0x5d9 mm/usercopy.c:259
 check_object_size include/linux/thread_info.h:108 [inline]
 __copy_to_user include/linux/uaccess.h:104 [inline]
 __kvm_write_guest_page+0x90/0x140 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1828
 kvm_vcpu_write_guest_page arch/x86/kvm/../../../virt/kvm/kvm_main.c:1849 [inline]
 kvm_vcpu_write_guest+0x65/0xe0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:1883
 kvm_write_guest_virt_system+0x8a/0x190 arch/x86/kvm/x86.c:4843
 handle_vmptrst+0x1d2/0x260 arch/x86/kvm/vmx.c:8196
 vmx_handle_exit+0x2c0/0x17b0 arch/x86/kvm/vmx.c:9234
 vcpu_enter_guest+0x13af/0x6060 arch/x86/kvm/x86.c:7503
 vcpu_run arch/x86/kvm/x86.c:7565 [inline]
 kvm_arch_vcpu_ioctl_run+0x33e/0x1690 arch/x86/kvm/x86.c:7742
 kvm_vcpu_ioctl+0x79d/0x12e0 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2560
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x1cf/0x16a0 fs/ioctl.c:684
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:701
 __do_sys_ioctl fs/ioctl.c:708 [inline]
 __se_sys_ioctl fs/ioctl.c:706 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:706
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x443039
RSP: 002b:00007ffc272242b8 EFLAGS: 00000286 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000443039
RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005
RBP: 00000000006cd018 R08: 0000000020000580 R09: 0000000020000580
R10: 0000000000000000 R11: 0000000000000286 R12: 0000000000404080
R13: 0000000000404110 R14: 0000000000000000 R15: 0000000000000000
Dumping ftrace buffer:
   (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/05/19 18:49 upstream 73fcb1a370c7 849705db .config console log report syz C ci-upstream-kasan-gce-root
2018/05/19 01:40 upstream 2c71d338bef2 849705db .config console log report syz C ci-upstream-kasan-gce
2018/05/19 01:20 upstream 2c71d338bef2 849705db .config console log report ci-upstream-kasan-gce
2018/03/16 01:59 upstream e2c15aff5f35 08dacaa0 .config console log report ci-upstream-kasan-gce
* Struck through repros no longer work on HEAD.