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

Re: [Xen-devel] [PATCH for-4.9 1/2] x86/pv: Fix the handling of `int $x` for vectors which alias exceptions



>>> On 15.05.17 at 14:50, <andrew.cooper3@xxxxxxxxxx> wrote:
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -633,9 +633,12 @@ void pv_inject_event(const struct x86_event *event)
>      const struct trap_info *ti;
>      const uint8_t vector = event->vector;
>      const bool use_error_code =
> +        (event->type == X86_EVENTTYPE_HW_EXCEPTION) &&
>          ((vector < 32) && (TRAP_HAVE_EC & (1u << vector)));
>      unsigned int error_code = event->error_code;
>  
> +    ASSERT(event->type == X86_EVENTTYPE_HW_EXCEPTION ||
> +           event->type == X86_EVENTTYPE_SW_INTERRUPT);

Wouldn't it be better to tighten this even further:

    if ( event->type == X86_EVENTTYPE_HW_EXCEPTION )
    {
        ASSERT(vector < 32);
        use_error_code = TRAP_HAVE_EC & (1u << vector);
    }
    else
    {
        ASSERT(event->type == X86_EVENTTYPE_SW_INTERRUPT);
        use_error_code = false;
    }

? If you agree
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
with this or a substantially identical change.

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®.