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 <jmattson@xxxxxxxxxx> --- 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