KVM: VMX: Disable preemption when probing user return MSRs
authorSean Christopherson <seanjc@google.com>
Tue, 4 May 2021 17:17:24 +0000 (10:17 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 May 2021 10:06:16 +0000 (06:06 -0400)
commit5104d7ffcf24749939bea7fdb5378d186473f890
tree4edd4687d7b6aa480446cd8d5942037fb203b141
parent2183de4161b90bd3851ccd3910c87b2c9adfc6ed
KVM: VMX: Disable preemption when probing user return MSRs

Disable preemption when probing a user return MSR via RDSMR/WRMSR.  If
the MSR holds a different value per logical CPU, the WRMSR could corrupt
the host's value if KVM is preempted between the RDMSR and WRMSR, and
then rescheduled on a different CPU.

Opportunistically land the helper in common x86, SVM will use the helper
in a future commit.

Fixes: 4be534102624 ("KVM: VMX: Initialize vmx->guest_msrs[] right after allocation")
Cc: stable@vger.kernel.org
Cc: Xiaoyao Li <xiaoyao.li@intel.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210504171734.1434054-6-seanjc@google.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/x86.c