]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86emul: don't allow null selector for LTR
authorJan Beulich <jbeulich@suse.com>
Mon, 26 Sep 2016 15:27:06 +0000 (17:27 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 26 Sep 2016 15:27:06 +0000 (17:27 +0200)
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/x86_emulate/x86_emulate.c

index 9c76c2e0324e6a325a6efa78094fdd64ca40dca7..b22ede659b6b0ce15c8397079c46e659f2d2d4d2 100644 (file)
@@ -1207,10 +1207,17 @@ protmode_load_seg(
     /* NULL selector? */
     if ( (sel & 0xfffc) == 0 )
     {
-        if ( (seg == x86_seg_cs) ||
-             ((seg == x86_seg_ss) &&
-              (!mode_64bit() || (cpl == 3) || (cpl != sel))) )
+        switch ( seg )
+        {
+        case x86_seg_ss:
+            if ( mode_64bit() && (cpl != 3) && (cpl == sel) )
+        default:
+                break;
+            /* fall through */
+        case x86_seg_cs:
+        case x86_seg_tr:
             goto raise_exn;
+        }
         memset(sreg, 0, sizeof(*sreg));
         sreg->sel = sel;
         return X86EMUL_OKAY;