Skip to content

Commit 0b0be06

Browse files
sean-jcbonzini
authored andcommitted
KVM: SVM: Don't intercept #GP for SEV guests
Never intercept #GP for SEV guests as reading SEV guest private memory will return cyphertext, i.e. emulating on #GP can't work as intended. Cc: [email protected] Cc: Tom Lendacky <[email protected]> Cc: Brijesh Singh <[email protected]> Signed-off-by: Sean Christopherson <[email protected]> Reviewed-by: Liam Merwick <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 31c2558 commit 0b0be06

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

arch/x86/kvm/svm/svm.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,11 @@ int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer)
312312
return ret;
313313
}
314314

315-
if (svm_gp_erratum_intercept)
315+
/*
316+
* Never intercept #GP for SEV guests, KVM can't
317+
* decrypt guest memory to workaround the erratum.
318+
*/
319+
if (svm_gp_erratum_intercept && !sev_guest(vcpu->kvm))
316320
set_exception_intercept(svm, GP_VECTOR);
317321
}
318322
}
@@ -1010,9 +1014,10 @@ static void init_vmcb(struct kvm_vcpu *vcpu)
10101014
* Guest access to VMware backdoor ports could legitimately
10111015
* trigger #GP because of TSS I/O permission bitmap.
10121016
* We intercept those #GP and allow access to them anyway
1013-
* as VMware does.
1017+
* as VMware does. Don't intercept #GP for SEV guests as KVM can't
1018+
* decrypt guest memory to decode the faulting instruction.
10141019
*/
1015-
if (enable_vmware_backdoor)
1020+
if (enable_vmware_backdoor && !sev_guest(vcpu->kvm))
10161021
set_exception_intercept(svm, GP_VECTOR);
10171022

10181023
svm_set_intercept(svm, INTERCEPT_INTR);

0 commit comments

Comments
 (0)