From: Andrew Cooper Date: Tue, 7 Mar 2017 23:32:24 +0000 (+0000) Subject: x86/emul: Avoid #UD in SIMD stubs X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~2548 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f9adc1e66098e96861af49ca2d5a223ad654dec6;p=xen.git x86/emul: Avoid #UD in SIMD stubs v{,u}comis{s,d}, and vcvt{,t}s{s,d}2si are two-operand instructions, while vzero{all,upper} take no operands. Each require vex.reg set to ~0 to avoid suffering #UD. Spotted while fuzzing with AFL Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 1b507f73d8..613648e53f 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -5620,7 +5620,7 @@ x86_emulate( { if ( ctxt->vendor == X86_VENDOR_AMD ) vex.l = 0; - generate_exception_if(vex.l, EXC_UD); + generate_exception_if(vex.l || vex.reg != 0xf, EXC_UD); host_and_vcpu_must_have(avx); get_fpu(X86EMUL_FPU_ymm, &fic); } @@ -5673,6 +5673,7 @@ x86_emulate( } else { + generate_exception_if(vex.reg != 0xf, EXC_UD); host_and_vcpu_must_have(avx); get_fpu(X86EMUL_FPU_ymm, &fic); } @@ -6273,6 +6274,7 @@ x86_emulate( case X86EMUL_OPC_VEX(0x0f, 0x77): /* vzero{all,upper} */ if ( vex.opcx != vex_none ) { + generate_exception_if(vex.reg != 0xf, EXC_UD); host_and_vcpu_must_have(avx); get_fpu(X86EMUL_FPU_ymm, &fic); }