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

Re: [Xen-devel] [PATCH v3] Sanity check xsave area when migrating or restoring from older Xen verions



>>> On 20.10.14 at 22:40, <dkoch@xxxxxxxxxxx> wrote:
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -1971,6 +1971,7 @@ static int hvm_load_cpu_xsave_states(struct domain *d, 
> hvm_domain_context_t *h)
>      struct vcpu *v;
>      struct hvm_hw_cpu_xsave *ctxt;
>      struct hvm_save_descriptor *desc;
> +    int i, overflow_start;

unsigned int

> @@ -2020,6 +2021,7 @@ static int hvm_load_cpu_xsave_states(struct domain *d, 
> hvm_domain_context_t *h)
>          return -EOPNOTSUPP;
>      }
>      h->cur += sizeof (*desc);
> +    overflow_start = h->cur;
>  
>      ctxt = (struct hvm_hw_cpu_xsave *)&h->data[h->cur];
>      h->cur += desc->length;
> @@ -2041,7 +2043,18 @@ static int hvm_load_cpu_xsave_states(struct domain *d, 
> hvm_domain_context_t *h)
>          printk(XENLOG_G_WARNING
>                 "HVM%d.%d restore mismatch: xsave length %u > %u\n",
>                 d->domain_id, vcpuid, desc->length, size);
> -        return -EOPNOTSUPP;
> +
> +        /* Make sure missing bytes are all zero. */
> +        for ( i = size; i < desc->length; i++ )
> +        {
> +            if ( h->data[overflow_start + i] )
> +            {
> +                printk(XENLOG_G_WARNING
> +                       "HVM%d.%d restore mismatch: xsave has non-zero data 
> starting at %d\n",
> +                       d->domain_id, vcpuid, i);
> +                return -EOPNOTSUPP;

You were asked to avoid issuing two messages in this case, and iirc
you indicated you would adjust your patch to do so, yet nothing
really changed here. Also please print offsets in hex (%#x) and
don't further proliferate the wrong format specifier used for vcpuid
into newly added messages: vcpuid is "unsigned int" and hence
wants to be printed using %u.

And finally iirc you also indicated you'd drop the full-size check
(against HVM_CPU_XSAVE_SIZE(xfeature_mask)), which we
identified to be wrong in case the origin machine had bigger
xsave state than the receiving one.

Jan


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


 


Rackspace

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