]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86/HVM: correct segment register loading during task switch
authorJan Beulich <jbeulich@suse.com>
Mon, 26 Sep 2016 15:27:34 +0000 (17:27 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 26 Sep 2016 15:27:34 +0000 (17:27 +0200)
Instead of #NP, #SS needs to be raised for a non-present %ss
descriptor.

Don't lose the low two selector bits on null selector loads.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/hvm.c

index 7bad845306d385eb5c840b5f204c89ccc04baaa9..73730d1fe0225cfa84dfdf508049d48144fa9741 100644 (file)
@@ -2723,6 +2723,7 @@ static int hvm_load_segment_selector(
         if ( (seg == x86_seg_cs) || (seg == x86_seg_ss) )
             goto fail;
         memset(&segr, 0, sizeof(segr));
+        segr.sel = sel;
         hvm_set_segment_register(v, seg, &segr);
         return 0;
     }
@@ -2749,7 +2750,8 @@ static int hvm_load_segment_selector(
         /* Segment present in memory? */
         if ( !(desc.b & _SEGMENT_P) )
         {
-            fault_type = TRAP_no_segment;
+            fault_type = (seg != x86_seg_ss) ? TRAP_no_segment
+                                             : TRAP_stack_error;
             goto unmap_and_fail;
         }