On 11/08/2016 11:22 AM, Roger Pau Monne wrote:
Commit fac7f7 changed the value of ptr so that it points to the right memory
area, taking the page offset into account, but failed to remove this when
doing the unmap, which caused the region to not be unmapped. Fix this by not
modifying ptr and instead adding the page offset directly in the memcpy
call.
Reported-by: Andrew Cooper <andrew.coop...@citrix.com>
Signed-off-by: Roger Pau Monné <roger....@citrix.com>
---
Cc: Wei Liu <wei.l...@citrix.com>
Cc: Andrew Cooper <andrew.coop...@citrix.com>
Cc: Boris Ostrovsky <boris.ostrov...@oracle.com>
Cc: Ian Jackson <ian.jack...@eu.citrix.com>
---
tools/libxc/xc_dom_core.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c
index ad819dd..36cd3c8 100644
--- a/tools/libxc/xc_dom_core.c
+++ b/tools/libxc/xc_dom_core.c
@@ -1119,10 +1119,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);
-
- memcpy(ptr, dom->acpi_modules[i].data, dom->acpi_modules[i].length);
+ memcpy((uint8_t *)ptr +
+ (dom->acpi_modules[i].guest_addr_out & ~XC_PAGE_MASK),
+ dom->acpi_modules[i].data, dom->acpi_modules[i].length);
munmap(ptr, XC_PAGE_SIZE * num_pages);
free(extents);
Reviewed-by: Boris Ostrovsky <boris.ostrov...@oracle.com>
(Although I don't think this would cause memory not to be unmapped: per
Linux man page "All pages containing a part of the indicated range are
unmapped ..." and ptr is offset from its original value by a fraction of
a page.)
-boris
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel