tree: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue head: 1184367930d8fcf1497de08f63c5e7d1dcce2384 commit: dc94ccfb49c1c5bf4342ad881c0eaf8fd5b75a4c [83/85] KVM/x86: Use assembly instruction mnemonics instead of .byte streams config: x86_64-randconfig-x013-201841 (attached as .config) compiler: gcc-7 (Debian 7.3.0-1) 7.3.0 reproduce: git checkout dc94ccfb49c1c5bf4342ad881c0eaf8fd5b75a4c # save the attached .config to linux build tree make ARCH=x86_64 All error/warnings (new ones prefixed by >>): In file included from include/linux/kvm_host.h:38:0, from arch/x86//kvm/irq.h:27, from arch/x86//kvm/vmx.c:19: arch/x86//kvm/vmx.c: In function 'nested_vmx_check_vmentry_hw': >> arch/x86//kvm/vmx.c:12699:8: error: expected ':' or ')' before 'ASM_VMX_VMWRITE_RSP_RDX' __ex(ASM_VMX_VMWRITE_RSP_RDX) "\n\t" ^ arch/x86/include/asm/kvm_host.h:1480:10: note: in definition of macro '____kvm_handle_fault_on_reboot' "666: " insn "\n\t" \ ^~~~ >> arch/x86//kvm/vmx.c:62:17: note: in expansion of macro '__kvm_handle_fault_on_reboot' #define __ex(x) __kvm_handle_fault_on_reboot(x) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> arch/x86//kvm/vmx.c:12699:3: note: in expansion of macro '__ex' __ex(ASM_VMX_VMWRITE_RSP_RDX) "\n\t" ^~~~ vim +12699 arch/x86//kvm/vmx.c ca0bde28 Jim Mattson 2016-11-30 12655 613a23d6 Sean Christopherson 2018-09-26 12656 static int __noclone nested_vmx_check_vmentry_hw(struct kvm_vcpu *vcpu) 613a23d6 Sean Christopherson 2018-09-26 12657 { 613a23d6 Sean Christopherson 2018-09-26 12658 struct vcpu_vmx *vmx = to_vmx(vcpu); 613a23d6 Sean Christopherson 2018-09-26 12659 unsigned long cr3, cr4; 613a23d6 Sean Christopherson 2018-09-26 12660 613a23d6 Sean Christopherson 2018-09-26 12661 if (!nested_early_check) 613a23d6 Sean Christopherson 2018-09-26 12662 return 0; 613a23d6 Sean Christopherson 2018-09-26 12663 613a23d6 Sean Christopherson 2018-09-26 12664 if (vmx->msr_autoload.host.nr) 613a23d6 Sean Christopherson 2018-09-26 12665 vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, 0); 613a23d6 Sean Christopherson 2018-09-26 12666 if (vmx->msr_autoload.guest.nr) 613a23d6 Sean Christopherson 2018-09-26 12667 vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, 0); 613a23d6 Sean Christopherson 2018-09-26 12668 613a23d6 Sean Christopherson 2018-09-26 12669 preempt_disable(); 613a23d6 Sean Christopherson 2018-09-26 12670 613a23d6 Sean Christopherson 2018-09-26 12671 vmx_prepare_switch_to_guest(vcpu); 613a23d6 Sean Christopherson 2018-09-26 12672 613a23d6 Sean Christopherson 2018-09-26 12673 /* 613a23d6 Sean Christopherson 2018-09-26 12674 * Induce a consistency check VMExit by clearing bit 1 in GUEST_RFLAGS, 613a23d6 Sean Christopherson 2018-09-26 12675 * which is reserved to '1' by hardware. GUEST_RFLAGS is guaranteed to 613a23d6 Sean Christopherson 2018-09-26 12676 * be written (by preparve_vmcs02()) before the "real" VMEnter, i.e. 613a23d6 Sean Christopherson 2018-09-26 12677 * there is no need to preserve other bits or save/restore the field. 613a23d6 Sean Christopherson 2018-09-26 12678 */ 613a23d6 Sean Christopherson 2018-09-26 12679 vmcs_writel(GUEST_RFLAGS, 0); 613a23d6 Sean Christopherson 2018-09-26 12680 613a23d6 Sean Christopherson 2018-09-26 12681 vmcs_writel(HOST_RIP, vmx_early_consistency_check_return); 613a23d6 Sean Christopherson 2018-09-26 12682 613a23d6 Sean Christopherson 2018-09-26 12683 cr3 = __get_current_cr3_fast(); 613a23d6 Sean Christopherson 2018-09-26 12684 if (unlikely(cr3 != vmx->loaded_vmcs->host_state.cr3)) { 613a23d6 Sean Christopherson 2018-09-26 12685 vmcs_writel(HOST_CR3, cr3); 613a23d6 Sean Christopherson 2018-09-26 12686 vmx->loaded_vmcs->host_state.cr3 = cr3; 613a23d6 Sean Christopherson 2018-09-26 12687 } 613a23d6 Sean Christopherson 2018-09-26 12688 613a23d6 Sean Christopherson 2018-09-26 12689 cr4 = cr4_read_shadow(); 613a23d6 Sean Christopherson 2018-09-26 12690 if (unlikely(cr4 != vmx->loaded_vmcs->host_state.cr4)) { 613a23d6 Sean Christopherson 2018-09-26 12691 vmcs_writel(HOST_CR4, cr4); 613a23d6 Sean Christopherson 2018-09-26 12692 vmx->loaded_vmcs->host_state.cr4 = cr4; 613a23d6 Sean Christopherson 2018-09-26 12693 } 613a23d6 Sean Christopherson 2018-09-26 12694 613a23d6 Sean Christopherson 2018-09-26 12695 vmx->__launched = vmx->loaded_vmcs->launched; 613a23d6 Sean Christopherson 2018-09-26 12696 613a23d6 Sean Christopherson 2018-09-26 12697 asm( 613a23d6 Sean Christopherson 2018-09-26 12698 /* Set HOST_RSP */ 613a23d6 Sean Christopherson 2018-09-26 @12699 __ex(ASM_VMX_VMWRITE_RSP_RDX) "\n\t" 613a23d6 Sean Christopherson 2018-09-26 12700 "mov %%" _ASM_SP ", %c[host_rsp](%0)\n\t" 613a23d6 Sean Christopherson 2018-09-26 12701 613a23d6 Sean Christopherson 2018-09-26 12702 /* Check if vmlaunch of vmresume is needed */ 613a23d6 Sean Christopherson 2018-09-26 12703 "cmpl $0, %c[launched](%0)\n\t" 613a23d6 Sean Christopherson 2018-09-26 12704 "je 1f\n\t" 613a23d6 Sean Christopherson 2018-09-26 12705 __ex(ASM_VMX_VMRESUME) "\n\t" 613a23d6 Sean Christopherson 2018-09-26 12706 "jmp 2f\n\t" 613a23d6 Sean Christopherson 2018-09-26 12707 "1: " __ex(ASM_VMX_VMLAUNCH) "\n\t" 613a23d6 Sean Christopherson 2018-09-26 12708 "jmp 2f\n\t" 613a23d6 Sean Christopherson 2018-09-26 12709 "2: " 613a23d6 Sean Christopherson 2018-09-26 12710 613a23d6 Sean Christopherson 2018-09-26 12711 /* Set vmx->fail accordingly */ 613a23d6 Sean Christopherson 2018-09-26 12712 "setbe %c[fail](%0)\n\t" 613a23d6 Sean Christopherson 2018-09-26 12713 613a23d6 Sean Christopherson 2018-09-26 12714 ".pushsection .rodata\n\t" 613a23d6 Sean Christopherson 2018-09-26 12715 ".global vmx_early_consistency_check_return\n\t" 613a23d6 Sean Christopherson 2018-09-26 12716 "vmx_early_consistency_check_return: " _ASM_PTR " 2b\n\t" 613a23d6 Sean Christopherson 2018-09-26 12717 ".popsection" 613a23d6 Sean Christopherson 2018-09-26 12718 : 613a23d6 Sean Christopherson 2018-09-26 12719 : "c"(vmx), "d"((unsigned long)HOST_RSP), 613a23d6 Sean Christopherson 2018-09-26 12720 [launched]"i"(offsetof(struct vcpu_vmx, __launched)), 613a23d6 Sean Christopherson 2018-09-26 12721 [fail]"i"(offsetof(struct vcpu_vmx, fail)), 613a23d6 Sean Christopherson 2018-09-26 12722 [host_rsp]"i"(offsetof(struct vcpu_vmx, host_rsp)) 613a23d6 Sean Christopherson 2018-09-26 12723 : "rax", "cc", "memory" 613a23d6 Sean Christopherson 2018-09-26 12724 ); 613a23d6 Sean Christopherson 2018-09-26 12725 613a23d6 Sean Christopherson 2018-09-26 12726 vmcs_writel(HOST_RIP, vmx_return); 613a23d6 Sean Christopherson 2018-09-26 12727 613a23d6 Sean Christopherson 2018-09-26 12728 preempt_enable(); 613a23d6 Sean Christopherson 2018-09-26 12729 613a23d6 Sean Christopherson 2018-09-26 12730 if (vmx->msr_autoload.host.nr) 613a23d6 Sean Christopherson 2018-09-26 12731 vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, vmx->msr_autoload.host.nr); 613a23d6 Sean Christopherson 2018-09-26 12732 if (vmx->msr_autoload.guest.nr) 613a23d6 Sean Christopherson 2018-09-26 12733 vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, vmx->msr_autoload.guest.nr); 613a23d6 Sean Christopherson 2018-09-26 12734 613a23d6 Sean Christopherson 2018-09-26 12735 if (vmx->fail) { 613a23d6 Sean Christopherson 2018-09-26 12736 WARN_ON_ONCE(vmcs_read32(VM_INSTRUCTION_ERROR) != 613a23d6 Sean Christopherson 2018-09-26 12737 VMXERR_ENTRY_INVALID_CONTROL_FIELD); 613a23d6 Sean Christopherson 2018-09-26 12738 vmx->fail = 0; 613a23d6 Sean Christopherson 2018-09-26 12739 return 1; 613a23d6 Sean Christopherson 2018-09-26 12740 } 613a23d6 Sean Christopherson 2018-09-26 12741 613a23d6 Sean Christopherson 2018-09-26 12742 /* 613a23d6 Sean Christopherson 2018-09-26 12743 * VMExit clears RFLAGS.IF and DR7, even on a consistency check. 613a23d6 Sean Christopherson 2018-09-26 12744 */ 613a23d6 Sean Christopherson 2018-09-26 12745 local_irq_enable(); 613a23d6 Sean Christopherson 2018-09-26 12746 if (hw_breakpoint_active()) 613a23d6 Sean Christopherson 2018-09-26 12747 set_debugreg(__this_cpu_read(cpu_dr7), 7); 613a23d6 Sean Christopherson 2018-09-26 12748 613a23d6 Sean Christopherson 2018-09-26 12749 /* 613a23d6 Sean Christopherson 2018-09-26 12750 * A non-failing VMEntry means we somehow entered guest mode with 613a23d6 Sean Christopherson 2018-09-26 12751 * an illegal RIP, and that's just the tip of the iceberg. There 613a23d6 Sean Christopherson 2018-09-26 12752 * is no telling what memory has been modified or what state has 613a23d6 Sean Christopherson 2018-09-26 12753 * been exposed to unknown code. Hitting this all but guarantees 613a23d6 Sean Christopherson 2018-09-26 12754 * a (very critical) hardware issue. 613a23d6 Sean Christopherson 2018-09-26 12755 */ 613a23d6 Sean Christopherson 2018-09-26 12756 WARN_ON(!(vmcs_read32(VM_EXIT_REASON) & 613a23d6 Sean Christopherson 2018-09-26 12757 VMX_EXIT_REASONS_FAILED_VMENTRY)); 613a23d6 Sean Christopherson 2018-09-26 12758 613a23d6 Sean Christopherson 2018-09-26 12759 return 0; 613a23d6 Sean Christopherson 2018-09-26 12760 } 613a23d6 Sean Christopherson 2018-09-26 12761 STACK_FRAME_NON_STANDARD(nested_vmx_check_vmentry_hw); 613a23d6 Sean Christopherson 2018-09-26 12762 :::::: The code at line 12699 was first introduced by commit :::::: 613a23d65e84168314594543078e33b8f162ae9c KVM: nVMX: add option to perform early consistency checks via H/W :::::: TO: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> :::::: CC: Paolo Bonzini <pbonzini@xxxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip