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

[Xen-changelog] [xen stable-4.8] x86emul: ignore most segment bases for 64-bit mode in is_aligned()



commit 1febe8da7709dbb30e0818b2f523ebc2c57e27b9
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Jan 18 09:48:23 2017 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jan 18 09:48:23 2017 +0100

    x86emul: ignore most segment bases for 64-bit mode in is_aligned()
    
    ops->read_segment() will report whatever is actually there in the
    register, so we need to actively distinguish ES/CS/SS/DS from FS/GS.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: 6e616a3cef4d782253787904bf3d641112eafa14
    master date: 2016-12-15 11:13:32 +0100
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c 
b/xen/arch/x86/x86_emulate/x86_emulate.c
index c3a5d36..ccaffca 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1570,12 +1570,17 @@ static bool is_aligned(enum x86_segment seg, unsigned 
long offs,
     /* Expecting powers of two only. */
     ASSERT(!(size & (size - 1)));
 
-    /* No alignment checking when we have no way to read segment data. */
-    if ( !ops->read_segment )
-        return true;
+    if ( mode_64bit() && seg < x86_seg_fs )
+        memset(&reg, 0, sizeof(reg));
+    else
+    {
+        /* No alignment checking when we have no way to read segment data. */
+        if ( !ops->read_segment )
+            return true;
 
-    if ( ops->read_segment(seg, &reg, ctxt) != X86EMUL_OKAY )
-        return false;
+        if ( ops->read_segment(seg, &reg, ctxt) != X86EMUL_OKAY )
+            return false;
+    }
 
     return !((reg.base + offs) & (size - 1));
 }
--
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®.