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

[PATCH 2/3] tools/libxl: Correctly aligned buffer for ACPI tables


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Kevin Stefanov <kevin.stefanov@xxxxxxxxxx>
  • Date: Thu, 9 Sep 2021 17:34:40 +0100
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Kevin Stefanov <kevin.stefanov@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Thu, 09 Sep 2021 16:35:07 +0000
  • Ironport-hdrordr: A9a23:GiRqhKzLr91ncqQjwy5MKrPw2r1zdoMgy1knxilNoHxuH/BwWf rPoB17726TtN91YhsdcL+7V5VoLUmzyXcx2/hyAV7AZniAhILLFvAA0WKK+VSJdxEWtNQtsJ uIG5IUNDSaNykfsS+V2miF+9ZL+qj5zEir792usUuEm2tRGtBdBwQSMHfqLqVvLjM2fKbQjP Cnl7d6TzzLQwVuUu2LQkMrcsLkvNPxmJfvcXc9dmIaAFnnt0LS1FbieSLopCsjbw==
  • Ironport-sdr: XVrzfeg/RpgzLA8csCHC+Mc3NGz0xP5HCaQGB9gx1e3k6S9orcQfSFmA0+ddQ1jZv1hQpKl7Lt TAx3JpmSlonEk2KEpz5CfKpHdOs22WSLO4F3HgPjwjfKG8+jNgACYVqVHP0zksNEuZc4kNvkJ7 c4rVsOFS01/8Y66KPMfohKkfFtx5CJHo2W2gn7WeNoG/4R+ERdHnRZfVY/+207j7R89HZ8W3Fj gHReyXDEGgvC7jQjXf6rtm3IPMMNE87lh3IIPJy3/QqJcyyskQ6/aC8C/dYAjMA8HGUDye4z8A tsQ4oQ/2Q3tv69Jp0U1HmxZS
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The pointer resulting from libxl__malloc() has no explicit alignment.
As an implementation detail, it has 16-byte alignment.

When this buffer is used by libacpi aligning ACPI tables to greater
than 16 does not work correctly.  This causes the FACS to not be
64-byte aligned when the ACPI tables are copied into guest memory.

Align the ACPI tables buffer to a page, to match the alignment
inside guest memory. The buffer is already one page too large,
presumably intended for this purpose originally.

Fixes: 14c0d328da2b ("libxl/acpi: Build ACPI tables for HVMlite guests")
Signed-off-by: Kevin Stefanov <kevin.stefanov@xxxxxxxxxx>
---
CC: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Ian Jackson <iwj@xxxxxxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 tools/libs/light/libxl_x86_acpi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/light/libxl_x86_acpi.c 
b/tools/libs/light/libxl_x86_acpi.c
index 3eca1c7a9f..0a82e7cacd 100644
--- a/tools/libs/light/libxl_x86_acpi.c
+++ b/tools/libs/light/libxl_x86_acpi.c
@@ -193,6 +193,7 @@ int libxl__dom_load_acpi(libxl__gc *gc,
      * Set up allocator memory.
      * Start next to acpi_info page to avoid fracturing e820.
      */
+    acpi_pages = (void *)ROUNDUP((unsigned long)acpi_pages, 
libxl_ctxt.page_shift);
     libxl_ctxt.alloc_base_paddr = ACPI_INFO_PHYSICAL_ADDRESS +
         libxl_ctxt.page_size;
     libxl_ctxt.alloc_base_vaddr = libxl_ctxt.alloc_currp =
-- 
2.25.1




 


Rackspace

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