]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86/HVM: hvmemul_cmpxchg() should also use known_gla()
authorJan Beulich <jbeulich@suse.com>
Thu, 15 Nov 2018 12:36:52 +0000 (13:36 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 15 Nov 2018 12:36:52 +0000 (13:36 +0100)
To be consistent with the write and rmw cases the mapping approach
should not be used when the guest linear address translation is known.
This in particular excludes the discard-write case from bypassing the
emulation path. This also means that now EFLAGS should actually get
properly updated, despite the discarded write portion of the memory
access.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
xen/arch/x86/hvm/emulate.c

index e08524be49fc9c2d023e3d31c491d504e0b2e756..488ea5e956a8413f7666621ac475982cc5968300 100644 (file)
@@ -1472,9 +1472,12 @@ static int hvmemul_cmpxchg(
     else if ( hvmemul_ctxt->seg_reg[x86_seg_ss].dpl == 3 )
         pfec |= PFEC_user_mode;
 
-    mapping = hvmemul_map_linear_addr(addr, bytes, pfec, hvmemul_ctxt);
-    if ( IS_ERR(mapping) )
-        return ~PTR_ERR(mapping);
+    if ( !known_gla(addr, bytes, pfec) )
+    {
+        mapping = hvmemul_map_linear_addr(addr, bytes, pfec, hvmemul_ctxt);
+        if ( IS_ERR(mapping) )
+            return ~PTR_ERR(mapping);
+    }
 
     if ( !mapping )
     {