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

[Xen-changelog] [xen stable-4.8] x86: fix GS-base-dirty determination



commit 814e065d661fcb208db7a3d42bcdb4129c53fd46
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Nov 16 11:50:31 2017 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Nov 16 11:50:31 2017 +0100

    x86: fix GS-base-dirty determination
    
    load_segments() writes the two MSRs in their "canonical" positions
    (GS_BASE for the user base, SHADOW_GS_BASE for the kernel one) and uses
    SWAPGS to switch them around if the incoming vCPU is in kernel mode. In
    order to not leave a stale kernel address in GS_BASE when the incoming
    guest is in user mode, the check on the outgoing vCPU needs to be
    dependent upon the mode it is currently in, rather than blindly looking
    at the user base.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: 91f85280b9b80852352fcad73d94ed29fafb88da
    master date: 2017-10-24 18:12:31 +0200
---
 xen/arch/x86/domain.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index d55edbe..c8a303d 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1923,7 +1923,8 @@ static void save_segments(struct vcpu *v)
         if ( regs->gs & ~3 )
             v->arch.pv_vcpu.gs_base_user = 0;
     }
-    if ( v->arch.pv_vcpu.gs_base_user )
+    if ( v->arch.flags & TF_kernel_mode ? v->arch.pv_vcpu.gs_base_kernel
+                                        : v->arch.pv_vcpu.gs_base_user )
         dirty_segment_mask |= DIRTY_GS_BASE_USER;
 
     this_cpu(dirty_segment_mask) = dirty_segment_mask;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.8

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