mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [Part2 PATCH v5 30/31] KVM: SVM: Do not install #UD intercept when SEV is enabled
@ 2017-10-04 13:17 Brijesh Singh
  2017-10-04 13:17 ` [Part2 PATCH v5 31/31] KVM: X86: Restart the guest when insn_len is zero and " Brijesh Singh
  0 siblings, 1 reply; 6+ messages in thread
From: Brijesh Singh @ 2017-10-04 13:17 UTC (permalink / raw)
  To: x86, kvm, linux-kernel
  Cc: Brijesh Singh, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Paolo Bonzini, Radim Krčmář,
	Joerg Roedel, Borislav Petkov, Tom Lendacky

On #UD, x86_emulate_instruction() fetches the data from guest memory and
decodes the instruction bytes to assist further. When SEV is enabled, the
instruction bytes will be encrypted using the guest-specific key and the
hypervisor will no longer able to fetch the instruction bytes to assist
UD handling. By not installing intercept we let the guest receive and
handle #UD.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Borislav Petkov <bp@suse.de>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: x86@kernel.org
Cc: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---
 arch/x86/kvm/svm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index a47981714433..81fc20998423 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1448,8 +1448,10 @@ static void init_vmcb(struct vcpu_svm *svm)
 		svm->vmcb->control.int_ctl |= V_GIF_ENABLE_MASK;
 	}
 
-	if (sev_guest(svm->vcpu.kvm))
+	if (sev_guest(svm->vcpu.kvm)) {
 		svm->vmcb->control.nested_ctl |= SVM_NESTED_CTL_SEV_ENABLE;
+		clr_exception_intercept(svm, UD_VECTOR);
+	}
 
 	mark_all_dirty(svm->vmcb);
 
-- 
2.9.5

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-18 13:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-04 13:17 [Part2 PATCH v5 30/31] KVM: SVM: Do not install #UD intercept when SEV is enabled Brijesh Singh
2017-10-04 13:17 ` [Part2 PATCH v5 31/31] KVM: X86: Restart the guest when insn_len is zero and " Brijesh Singh
2017-10-18  9:26   ` Paolo Bonzini
2017-10-18  9:31     ` Paolo Bonzini
2017-10-18 12:19     ` Brijesh Singh
2017-10-18 13:00       ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®