lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 2 Mar 2020 20:19:28 +0800
From:   Haiwei Li <lihaiwei.kernel@...il.com>
To:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        kvm@...r.kernel.org, x86@...nel.org
Cc:     hpa@...or.com, bp@...en8.de, "mingo@...hat.com" <mingo@...hat.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "joro@...tes.org" <joro@...tes.org>, jmattson@...gle.com,
        wanpengli@...cent.com, "vkuznets@...hat.com" <vkuznets@...hat.com>,
        Sean Christopherson <sean.j.christopherson@...el.com>,
        "pbonzini@...hat.com" <pbonzini@...hat.com>
Subject: [PATCH] KVM: SVM: Fix svm the vmexit error_code of WRMSR

 From 1f755f75dfd73ad7cabb0e0f43e9993dd9f69120 Mon Sep 17 00:00:00 2001
From: Haiwei Li <lihaiwei@...cent.com>
Date: Mon, 2 Mar 2020 19:19:59 +0800
Subject: [PATCH] KVM: SVM: Fix svm the vmexit error_code of WRMSR

In svm, exit_code of write_msr is not EXIT_REASON_MSR_WRITE which
belongs to vmx.

According to amd manual, SVM_EXIT_MSR(7ch) is the exit_code of VMEXIT_MSR
due to RDMSR or WRMSR access to protected MSR. Additionally, the processor
indicates in the VMCB's EXITINFO1 whether a RDMSR(EXITINFO1=0) or
WRMSR(EXITINFO1=1) was intercepted.

Signed-off-by: Haiwei Li <lihaiwei@...cent.com>
---
  arch/x86/kvm/svm.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index fd3fc9f..ef71755 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -6296,7 +6296,8 @@ static void svm_handle_exit_irqoff(struct kvm_vcpu
*vcpu,
         enum exit_fastpath_completion *exit_fastpath)
  {
         if (!is_guest_mode(vcpu) &&
-               to_svm(vcpu)->vmcb->control.exit_code ==
EXIT_REASON_MSR_WRITE)
+               (to_svm(vcpu)->vmcb->control.exit_code == SVM_EXIT_MSR) &&
+               (to_svm(vcpu)->vmcb->control.exit_info_1 & 1))
                 *exit_fastpath = handle_fastpath_set_msr_irqoff(vcpu);
  }

--
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ