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

[Xen-changelog] [xen master] libxc: properly account for the page offset when copying ACPI data



commit fac7f77b69797d0659489e49dfb3f35f8acf2b97
Author:     Roger Pau Monne <roger.pau@xxxxxxxxxx>
AuthorDate: Mon Nov 7 16:32:00 2016 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Nov 8 01:55:27 2016 +0000

    libxc: properly account for the page offset when copying ACPI data
    
    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>
    Reviewed-and-Tested-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxc/xc_dom_core.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c
index e177667..ad819dd 100644
--- a/tools/libxc/xc_dom_core.c
+++ b/tools/libxc/xc_dom_core.c
@@ -1090,8 +1090,9 @@ static int xc_dom_load_acpi(struct xc_dom_image *dom)
                   dom->acpi_modules[i].length,
                   dom->acpi_modules[i].guest_addr_out);
 
-        num_pages = (dom->acpi_modules[i].length + (XC_PAGE_SIZE - 1)) >>
-                       XC_PAGE_SHIFT;
+        num_pages = (dom->acpi_modules[i].length +
+                     (dom->acpi_modules[i].guest_addr_out & ~XC_PAGE_MASK) +
+                     (XC_PAGE_SIZE - 1)) >> XC_PAGE_SHIFT;
         extents = malloc(num_pages * sizeof(*extents));
         if ( !extents )
         {
@@ -1118,6 +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);
         munmap(ptr, XC_PAGE_SIZE * num_pages);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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