|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen stable-4.20] x86emul: ignore XOP.W for TBM insns in 32-bit mode
commit 8c445dcfaf85e6275be310efcc266226cfd61902
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Wed Nov 25 14:44:14 2026 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Nov 25 14:44:14 2026 +0100
x86emul: ignore XOP.W for TBM insns in 32-bit mode
Quoting 1179d51dcb7d ("x86emul: ignore VEX.W for BMI{1,2} insns in 32-bit
mode"):
"While result values and other status flags are unaffected as long as we
can ignore the case of registers having their upper 32 bits non-zero
outside of 64-bit mode, EFLAGS.SF may obtain a wrong value when we
mistakenly re-execute the original insn with VEX.W set.
Note that guest the memory access, if any, is correctly carried out as
32-bit regardless of VEX.W. The emulator-local memory operand will be
accessed as a 64-bit quantity, but it is pre-initialised to zero so no
internal state can leak."
The same applies to XOP-encoded integer insns.
Fixes: c4afd683f95c ("x86emul: support TBM insns")
Reported-by: Roger Pau Monné <roger.pau@xxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
master commit: c5ccc2fac9aa8a80827fac055003358ff4a435fe
master date: 2026-11-25 09:45:05 +0100
---
xen/arch/x86/x86_emulate/x86_emulate.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c
b/xen/arch/x86/x86_emulate/x86_emulate.c
index 414e7d86d6..a760115694 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -7941,6 +7941,8 @@ x86_emulate(
*pxop = vex;
pxop->b = 1;
pxop->r = 1;
+ if ( !mode_64bit() )
+ pxop->w = 0;
pxop->reg = 0xf; /* rAX */
buf[3] = b;
buf[4] = (modrm & 0x38) | 0x01; /* r/m=(%rCX) */
@@ -8050,6 +8052,8 @@ x86_emulate(
*pxop = vex;
pxop->b = 1;
pxop->r = 1;
+ if ( !mode_64bit() )
+ pxop->w = 0;
buf[3] = b;
buf[4] = 0x09; /* reg=rCX r/m=(%rCX) */
*(uint32_t *)(buf + 5) = imm1;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |