[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/2] x86/emul: Correct the return value handling of VMFUNC



>>> On 21.12.16 at 17:32, <andrew.cooper3@xxxxxxxxxx> wrote:
> The bracketing of x86_emulate() calling the ops->vmfunc() hook is wrong with
> respect to the assignment to rc, which can trip the new assertions in
> x86_emulate_wrapper().
> 
> The hvmemul_vmfunc() hook should only raise #UD if X86EMUL_EXCEPTION is
> returned.  This is only a latent bug at the moment.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

> --- a/xen/arch/x86/hvm/emulate.c
> +++ b/xen/arch/x86/hvm/emulate.c
> @@ -1653,7 +1653,7 @@ static int hvmemul_vmfunc(
>      if ( !hvm_funcs.altp2m_vcpu_emulate_vmfunc )
>          return X86EMUL_UNHANDLEABLE;
>      rc = hvm_funcs.altp2m_vcpu_emulate_vmfunc(ctxt->regs);
> -    if ( rc != X86EMUL_OKAY )
> +    if ( rc == X86EMUL_EXCEPTION )
>          x86_emul_hw_exception(TRAP_invalid_op, X86_EVENT_NO_EC, ctxt);

Great - saves me from submitting one of my follow-up patches.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.