From patchwork Wed Jun 22 11:15:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 70637 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp2492787qgy; Wed, 22 Jun 2016 04:18:02 -0700 (PDT) X-Received: by 10.31.162.209 with SMTP id l200mr12411881vke.37.1466594270580; Wed, 22 Jun 2016 04:17:50 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id h142si30590123vkh.92.2016.06.22.04.17.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Jun 2016 04:17:50 -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 1bFg8P-0002Wi-92; Wed, 22 Jun 2016 11:15:53 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFg8O-0002TU-Js for xen-devel@lists.xen.org; Wed, 22 Jun 2016 11:15:52 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 91/7F-22092-7637A675; Wed, 22 Jun 2016 11:15:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTTe9OCv c4MoOZYslHxezODB6HN39mymAMYo1My8pvyKBNWPix3NsBf/4Ku7evc7SwLidu4uRi0NIYBOj xILpy9kgnNOMEsvXHGLtYuTkYBPQlLjz+RMTiC0iIC1x7fNlRhCbWcBB4s3HeywgtrBAosTdM 2uA6jk4WARUJZ48kQYJ8wq4SnTOvAXWKiEgJ3Hy2GSwkZxA8ZNHJ4ONERJwkbh9YA/rBEbuBY wMqxjVi1OLylKLdI30kooy0zNKchMzc3QNDcz0clOLixPTU3MSk4r1kvNzNzECvcsABDsYl/1 1OsQoycGkJMorr5wVLsSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mC93IhUE6wKDU9tSItMwcYZjBp CQ4eJRHeiSBp3uKCxNzizHSI1ClGRSlx3mUgCQGQREZpHlwbLLQvMcpKCfMyAh0ixFOQWpSbW YIq/4pRnINRSZj3JsgUnsy8Erjpr4AWMwEtXtafDrK4JBEhJdXAaFS5QXoXf2D7xM3686+GHl G/mJbUXGtzmPFO6FPjZ6zlBzWKvb61TOYUeLX0hf25S7z3sm4deJpy+JNV0uQNTcce5803O/j Hjk3n3bLteZXBG19uCOw4veKi0n295s1P2Ru5zrjXzHVc+WzLtdfhWfd4ombwqfIsOh+yvfKf wKQI7kPFu/NbfyqxFGckGmoxFxUnAgBPk2unaAIAAA== X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-14.tower-21.messagelabs.com!1466594149!20173687!2 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25653 invoked from network); 22 Jun 2016 11:15:51 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-21.messagelabs.com with SMTP; 22 Jun 2016 11:15:51 -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 209903B0; Wed, 22 Jun 2016 04:16:38 -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 88F3C3F213; Wed, 22 Jun 2016 04:15:50 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 22 Jun 2016 12:15:30 +0100 Message-Id: <1466594130-19251-16-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466594130-19251-1-git-send-email-julien.grall@arm.com> References: <1466594130-19251-1-git-send-email-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v4 15/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 rescheduled the vCPU. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- Changes in v4: - s/reschuled/rescheduled/ in the commit message Changes in v3: - Add Stefano's acked-by 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 7dd13b5..0709deb 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2409,7 +2409,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); @@ -2421,7 +2421,6 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs, break; } -bad_insn_abort: inject_iabt_exception(regs, gva, hsr.len); } @@ -2451,7 +2450,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 )