On 26/06/18 07:36, Jan Beulich wrote:
> Just in case we still don't get CR0.TS handling right, prevent a host
> crash by honoring exception fixups in do_device_not_available(). This
> would in particular cover emulator stubs raising #NM.
>
> Signed-off-by: Jan Beulich <jbeul...@suse.com>
> ---
> v2: Add ASSERT_UNREACHABLE().
>
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -1749,7 +1749,21 @@ void do_device_not_available(struct cpu_
>  {
>      struct vcpu *curr = current;
>  
> -    BUG_ON(!guest_mode(regs));
> +    if ( !guest_mode(regs) )
> +    {
> +        unsigned long fixup = search_exception_table(regs);
> +
> +        dprintk(XENLOG_ERR, "#NM: %p [%ps] -> %p\n",

gprintk() please.  the current vcpu is very likely relevant, and it
would be extremely useful to see this line in release builds where it to
happen.

> +                _p(regs->rip), _p(regs->rip), _p(fixup));
> +        /*
> +         * We mustn't come here, but for release builds have the recovery

"We shouldn't be able to reach here..."

Otherwise, Reviewed-by: Andrew Cooper <andrew.coop...@citrix.com>

> +         * logic in place nevertheless.
> +         */
> +        ASSERT_UNREACHABLE();
> +        BUG_ON(!fixup);
> +        regs->rip = fixup;
> +        return;
> +    }
>  
>      vcpu_restore_fpu_lazy(curr);
>  
>
>
>
>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to