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

[Xen-changelog] [xen stable-4.9] x86/vmx: Don't use hvm_inject_hw_exception() in long_mode_do_msr_write()



commit d6fe1860285bd4e3e3f1f6cc96f7d64200bc2138
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Dec 20 15:59:22 2017 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Dec 20 15:59:22 2017 +0100

    x86/vmx: Don't use hvm_inject_hw_exception() in long_mode_do_msr_write()
    
    Since c/s 49de10f3c1718 "x86/hvm: Don't raise #GP behind the emulators back
    for MSR accesses", returning X86EMUL_EXCEPTION has pushed the exception
    generation to the top of the call tree.
    
    Using hvm_inject_hw_exception() and returning X86EMUL_EXCEPTION causes a
    double #GP injection, which combines to #DF.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Kevin Tian <kevin.tian@xxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: 896ee3980e72866b602e743396751384de301fb0
    master date: 2017-12-14 18:05:45 +0000
---
 xen/arch/x86/hvm/vmx/vmx.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 1fe6fde..a74dd75 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -541,7 +541,7 @@ long_mode_do_msr_write(unsigned int msr, uint64_t 
msr_content)
     case MSR_GS_BASE:
     case MSR_SHADOW_GS_BASE:
         if ( !is_canonical_address(msr_content) )
-            goto uncanonical_address;
+            return HNDL_exception_raised;
 
         if ( msr == MSR_FS_BASE )
             __vmwrite(GUEST_FS_BASE, msr_content);
@@ -559,14 +559,14 @@ long_mode_do_msr_write(unsigned int msr, uint64_t 
msr_content)
 
     case MSR_LSTAR:
         if ( !is_canonical_address(msr_content) )
-            goto uncanonical_address;
+            return HNDL_exception_raised;
         v->arch.hvm_vmx.lstar = msr_content;
         wrmsrl(MSR_LSTAR, msr_content);
         break;
 
     case MSR_CSTAR:
         if ( !is_canonical_address(msr_content) )
-            goto uncanonical_address;
+            return HNDL_exception_raised;
         v->arch.hvm_vmx.cstar = msr_content;
         break;
 
@@ -580,11 +580,6 @@ long_mode_do_msr_write(unsigned int msr, uint64_t 
msr_content)
     }
 
     return HNDL_done;
-
- uncanonical_address:
-    HVM_DBG_LOG(DBG_LEVEL_MSR, "Not cano address of msr write %x", msr);
-    hvm_inject_hw_exception(TRAP_gp_fault, 0);
-    return HNDL_exception_raised;
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
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®.