From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jim Mattson Subject: [PATCH v2 2/2] KVM: nVMX: Check host support for MSR bitmaps Date: Thu, 25 May 2017 17:04:14 -0700 Message-ID: <20170526000414.50259-1-jmattson@google.com> References: <20170525180114.131500-2-jmattson@google.com> Cc: Jim Mattson To: kvm@vger.kernel.org, Wincy Van Return-path: Received: from mail-pf0-f181.google.com ([209.85.192.181]:33204 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969369AbdEZAEb (ORCPT ); Thu, 25 May 2017 20:04:31 -0400 Received: by mail-pf0-f181.google.com with SMTP id e193so181217446pfh.0 for ; Thu, 25 May 2017 17:04:30 -0700 (PDT) In-Reply-To: <20170525180114.131500-2-jmattson@google.com> Sender: kvm-owner@vger.kernel.org List-ID: If the host doesn't support MSR bitmaps, but the L2 guest is configured to use MSR bitmaps, fail the emulated VM-entry. Fixes: 3af18d9c5fe95 ("KVM: nVMX: Prepare for using hardware MSR bitmap") Signed-off-by: Jim Mattson --- arch/x86/kvm/vmx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 0d72b4064a80..639188037744 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -9587,12 +9587,10 @@ static void vmx_start_preemption_timer(struct kvm_vcpu *vcpu) static int nested_vmx_check_msr_bitmap_controls(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) { - u64 addr; - if (!nested_cpu_has(vmcs12, CPU_BASED_USE_MSR_BITMAPS)) return 0; - if (vmcs12_read_any(vcpu, MSR_BITMAP, &addr)) { + if (!cpu_has_vmx_msr_bitmap()) { WARN_ON(1); return -EINVAL; } -- 2.13.0.219.gdb65acc882-goog