Skip to contentSkip to conversation

x86emul: properly refuse LOCK on most 0FC7 insns

PATCH In review Jan Beulich 2 participants 2 messages Sep 22, 2017 – Sep 27, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86emul: properly refuse LOCK on most 0FC7 insns

When adding support for RDRAND/RDSEED/RDPID I didn't remember to also update this special early check. Make it (hopefully) future-proof by also refusing VEX-encodings.

xen/arch/x86/x86_emulate/x86_emulate.c +3 -1
@@ -3087,7 +3087,9 @@ x86_emulate(
          * The only implicit-operands instructions allowed a LOCK prefix are
          * CMPXCHG{8,16}B (MOV CRn is being handled elsewhere).
          */
-        generate_exception_if(lock_prefix && (ext != ext_0f || b != 0xc7),
+        generate_exception_if(lock_prefix &&
+                              (vex.opcx || ext != ext_0f || b != 0xc7 ||
+                               (modrm_reg & 7) != 1 || ea.type != OP_MEM),
                               EXC_UD);
         dst.type = OP_NONE;
         break;

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel