From patchwork Mon May 23 14:17:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 68388 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp112364qge; Mon, 23 May 2016 07:19:28 -0700 (PDT) X-Received: by 10.176.3.85 with SMTP id 79mr9591299uat.142.1464013164003; Mon, 23 May 2016 07:19:24 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id n194si20265939vka.77.2016.05.23.07.19.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 May 2016 07:19:23 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b4qgH-0003oc-VJ; Mon, 23 May 2016 14:18:05 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b4qgH-0003mE-6T for xen-devel@lists.xen.org; Mon, 23 May 2016 14:18:05 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id C7/E4-02973-C1113475; Mon, 23 May 2016 14:18:04 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBLMWRWlGSWpSXmKPExsVysyfVTVdG0Dn coHc1k8WSj4tZHBg9ju7+zRTAGMWamZeUX5HAmnF5SxtTwRHeigOv3rE1MK7m6mLk4hAS2MQo sWP+f0YI5zSjxP7Vj9m7GDk52AQ0Je58/sQEYosISEtc+3wZrIhZYA6jxJoHf5lBEsICiRLL9 n1mAbFZBFQlmn8tZwOxeQVcJRYfPAzWLCEgJ3Hy2GRWEJsTKL79yzlGEFtIwEWi49ZO9gmM3A sYGVYxahSnFpWlFukamuolFWWmZ5TkJmbm6BoamOrlphYXJ6an5iQmFesl5+duYgT6mAEIdjA 2bPc8xCjJwaQkyntyh1O4EF9SfkplRmJxRnxRaU5q8SFGGQ4OJQnezfzO4UKCRanpqRVpmTnA YINJS3DwKInwHuIDSvMWFyTmFmemQ6ROMSpKifNOA+kTAElklObBtcEC/BKjrJQwLyPQIUI8B alFuZklqPKvGMU5GJWEebeATOHJzCuBm/4KaDET0OKH0g4gi0sSEVJSDYxBfOciNAW4vt37NW 8Z45bbBb5J6172+j1k+ausHNMQ5jzDzrd3hrLQoq/6IkyszQbJu5gs63aXWnzNLmja+iPZ4nH jeQN9pUr1qvu8TdosvWaRz5s+R8adrhbsTT3VdW7L5TdTJsjklXY61yt4PZtw4tyvR6+usKqL f2RdxX/z48VIi5XbriqxFGckGmoxFxUnAgC5oOvOawIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-3.tower-206.messagelabs.com!1464013068!37465424!11 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 36344 invoked from network); 23 May 2016 14:18:03 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-3.tower-206.messagelabs.com with SMTP; 23 May 2016 14:18:03 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A6BC2441; Mon, 23 May 2016 07:18:25 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.215.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 60F9B3F21A; Mon, 23 May 2016 07:18:02 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Mon, 23 May 2016 15:17:31 +0100 Message-Id: <1464013052-32587-15-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1464013052-32587-1-git-send-email-julien.grall@arm.com> References: <1464013052-32587-1-git-send-email-julien.grall@arm.com> Cc: sstabellini@kernel.org, wei.liu2@citrix.com, steve.capper@arm.com, andre.przywara@arm.com, Julien Grall , wei.chen@linaro.org Subject: [Xen-devel] [PATCH v2 14/15] xen/arm: traps: Don't inject a fault if the translation VA -> IPA fails X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Based on ARM ARM (D4.5.3 in ARM DDI 0486A and B3.12.7 in ARM DDI 0406C.c), a Stage 1 translation error has priority over a Stage 2 translation error. Therefore gva_to_ipa can only fail if another vCPU is playing with the page table. Rather than injecting a custom fault, replay the instruction and let the processor injecting the correct fault. This is fine as Xen is handling all the pending softirqs (see leave_hypervisor_tail) before returning to the guest. One of them is the scheduler which could reschuled the vCPU. Signed-off-by: Julien Grall --- Changes in v2: - Update commit message to explain why a guest cannot DoS the hypervisor with it. --- xen/arch/arm/traps.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index c0325d5..3acdba0 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2410,7 +2410,7 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs, rc = gva_to_ipa(gva, &gpa, GV2M_READ); if ( rc == -EFAULT ) - goto bad_insn_abort; + return; /* Try again */ } rc = p2m_mem_access_check(gpa, gva, npfec); @@ -2422,7 +2422,6 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs, break; } -bad_insn_abort: inject_iabt_exception(regs, gva, hsr.len); } @@ -2452,7 +2451,7 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, { rc = gva_to_ipa(info.gva, &info.gpa, GV2M_READ); if ( rc == -EFAULT ) - goto bad_data_abort; + return; /* Try again */ } switch ( dabt.dfsc & 0x3f )