Commit 020dac41 authored by Jim Mattson's avatar Jim Mattson Committed by Paolo Bonzini

KVM: VMX: Heed the 'msr' argument in msr_write_intercepted()

Regardless of the 'msr' argument passed to the VMX version of
msr_write_intercepted(), the function always checks to see if a
specific MSR (IA32_SPEC_CTRL) is intercepted for write.  This behavior
seems unintentional and unexpected.

Modify the function so that it checks to see if the provided 'msr'
index is intercepted for write.

Fixes: 67f4b996 ("KVM: nVMX: Handle dynamic MSR intercept toggling")
Cc: Sean Christopherson <seanjc@google.com>
Signed-off-by: default avatarJim Mattson <jmattson@google.com>
Reviewed-by: default avatarSean Christopherson <seanjc@google.com>
Message-Id: <20220810213050.2655000-1-jmattson@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent b64d740e
...@@ -843,8 +843,7 @@ static bool msr_write_intercepted(struct vcpu_vmx *vmx, u32 msr) ...@@ -843,8 +843,7 @@ static bool msr_write_intercepted(struct vcpu_vmx *vmx, u32 msr)
if (!(exec_controls_get(vmx) & CPU_BASED_USE_MSR_BITMAPS)) if (!(exec_controls_get(vmx) & CPU_BASED_USE_MSR_BITMAPS))
return true; return true;
return vmx_test_msr_bitmap_write(vmx->loaded_vmcs->msr_bitmap, return vmx_test_msr_bitmap_write(vmx->loaded_vmcs->msr_bitmap, msr);
MSR_IA32_SPEC_CTRL);
} }
unsigned int __vmx_vcpu_run_flags(struct vcpu_vmx *vmx) unsigned int __vmx_vcpu_run_flags(struct vcpu_vmx *vmx)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment