Commit 74ce1333 authored by Sean Christopherson's avatar Sean Christopherson Committed by Greg Kroah-Hartman

KVM: VMX: Always signal #GP on WRMSR to MSR_IA32_CR_PAT with bad value

[ Upstream commit d28f4290 ]

The behavior of WRMSR is in no way dependent on whether or not KVM
consumes the value.

Fixes: 4566654b ("KVM: vmx: Inject #GP on invalid PAT CR")
Cc: stable@vger.kernel.org
Cc: Nadav Amit <nadav.amit@gmail.com>
Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 74fd8aae
...@@ -4265,9 +4265,10 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) ...@@ -4265,9 +4265,10 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
MSR_TYPE_W); MSR_TYPE_W);
break; break;
case MSR_IA32_CR_PAT: case MSR_IA32_CR_PAT:
if (!kvm_pat_valid(data))
return 1;
if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) { if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) {
if (!kvm_pat_valid(data))
return 1;
vmcs_write64(GUEST_IA32_PAT, data); vmcs_write64(GUEST_IA32_PAT, data);
vcpu->arch.pat = data; vcpu->arch.pat = data;
break; break;
......
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