KVM: VMX: Add non-canonical check on writes to RTIT address MSRs
authorSean Christopherson <sean.j.christopherson@intel.com>
Tue, 10 Dec 2019 23:24:32 +0000 (15:24 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 21 Jan 2020 12:57:50 +0000 (13:57 +0100)
Reject writes to RTIT address MSRs if the data being written is a
non-canonical address as the MSRs are subject to canonical checks, e.g.
KVM will trigger an unchecked #GP when loading the values to hardware
during pt_guest_enter().

Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmx.c

index c2ced79aee3e1b49067d8d8035228a093c83d8c7..aea4fa957fd2aa3697a180aa852b7fed3a7a732c 100644 (file)
@@ -2144,6 +2144,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
                        (index >= 2 * intel_pt_validate_cap(vmx->pt_desc.caps,
                                        PT_CAP_num_address_ranges)))
                        return 1;
+               if (is_noncanonical_address(data, vcpu))
+                       return 1;
                if (index % 2)
                        vmx->pt_desc.guest.addr_b[index / 2] = data;
                else