@@ -4802,6 +4802,12 @@ static int svm_check_emulate_instruction(struct kvm_vcpu *vcpu, int emul_type,
bool smep, smap, is_user;
u64 error_code;
+ /* Check that emulation is possible during event vectoring */
+ if ((to_svm(vcpu)->vmcb->control.exit_int_info &
+ SVM_EXITINTINFO_TYPE_MASK) &&
+ !kvm_can_emulate_event_vectoring(emul_type))
+ return X86EMUL_UNHANDLEABLE_VECTORING;
+
/* Emulation is always possible when KVM has access to all guest state. */
if (!sev_guest(vcpu->kvm))
return X86EMUL_CONTINUE;
Detect unhandleable vectoring in check_emulate_instruction to prevent infinite loop on SVM and eliminate the difference in how intercepted #PF during vectoring is handled on SVM and VMX. Signed-off-by: Ivan Orlov <iorlov@amazon.com> --- V1 -> V2: - Detect the unhandleable vectoring error in svm_check_emulate_instruction instead of handling it in the common MMU code (which is specific for cached MMIO) V2 -> V3: - Use more generic function to check if emulation is allowed when vectoring arch/x86/kvm/svm/svm.c | 6 ++++++ 1 file changed, 6 insertions(+)