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

[Xen-changelog] [xen stable-4.10] x86/HVM: don't give the wrong impression of WRMSR succeeding



commit c37114cbf87932d004336c3138d4c832364979cb
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Mar 6 15:56:12 2018 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Mar 6 15:56:12 2018 +0100

    x86/HVM: don't give the wrong impression of WRMSR succeeding
    
    ... for non-existent MSRs: wrmsr_hypervisor_regs()'s comment clearly
    says that the function returns 0 for unrecognized MSRs, so
    {svm,vmx}_msr_write_intercept() should not convert this into success. We
    don't want to unconditionally fail the access though, as we can't be
    certain the list of handled MSRs is complete enough for the guest types
    we care about, so instead mirror what we do on the read paths and probe
    the MSR to decide whether to raise #GP.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
    master commit: 1f1d183d49008794b087cf043fc77f724a45af98
    master date: 2018-02-27 15:12:23 +0100
---
 xen/arch/x86/hvm/svm/svm.c | 7 +++++++
 xen/arch/x86/hvm/vmx/vmx.c | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index b50eb43c5f..dedec5752d 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2106,6 +2106,13 @@ static int svm_msr_write_intercept(unsigned int msr, 
uint64_t msr_content)
             result = X86EMUL_RETRY;
             break;
         case 0:
+            /*
+             * Match up with the RDMSR side for now; ultimately this entire
+             * case block should go away.
+             */
+            if ( rdmsr_safe(msr, msr_content) == 0 )
+                break;
+            goto gpf;
         case 1:
             break;
         default:
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 577a876ea5..fc505c8cf7 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -3182,6 +3182,13 @@ static int vmx_msr_write_intercept(unsigned int msr, 
uint64_t msr_content)
                     case -ERESTART:
                         return X86EMUL_RETRY;
                     case 0:
+                        /*
+                         * Match up with the RDMSR side for now; ultimately 
this
+                         * entire case block should go away.
+                         */
+                        if ( rdmsr_safe(msr, msr_content) == 0 )
+                            break;
+                        goto gp_fault;
                     case 1:
                         break;
                     default:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10

_______________________________________________
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®.