From patchwork Mon May 11 11:55:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 48275 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1C5F521578 for ; Mon, 11 May 2015 11:58:15 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf38946306wgt.1 for ; Mon, 11 May 2015 04:58:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=qZ17DMiGW1Ka7ls5H8W0VbUuuRMX2GugaBD+65K/rFE=; b=GBdfVEZGFu1PD0eA8+G5tcnPii4L2bOd0k6jJU9RhNQpcx3xqeDPKumQRC7UAGSHH2 vJhpCwxw4gFu8vcpoYvKHIGKm4yiBi6z/hhumoopAyaubYwPUfYnTVZvdLQktqYdDtzJ 3uM1WVgj83f1bKO/enQMoPDl5VoreC7wpEjIhHle7vNh1TtocHJFSQdL9/lPLg6wnbOd Ua0uHXEP1gjvbT0oMOvkXIy9tRYzPJ8RutRJHfS1GsUNoWlfbeBwT0r7JvlBSk9RGRQP avnSpPLUCqxSvF7DdSQafJ0wUv63i9X3E3lqHH/ueayLg5mEJUSIGnzt6DSTCOT+waXP sWYA== X-Gm-Message-State: ALoCoQkJdGfhpYlesy5inr2hJsLc8CYl+UJtmA1/qyEhY85u8qlb/Kzbe5wePiFv6BzhsBfsGj9o X-Received: by 10.112.203.168 with SMTP id kr8mr7250264lbc.10.1431345494401; Mon, 11 May 2015 04:58:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.37 with SMTP id p5ls632407lah.9.gmail; Mon, 11 May 2015 04:58:14 -0700 (PDT) X-Received: by 10.152.115.232 with SMTP id jr8mr7545085lab.2.1431345494154; Mon, 11 May 2015 04:58:14 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id tq9si8226511lbb.126.2015.05.11.04.58.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 04:58:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbqq2 with SMTP id qq2so91942913lbb.3 for ; Mon, 11 May 2015 04:58:13 -0700 (PDT) X-Received: by 10.112.13.6 with SMTP id d6mr7656259lbc.117.1431345493870; Mon, 11 May 2015 04:58:13 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1461047lbb; Mon, 11 May 2015 04:58:13 -0700 (PDT) X-Received: by 10.229.16.69 with SMTP id n5mr13319072qca.25.1431345491063; Mon, 11 May 2015 04:58:11 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id 133si8137034qhx.1.2015.05.11.04.58.10 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 11 May 2015 04:58:11 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YrmJz-0000JY-Lh; Mon, 11 May 2015 11:56:31 +0000 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 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 52/84-03028-DE890555; Mon, 11 May 2015 11:56:29 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-4.tower-31.messagelabs.com!1431345387!14168471!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 6.13.14; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15221 invoked from network); 11 May 2015 11:56:28 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-4.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 11 May 2015 11:56:28 -0000 X-IronPort-AV: E=Sophos;i="5.13,406,1427760000"; d="scan'208";a="263708221" From: Julien Grall To: Date: Mon, 11 May 2015 12:55:36 +0100 Message-ID: <1431345336-5476-3-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431345336-5476-1-git-send-email-julien.grall@citrix.com> References: <1431345336-5476-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 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 Subject: [Xen-devel] [PATCH 2/2] tools/xenconsoled: Use XC_PAGE_SIZE rather than getpagesize() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: 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) {