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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

patchbot
commit f5d10dc2909c84e4ffc7240e542c513ed480aa04
Author:     Juergen Gross <[hidden email]>
AuthorDate: Fri Jun 8 11:51:12 2018 +0200
Commit:     Wei Liu <[hidden email]>
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 <[hidden email]>
    Acked-by: Wei Liu <[hidden email]>
---
 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
[hidden email]
https://lists.xenproject.org/xen-changelog