x86emul: CMPXCHG{8,16}B are memory writes
authorJan Beulich <jbeulich@suse.com>
Fri, 20 Jan 2017 13:36:58 +0000 (14:36 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 20 Jan 2017 13:36:58 +0000 (14:36 +0100)
This fixes a regression introduced by commit ff913f68c9 ("x86/PV:
restrict permitted instructions during memory write emulation")
breaking namely 32-bit PV guests (which commonly use CMPXCHG8B for
certain page table updates).

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

index 880d565eb9441bd00db4780c8a82d796aebbfa34..520311f930621f130c8c62e4f0e4f3f4814f8078 100644 (file)
@@ -6566,6 +6566,9 @@ x86_insn_is_mem_write(const struct x86_emulate_state *state,
 
     case X86EMUL_OPC(0x0f, 0xba):
         return (state->modrm_reg & 7) > 4; /* BTS / BTR / BTC */
+
+    case X86EMUL_OPC(0x0f, 0xc7):
+        return (state->modrm_reg & 7) == 1; /* CMPXCHG{8,16}B */
     }
 
     return false;