[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.7] x86/SVM: don't deliver #GP without error code



commit 6d55b3a6dae3b9c1921076346745994ed67731e2
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jan 18 10:03:25 2017 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jan 18 10:03:25 2017 +0100

    x86/SVM: don't deliver #GP without error code
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: 647c7bd4453c224d9ccdfdb37491544f797fdc48
    master date: 2016-11-25 09:46:32 +0100
---
 xen/arch/x86/hvm/svm/svm.c | 30 +++++++++---------------------
 1 file changed, 9 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 9485a37..41392a1 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2040,7 +2040,7 @@ svm_vmexit_do_vmrun(struct cpu_user_regs *regs,
     if ( !nestedsvm_vmcb_map(v, vmcbaddr) )
     {
         gdprintk(XENLOG_ERR, "VMRUN: mapping vmcb failed, injecting #GP\n");
-        hvm_inject_hw_exception(TRAP_gp_fault, HVM_DELIVER_NO_ERROR_CODE);
+        hvm_inject_hw_exception(TRAP_gp_fault, 0);
         return;
     }
 
@@ -2079,7 +2079,6 @@ svm_vmexit_do_vmload(struct vmcb_struct *vmcb,
                      struct cpu_user_regs *regs,
                      struct vcpu *v, uint64_t vmcbaddr)
 {
-    int ret;
     unsigned int inst_len;
     struct page_info *page;
 
@@ -2089,8 +2088,8 @@ svm_vmexit_do_vmload(struct vmcb_struct *vmcb,
     if ( !nsvm_efer_svm_enabled(v) ) 
     {
         gdprintk(XENLOG_ERR, "VMLOAD: nestedhvm disabled, injecting #UD\n");
-        ret = TRAP_invalid_op;
-        goto inject;
+        hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE);
+        return;
     }
 
     page = nsvm_get_nvmcb_page(v, vmcbaddr);
@@ -2098,8 +2097,8 @@ svm_vmexit_do_vmload(struct vmcb_struct *vmcb,
     {
         gdprintk(XENLOG_ERR,
             "VMLOAD: mapping failed, injecting #GP\n");
-        ret = TRAP_gp_fault;
-        goto inject;
+        hvm_inject_hw_exception(TRAP_gp_fault, 0);
+        return;
     }
 
     svm_vmload_pa(page_to_maddr(page));
@@ -2109,11 +2108,6 @@ svm_vmexit_do_vmload(struct vmcb_struct *vmcb,
     v->arch.hvm_svm.vmcb_in_sync = 0;
 
     __update_guest_eip(regs, inst_len);
-    return;
-
- inject:
-    hvm_inject_hw_exception(ret, HVM_DELIVER_NO_ERROR_CODE);
-    return;
 }
 
 static void
@@ -2121,7 +2115,6 @@ svm_vmexit_do_vmsave(struct vmcb_struct *vmcb,
                      struct cpu_user_regs *regs,
                      struct vcpu *v, uint64_t vmcbaddr)
 {
-    int ret;
     unsigned int inst_len;
     struct page_info *page;
 
@@ -2131,8 +2124,8 @@ svm_vmexit_do_vmsave(struct vmcb_struct *vmcb,
     if ( !nsvm_efer_svm_enabled(v) ) 
     {
         gdprintk(XENLOG_ERR, "VMSAVE: nestedhvm disabled, injecting #UD\n");
-        ret = TRAP_invalid_op;
-        goto inject;
+        hvm_inject_hw_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE);
+        return;
     }
 
     page = nsvm_get_nvmcb_page(v, vmcbaddr);
@@ -2140,18 +2133,13 @@ svm_vmexit_do_vmsave(struct vmcb_struct *vmcb,
     {
         gdprintk(XENLOG_ERR,
             "VMSAVE: mapping vmcb failed, injecting #GP\n");
-        ret = TRAP_gp_fault;
-        goto inject;
+        hvm_inject_hw_exception(TRAP_gp_fault, 0);
+        return;
     }
 
     svm_vmsave_pa(page_to_maddr(page));
     put_page(page);
     __update_guest_eip(regs, inst_len);
-    return;
-
- inject:
-    hvm_inject_hw_exception(ret, HVM_DELIVER_NO_ERROR_CODE);
-    return;
 }
 
 static int svm_is_erratum_383(struct cpu_user_regs *regs)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.7

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.