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

Re: [Xen-devel] [PATCH v6 05/16] x86/hvm: unify internal portio and mmio intercepts



>>> On 03.07.15 at 18:25, <paul.durrant@xxxxxxxxxx> wrote:
> -void relocate_io_handler(
> -    struct domain *d, unsigned long old_addr, unsigned long new_addr,
> -    unsigned int size, int type)
> +void relocate_portio_handler(struct domain *d, uint16_t old_port,
> +                             uint16_t new_port, unsigned int size)
>  {
> -    struct hvm_io_handler *handler = d->arch.hvm_domain.io_handler;
> -    int i;
> -
> -    for ( i = 0; i < handler->num_slot; i++ )
> -        if ( (handler->hdl_list[i].addr == old_addr) &&
> -             (handler->hdl_list[i].size == size) &&
> -             (handler->hdl_list[i].type == type) )
> -            handler->hdl_list[i].addr = new_addr;
> +    unsigned int i;
> +
> +    for ( i = 0; i < d->arch.hvm_domain.io_handler_count; i++ )
> +    {
> +        struct hvm_io_handler *handler =
> +            &d->arch.hvm_domain.io_handler[i];
> +
> +        if ( handler->type != IOREQ_TYPE_PIO )
> +            continue;
> +
> +        if ( (handler->portio.start == old_port) &&
> +             (handler->portio.end = old_port + size) )
> +        {
> +            handler->portio.start = new_port;
> +            handler->portio.end = new_port + size;
> +            break;
> +        }
> +    }
> +}

I'm afraid you're introducing a race with the consumer of this data
here: Previously the update consisted of a single write, i.e. the
consumer would see either the old or the new data. After the
change it may see partially updated state.

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