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

Re: [Xen-devel] [PATCH for-4.8 1/2] libxc: properly account for the page offset when copying ACPI data



On 07/11/16 11:55, Roger Pau Monne wrote:
> Or else ACPI data is always copied at the start of the page pointed by
> guest_addr_out, ignoring the page offset.
>
> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
> Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> ---
>  tools/libxc/xc_dom_core.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c
> index e177667..cbc1a43 100644
> --- a/tools/libxc/xc_dom_core.c
> +++ b/tools/libxc/xc_dom_core.c
> @@ -1118,6 +1118,9 @@ static int xc_dom_load_acpi(struct xc_dom_image *dom)
>              goto err;
>          }
>  
> +        ptr = (uint8_t *)ptr +
> +              (dom->acpi_modules[i].guest_addr_out & ~XC_PAGE_MASK);

You also need to adjust the num_pages calculation, or you risk
memcpy()'ing off the end of the foreign mapping.

~Andrew

> +
>          memcpy(ptr, dom->acpi_modules[i].data, dom->acpi_modules[i].length);
>          munmap(ptr, XC_PAGE_SIZE * num_pages);
>  


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