From: Julien Grall Subject: [PATCH 2/2] tools/xenconsoled: Use XC_PAGE_SIZE rather than getpagesize() Date: Mon, 11 May 2015 12:55:36 +0100 Message-ID: <1431345336-5476-3-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 1YrmJy-0000J9-ML for xen-devel@lists.xenproject.org; Mon, 11 May 2015 11:56:30 +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 console page size will always be equal to a Xen page size, use XC_PAGE_SIZE. Signed-off-by: Julien Grall --- tools/console/daemon/io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index ac08b5b..e246c25 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -523,7 +523,7 @@ static void domain_unmap_interface(struct domain *dom) if (xcg_handle && dom->ring_ref == -1) xc_gnttab_munmap(xcg_handle, dom->interface, 1); else - munmap(dom->interface, getpagesize()); + munmap(dom->interface, XC_PAGE_SIZE); dom->interface = NULL; dom->ring_ref = -1; } @@ -562,7 +562,7 @@ static int domain_create_ring(struct domain *dom) if (!dom->interface) { /* Fall back to xc_map_foreign_range */ dom->interface = xc_map_foreign_range( - xc, dom->domid, getpagesize(), + xc, dom->domid, XC_PAGE_SIZE, PROT_READ|PROT_WRITE, (unsigned long)ring_ref); if (dom->interface == NULL) { -- 2.1.4