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

[Xen-changelog] [xen staging] tools/libxencall: enforce proper alignment of hypercall buffers



commit f5d10dc2909c84e4ffc7240e542c513ed480aa04
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Fri Jun 8 11:51:12 2018 +0200
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Jul 10 16:04:56 2018 +0100

    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>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 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)
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
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®.