|
Jose R. Ziviani |
f7ab15 |
From: Sean Christopherson <sean.j.christopherson@intel.com>
|
|
Jose R. Ziviani |
f7ab15 |
Date: Thu, 27 Feb 2020 09:44:30 -0800
|
|
Jose R. Ziviani |
f7ab15 |
Subject: KVM: nVMX: Consult only the "basic" exit reason when routing nested
|
|
Jose R. Ziviani |
f7ab15 |
exit
|
|
Jose R. Ziviani |
f7ab15 |
Git-commit: 2ebac8bb3c2d35f5135466490fc8eeaf3f3e2d37
|
|
Jose R. Ziviani |
f7ab15 |
Patch-mainline: v5.8-rc1
|
|
Jose R. Ziviani |
f7ab15 |
References: bsc#1188773
|
|
Jose R. Ziviani |
f7ab15 |
|
|
Jose R. Ziviani |
f7ab15 |
Consult only the basic exit reason, i.e. bits 15:0 of vmcs.EXIT_REASON,
|
|
Jose R. Ziviani |
f7ab15 |
when determining whether a nested VM-Exit should be reflected into L1 or
|
|
Jose R. Ziviani |
f7ab15 |
handled by KVM in L0.
|
|
Jose R. Ziviani |
f7ab15 |
|
|
Jose R. Ziviani |
f7ab15 |
For better or worse, the switch statement in nested_vmx_exit_reflected()
|
|
Jose R. Ziviani |
f7ab15 |
currently defaults to "true", i.e. reflects any nested VM-Exit without
|
|
Jose R. Ziviani |
f7ab15 |
dedicated logic. Because the case statements only contain the basic
|
|
Jose R. Ziviani |
f7ab15 |
exit reason, any VM-Exit with modifier bits set will be reflected to L1,
|
|
Jose R. Ziviani |
f7ab15 |
even if KVM intended to handle it in L0.
|
|
Jose R. Ziviani |
f7ab15 |
|
|
Jose R. Ziviani |
f7ab15 |
Practically speaking, this only affects EXIT_REASON_MCE_DURING_VMENTRY,
|
|
Jose R. Ziviani |
f7ab15 |
i.e. a #MC that occurs on nested VM-Enter would be incorrectly routed to
|
|
Jose R. Ziviani |
f7ab15 |
L1, as "failed VM-Entry" is the only modifier that KVM can currently
|
|
Jose R. Ziviani |
f7ab15 |
encounter. The SMM modifiers will never be generated as KVM doesn't
|
|
Jose R. Ziviani |
f7ab15 |
support/employ a SMI Transfer Monitor. Ditto for "exit from enclave",
|
|
Jose R. Ziviani |
f7ab15 |
as KVM doesn't yet support virtualizing SGX, i.e. it's impossible to
|
|
Jose R. Ziviani |
f7ab15 |
enter an enclave in a KVM guest (L1 or L2).
|
|
Jose R. Ziviani |
f7ab15 |
|
|
Jose R. Ziviani |
f7ab15 |
Fixes: 644d711aa0e1 ("KVM: nVMX: Deciding if L0 or L1 should handle an L2 exit")
|
|
Jose R. Ziviani |
f7ab15 |
Cc: Jim Mattson <jmattson@google.com>
|
|
Jose R. Ziviani |
f7ab15 |
Cc: Xiaoyao Li <xiaoyao.li@intel.com>
|
|
Jose R. Ziviani |
f7ab15 |
Cc: stable@vger.kernel.org
|
|
Jose R. Ziviani |
f7ab15 |
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
|
|
Jose R. Ziviani |
f7ab15 |
Message-Id: <20200227174430.26371-1-sean.j.christopherson@intel.com>
|
|
Jose R. Ziviani |
f7ab15 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Jose R. Ziviani |
f7ab15 |
Signed-off-by: Jose R. Ziviani <jziviani@suse.de>
|
|
Jose R. Ziviani |
f7ab15 |
---
|
|
Jose R. Ziviani |
f7ab15 |
arch/x86/kvm/vmx/nested.c | 2 +-
|
|
Jose R. Ziviani |
f7ab15 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Jose R. Ziviani |
f7ab15 |
|
|
Jose R. Ziviani |
f7ab15 |
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
|
|
Jose R. Ziviani |
f7ab15 |
index a20083ac1ea3..6ee196da166d 100644
|
|
Jose R. Ziviani |
f7ab15 |
--- a/arch/x86/kvm/vmx/nested.c
|
|
Jose R. Ziviani |
f7ab15 |
+++ b/arch/x86/kvm/vmx/nested.c
|
|
Jose R. Ziviani |
f7ab15 |
@@ -5380,7 +5380,7 @@ bool nested_vmx_exit_reflected(struct kvm_vcpu *vcpu, u32 exit_reason)
|
|
Jose R. Ziviani |
f7ab15 |
vmcs_read32(VM_EXIT_INTR_ERROR_CODE),
|
|
Jose R. Ziviani |
f7ab15 |
KVM_ISA_VMX);
|
|
Jose R. Ziviani |
f7ab15 |
|
|
Jose R. Ziviani |
f7ab15 |
- switch (exit_reason) {
|
|
Jose R. Ziviani |
f7ab15 |
+ switch ((u16)exit_reason) {
|
|
Jose R. Ziviani |
f7ab15 |
case EXIT_REASON_EXCEPTION_NMI:
|
|
Jose R. Ziviani |
f7ab15 |
if (is_nmi(intr_info))
|
|
Jose R. Ziviani |
f7ab15 |
return false;
|
|
Jose R. Ziviani |
f7ab15 |
--
|
|
Jose R. Ziviani |
f7ab15 |
2.32.0
|
|
Jose R. Ziviani |
f7ab15 |
|