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

Re: [Xen-devel] [PATCH v2 2/2] x86/xstate: Make errors in xstate calculations more obvious by crashing the domain



>>> On 18.07.18 at 19:20, <andrew.cooper3@xxxxxxxxxx> wrote:
> --- a/xen/arch/x86/xstate.c
> +++ b/xen/arch/x86/xstate.c
> @@ -707,12 +707,27 @@ int handle_xsetbv(u32 index, u64 new_bv)
>      if ( index != XCR_XFEATURE_ENABLED_MASK )
>          return -EOPNOTSUPP;
>  
> -    if ( (new_bv & ~xcr0_max) ||
> -         (new_bv & ~xfeature_mask) || !valid_xcr0(new_bv) )
> +    if ( (new_bv & ~xcr0_max) || !valid_xcr0(new_bv) )
>          return -EINVAL;
>  
> +    if ( new_bv & ~xfeature_mask )
> +    {
> +        gprintk(XENLOG_ERR,
> +                "new_bv %016" PRIx64 " exceeds hardware max %016" PRIx64 
> "\n",
> +                new_bv, xfeature_mask);
> +        domain_crash(curr->domain);
> +
> +        return -EINVAL;
> +    }
> +

The suggested change to patch 1 will render this addition pointless.

>      if ( !set_xcr0(new_bv) )
> +    {
> +        gprintk(XENLOG_ERR, "new_bv %016" PRIx64 " rejected by hardware\n",
> +                new_bv);
> +        domain_crash(curr->domain);
> +
>          return -EFAULT;
> +    }
>  
>      mask = new_bv & ~curr->arch.xcr0_accum;
>      curr->arch.xcr0 = new_bv;

With just this part left
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan



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

 


Rackspace

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