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: 9192447 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4DFE8601C0 for ; Wed, 22 Jun 2016 11:17:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E62C283E9 for ; Wed, 22 Jun 2016 11:17:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 332AE283F7; Wed, 22 Jun 2016 11:17:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D7A54283E9 for ; Wed, 22 Jun 2016 11:17:47 +0000 (UTC) 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" X-Virus-Scanned: ClamAV using ClamSMTP 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 )