From: Julien Grall Subject: [PATCH 1/2] tools/xenstored: Use XC_PAGE_SIZE rather than getpagesize() Date: Mon, 11 May 2015 12:55:35 +0100 Message-ID: <1431345336-5476-2-git-send-email-julien.grall@citrix.com> References: <1431345336-5476-1-git-send-email-julien.grall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YrmJz-0000JM-Oy for xen-devel@lists.xenproject.org; Mon, 11 May 2015 11:56:31 +0000 In-Reply-To: <1431345336-5476-1-git-send-email-julien.grall@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: wei.liu2@citrix.com, ian.campbell@citrix.com, tim@xen.org, Julien Grall , ian.jackson@eu.citrix.com, Julien Grall , stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org From: Julien Grall 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 --- tools/xenstore/xenstored_domain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c index 6d0394d..0776e39 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) -- 2.1.4