]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: VMX: Use current VMCS to query WAITPKG support for MSR emulation
authorSean Christopherson <seanjc@google.com>
Tue, 10 Aug 2021 17:19:49 +0000 (10:19 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 10 Aug 2021 17:32:09 +0000 (13:32 -0400)
commit9c87a081554e12c8434251c8c5d15e086b9cddee
treeb4788e2fe47e70305155946b9d7c70f46e7bee14
parentc3a72cf8c04f479bccd107357fefc2ea88f0459a
KVM: VMX: Use current VMCS to query WAITPKG support for MSR emulation

Use the secondary_exec_controls_get() accessor in vmx_has_waitpkg() to
effectively get the controls for the current VMCS, as opposed to using
vmx->secondary_exec_controls, which is the cached value of KVM's desired
controls for vmcs01 and truly not reflective of any particular VMCS.

While the waitpkg control is not dynamic, i.e. vmcs01 will always hold
the same waitpkg configuration as vmx->secondary_exec_controls, the same
does not hold true for vmcs02 if the L1 VMM hides the feature from L2.
If L1 hides the feature _and_ does not intercept MSR_IA32_UMWAIT_CONTROL,
L2 could incorrectly read/write L1's virtual MSR instead of taking a #GP.

Fixes: 82a749d5458e ("KVM: vmx: Emulate MSR IA32_UMWAIT_CONTROL")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210810171952.2758100-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/vmx.h