Re: kvm: GPF in native_write_cr4

From: Wanpeng Li
Date: Tue Oct 31 2017 - 06:05:53 EST


2017-10-31 17:59 GMT+08:00 Dmitry Vyukov <dvyukov@xxxxxxxxxx>:
> Hello,
>
> I am seeing the following crash on upstream
> 15f859ae5c43c7f0a064ed92d33f7a5bc5de6de0 (Oct 26).
> Reproducer:
> https://gist.githubusercontent.com/dvyukov/a9690f90c39c1e3b1b6c7acda2d5ef89/raw/33e07f3d6779005fc475764e0802e4a5aee8d0cf/gistfile1.txt
> I run qemu with -append "kvm-intel.nested=1" -enable-kvm -cpu host. My
> host cpu is E5-2690.
>

I will have a look.

Regards,
Wanpeng Li

> general protection fault: 0000 [#1] SMP KASAN
> Modules linked in:
> CPU: 1 PID: 3064 Comm: a.out Not tainted 4.14.0-rc6+ #11
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
> task: ffff880064c203c0 task.stack: ffff880066718000
> RIP: 0010:native_write_cr4+0x4/0x10 arch/x86/include/asm/special_insns.h:75
> RSP: 0018:ffff88006671f598 EFLAGS: 00010097
> RAX: ffff880064c203c0 RBX: 00000000001606e0 RCX: 0000000000000000
> RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000001606e0
> RBP: ffff88006671f598 R08: 0000000000000006 R09: 0000000000000006
> R10: ffff880064c203c0 R11: 0000000000000000 R12: 0000000000000001
> R13: ffff88006ca94828 R14: ffff88006ca94850 R15: ffff88006ca80000
> FS: 00000000019cd880(0000) GS:ffff88006ca80000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000000000000 CR3: 0000000005a22001 CR4: 00000000001626e0
> Call Trace:
> __write_cr4 arch/x86/include/asm/paravirt.h:76 [inline]
> cr4_clear_bits arch/x86/include/asm/tlbflush.h:197 [inline]
> kvm_cpu_vmxoff arch/x86/kvm/vmx.c:3571 [inline]
> hardware_disable+0x197/0x210 arch/x86/kvm/vmx.c:3577
> kvm_arch_hardware_disable+0x35/0xd0 arch/x86/kvm/x86.c:7920
> hardware_disable_nolock+0x30/0x40
> arch/x86/kvm/../../../virt/kvm/kvm_main.c:3282
> on_each_cpu+0xca/0x1b0 kernel/smp.c:604
> hardware_disable_all_nolock+0x44/0x60
> arch/x86/kvm/../../../virt/kvm/kvm_main.c:3300
> hardware_disable_all arch/x86/kvm/../../../virt/kvm/kvm_main.c:3306 [inline]
> kvm_destroy_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:735 [inline]
> kvm_put_kvm+0x887/0xe00 arch/x86/kvm/../../../virt/kvm/kvm_main.c:748
> kvm_vm_release+0x42/0x50 arch/x86/kvm/../../../virt/kvm/kvm_main.c:759
> __fput+0x301/0x7e0 fs/file_table.c:210
> ____fput+0x15/0x20 fs/file_table.c:244
> task_work_run+0x19e/0x250 kernel/task_work.c:112
> exit_task_work include/linux/task_work.h:21 [inline]
> do_exit+0x99f/0x18b0 kernel/exit.c:865
> do_group_exit+0x14b/0x3f0 kernel/exit.c:968
> SYSC_exit_group kernel/exit.c:979 [inline]
> SyS_exit_group+0x1d/0x20 kernel/exit.c:977
> entry_SYSCALL_64_fastpath+0x1f/0xbe
> RIP: 0033:0x443849
> RSP: 002b:00007ffe58a95c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
> RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000443849
> RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
> RBP: 0000000000000086 R08: 000000000000003c R09: 00000000000000e7
> R10: ffffffffffffffc0 R11: 0000000000000246 R12: 0000000000000000
> R13: 0000000000404800 R14: 0000000000404890 R15: 0000000000000000
> Code: 0f 1f 80 00 00 00 00 55 48 89 e5 0f 20 d8 5d c3 0f 1f 80 00 00
> 00 00 55 48 89 e5 0f 22 df 5d c3 0f 1f 80 00 00 00 00 55 48 89 e5 <0f>
> 22 e7 5d c3 0f 1f 80 00 00 00 00 55 48 89 e5 44 0f 20 c0 5d
> RIP: native_write_cr4+0x4/0x10 arch/x86/include/asm/special_insns.h:75
> RSP: ffff88006671f598
> ---[ end trace 6f9dbcc14aa47936 ]---