From: Jan Beulich Date: Fri, 5 Apr 2019 15:27:13 +0000 (+0200) Subject: x86emul: don't read mask register on AVX512F-incapable platforms X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~2355 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6cb7e52edf823fd89fe14da94f9bf3e5cf99d1ff;p=xen.git x86emul: don't read mask register on AVX512F-incapable platforms Nor when register state isn't sufficiently enabled. Reported-by: George Dunlap Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index ec77d125e7..032995ea58 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -3557,7 +3557,8 @@ x86_emulate( } /* With a memory operand, fetch the mask register in use (if any). */ - if ( ea.type == OP_MEM && evex.opmsk ) + if ( ea.type == OP_MEM && evex.opmsk && + _get_fpu(fpu_type = X86EMUL_FPU_opmask, ctxt, ops) == X86EMUL_OKAY ) { uint8_t *stb = get_stub(stub); @@ -3578,6 +3579,14 @@ x86_emulate( fault_suppression = true; } + if ( fpu_type == X86EMUL_FPU_opmask ) + { + /* Squash (side) effects of the _get_fpu() above. */ + x86_emul_reset_event(ctxt); + put_fpu(X86EMUL_FPU_opmask, false, state, ctxt, ops); + fpu_type = X86EMUL_FPU_none; + } + /* Decode (but don't fetch) the destination operand: register or memory. */ switch ( d & DstMask ) {