From: Julien Grall Date: Fri, 7 Aug 2015 18:53:55 +0000 (+0100) Subject: tools/libxc: linux: Don't use getpagesize() when unmapping the grants X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~2635 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=31cf2ca7518188ec154d1d82c38970883183fa3b;p=xen.git tools/libxc: linux: Don't use getpagesize() when unmapping the grants The grants are based on the Xen granularity (i.e 4KB). While the function to map grants for Linux (linux_gnttab_grant_map) is using the correct size (XC_PAGE_SIZE), the unmap one (linux_gnttab_munmap) is using getpagesize(). On domain using a page granularity different than Xen (this is the case for AARCH64 guest using 64KB page), the unmap will be called with the wrong size. Signed-off-by: Julien Grall Acked-by: Wei Liu Acked-by: Ian Campbell --- diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c index e375428e97..76c55ff304 100644 --- a/tools/libxc/xc_linux_osdep.c +++ b/tools/libxc/xc_linux_osdep.c @@ -742,7 +742,7 @@ static int linux_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h, } /* Next, unmap the memory. */ - if ( (rc = munmap(start_address, count * getpagesize())) ) + if ( (rc = munmap(start_address, count * XC_PAGE_SIZE)) ) return rc; /* Finally, unmap the driver slots used to store the grant information. */