From: Julien Grall Date: Mon, 11 May 2015 11:55:35 +0000 (+0100) Subject: tools/xenstored: Use XC_PAGE_SIZE rather than getpagesize() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~2911 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7c0a96af170d051453b2d7a8858f76358a51363e;p=xen.git tools/xenstored: Use XC_PAGE_SIZE rather than getpagesize() Linux may not use the same page granularity as Xen. This will result to a domain crash because it will try to map more page than required. As the xenstore page size willl always be equal to a Xen page size, use XC_PAGE_SIZE. Signed-off-by: Julien Grall Acked-by: Wei Liu Acked-by: Ian Campbell --- diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c index 6d0394d3f7..0776e39b69 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -172,7 +172,7 @@ static void *map_interface(domid_t domid, unsigned long mfn) GNTTAB_RESERVED_XENSTORE, PROT_READ|PROT_WRITE); } else { return xc_map_foreign_range(*xc_handle, domid, - getpagesize(), PROT_READ|PROT_WRITE, mfn); + XC_PAGE_SIZE, PROT_READ|PROT_WRITE, mfn); } } @@ -181,7 +181,7 @@ static void unmap_interface(void *interface) if (*xcg_handle != NULL) xc_gnttab_munmap(*xcg_handle, interface, 1); else - munmap(interface, getpagesize()); + munmap(interface, XC_PAGE_SIZE); } static int destroy_domain(void *_domain)