]> xenbits.xensource.com Git - people/aperard/xtf.git/commitdiff
nested-vmx: exceptions take priority over VMFail*
authorJan Beulich <JBeulich@suse.com>
Fri, 11 Jan 2019 09:50:20 +0000 (02:50 -0700)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 11 Jan 2019 17:08:20 +0000 (17:08 +0000)
The way the instruction invocations are coded, it is compiler version
dependent whether things work: With old gcc, fail_{,in}valid will not
get touched and hence remain at their initial values, while with newer
gcc evaluation of the status flags occurs outside of the asm(), i.e.
also when an exception was received (in which case EFLAGS didn't change
from its value before the faulting instruction).

Since it is more logical anyway to check for a possible exception first,
do so uniformly instead of trying to fiddle with the asm() in some way.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tests/nested-vmx/util.c

index e44ae73b43370f1d9261b704975128d5dd27ad6f..61611abb91afc8aff826f55368786c1b86fb2e1b 100644 (file)
@@ -90,12 +90,14 @@ exinfo_t stub_vmxon(uint64_t paddr)
                   : [paddr] "m" (paddr),
                     "X" (ex_record_fault_edi));
 
-    if ( fail_invalid )
+    if ( ex )
+        return ex;
+    else if ( fail_invalid )
         return VMERR_INVALID;
     else if ( fail_valid )
         return get_vmx_insn_err();
     else
-        return ex;
+        return VMERR_SUCCESS;
 }
 
 exinfo_t stub_vmptrld(uint64_t paddr)
@@ -114,12 +116,14 @@ exinfo_t stub_vmptrld(uint64_t paddr)
                   : [paddr] "m" (paddr),
                     "X" (ex_record_fault_edi));
 
-    if ( fail_invalid )
+    if ( ex )
+        return ex;
+    else if ( fail_invalid )
         return VMERR_INVALID;
     else if ( fail_valid )
         return get_vmx_insn_err();
     else
-        return ex;
+        return VMERR_SUCCESS;
 }
 
 exinfo_t __user_text stub_vmxon_user(uint64_t paddr)
@@ -138,12 +142,14 @@ exinfo_t __user_text stub_vmxon_user(uint64_t paddr)
                   : [paddr] "m" (paddr),
                     "X" (ex_record_fault_edi));
 
-    if ( fail_invalid )
+    if ( ex )
+        return ex;
+    else if ( fail_invalid )
         return VMERR_INVALID;
     else if ( fail_valid )
         return get_vmx_insn_err();
     else
-        return ex;
+        return VMERR_SUCCESS;
 }
 
 /*