Skip to content

Commit 132627c

Browse files
sean-jcbonzini
authored andcommitted
KVM: SVM: WARN if KVM attempts emulation on #UD or #GP for SEV guests
WARN if KVM attempts to emulate in response to #UD or #GP for SEV guests, i.e. if KVM intercepts #UD or #GP, as emulation on any fault except #NPF is impossible since KVM cannot read guest private memory to get the code stream, and the CPU's DecodeAssists feature only provides the instruction bytes on #NPF. Signed-off-by: Sean Christopherson <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Message-Id: <[email protected]> [Warn on EMULTYPE_TRAP_UD_FORCED according to Liam Merwick's review. - Paolo] Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 4d31d9e commit 132627c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/x86/kvm/svm/svm.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4268,6 +4268,11 @@ static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, int emul_type,
42684268
if (!sev_guest(vcpu->kvm))
42694269
return true;
42704270

4271+
/* #UD and #GP should never be intercepted for SEV guests. */
4272+
WARN_ON_ONCE(emul_type & (EMULTYPE_TRAP_UD |
4273+
EMULTYPE_TRAP_UD_FORCED |
4274+
EMULTYPE_VMWARE_GP));
4275+
42714276
/*
42724277
* Emulation is impossible for SEV-ES guests as KVM doesn't have access
42734278
* to guest register state.

0 commit comments

Comments
 (0)