Skip to content

Commit 194c17b

Browse files
committed
KVM: SVM: Check for an unexpected VM-Exit after RETPOLINE "fast" handling
Check for an unexpected/unhandled VM-Exit after the manual RETPOLINE=y handling. The entire point of the RETPOLINE checks is to optimize for common VM-Exits, i.e. checking for the rare case of an unsupported VM-Exit is counter-productive. This also aligns SVM and VMX exit handling. No functional change intended. Reviewed-by: Yosry Ahmed <yosry.ahmed@linux.dev> Link: https://patch.msgid.link/20251230211347.4099600-4-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 2450c97 commit 194c17b

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

arch/x86/kvm/svm/svm.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3469,12 +3469,6 @@ static void dump_vmcb(struct kvm_vcpu *vcpu)
34693469

34703470
int svm_invoke_exit_handler(struct kvm_vcpu *vcpu, u64 exit_code)
34713471
{
3472-
if (exit_code >= ARRAY_SIZE(svm_exit_handlers))
3473-
goto unexpected_vmexit;
3474-
3475-
if (!svm_exit_handlers[exit_code])
3476-
goto unexpected_vmexit;
3477-
34783472
#ifdef CONFIG_MITIGATION_RETPOLINE
34793473
if (exit_code == SVM_EXIT_MSR)
34803474
return msr_interception(vcpu);
@@ -3491,6 +3485,12 @@ int svm_invoke_exit_handler(struct kvm_vcpu *vcpu, u64 exit_code)
34913485
return sev_handle_vmgexit(vcpu);
34923486
#endif
34933487
#endif
3488+
if (exit_code >= ARRAY_SIZE(svm_exit_handlers))
3489+
goto unexpected_vmexit;
3490+
3491+
if (!svm_exit_handlers[exit_code])
3492+
goto unexpected_vmexit;
3493+
34943494
return svm_exit_handlers[exit_code](vcpu);
34953495

34963496
unexpected_vmexit:

0 commit comments

Comments
 (0)