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

[Xen-devel] [PATCH] tools/libxencall: enforce proper alignment of hypercall buffers



xencall_alloc_buffer() is used throughout Xen tools for allocating
hypercall buffers. Allocation is done at page granularity. For simple
administration each allocated set of pages contains a small header
holding the number of pages of that set. The hypercall buffer is
located directly after the 4 byte sized header, leading to a wrong
alignment for e.g. pointers.

Repair that by using a 16 byte sized header enforcing the same
alignment as malloc().

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
Not sure whether this wants to be backported. In case the answer is
"yes" I think it should be part of 4.11.
---
 tools/libs/call/buffer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/libs/call/buffer.c b/tools/libs/call/buffer.c
index 2d8fc29ac6..0b6af2db60 100644
--- a/tools/libs/call/buffer.c
+++ b/tools/libs/call/buffer.c
@@ -151,6 +151,7 @@ void xencall_free_buffer_pages(xencall_handle *xcall, void 
*p, size_t nr_pages)
 
 struct allocation_header {
     int nr_pages;
+    int pad[3];
 };
 
 void *xencall_alloc_buffer(xencall_handle *xcall, size_t size)
-- 
2.13.7


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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