KVM: SVM: Clear C-bit from the page fault address

"Linux Kernel Mailing List" <[email protected]> Sat, 10 Feb 2018 22:00:21 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/0ede79e1322479221fb0d0a7d2828d8ed033f060
Commit:     0ede79e1322479221fb0d0a7d2828d8ed033f060
Parent:     1e80fdc09d121d8327cdf62eefbb5abadddca792
Refname:    refs/heads/master
Author:     Brijesh Singh <[email protected]>
AuthorDate: Mon Dec 4 10:57:39 2017 -0600
Committer:  Brijesh Singh <[email protected]>
CommitDate: Mon Dec 4 13:33:14 2017 -0600

    KVM: SVM: Clear C-bit from the page fault address
    
    When SEV is active, on #VMEXIT the  page fault address will contain the
    C-bit. We must clear the C-bit before handling the fault.
    
    Cc: Thomas Gleixner <[email protected]>
    Cc: Ingo Molnar <[email protected]>
    Cc: "H. Peter Anvin" <[email protected]>
    Cc: Paolo Bonzini <[email protected]>
    Cc: "Radim Krčmář" <[email protected]>
    Cc: Joerg Roedel <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Tom Lendacky <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Reviewed-by: Borislav Petkov <[email protected]>
    Signed-off-by: Brijesh Singh <[email protected]>
---
 arch/x86/kvm/svm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index bdce5b4e71cc..f350e9bac9eb 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2430,7 +2430,7 @@ static void svm_set_dr7(struct kvm_vcpu *vcpu, unsigned long value)
 
 static int pf_interception(struct vcpu_svm *svm)
 {
-	u64 fault_address = svm->vmcb->control.exit_info_2;
+	u64 fault_address = __sme_clr(svm->vmcb->control.exit_info_2);
 	u64 error_code = svm->vmcb->control.exit_info_1;
 
 	return kvm_handle_page_fault(&svm->vcpu, error_code, fault_address,
@@ -2440,7 +2440,7 @@ static int pf_interception(struct vcpu_svm *svm)
 
 static int npf_interception(struct vcpu_svm *svm)
 {
-	u64 fault_address = svm->vmcb->control.exit_info_2;
+	u64 fault_address = __sme_clr(svm->vmcb->control.exit_info_2);
 	u64 error_code = svm->vmcb->control.exit_info_1;
 
 	trace_kvm_page_fault(fault_address, error_code);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html