From patchwork Tue Jun 7 16:06:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 69525 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2056586qgf; Tue, 7 Jun 2016 09:08:25 -0700 (PDT) X-Received: by 10.140.19.97 with SMTP id 88mr180266qgg.55.1465315691850; Tue, 07 Jun 2016 09:08:11 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id f34si15562370qtd.17.2016.06.07.09.08.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jun 2016 09:08:11 -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 1bAJWp-0002cL-9f; Tue, 07 Jun 2016 16:06:55 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bAJWo-0002a6-5R for xen-devel@lists.xen.org; Tue, 07 Jun 2016 16:06:54 +0000 Received: from [193.109.254.147] by server-8.bemta-14.messagelabs.com id 39/9A-08354-D11F6575; Tue, 07 Jun 2016 16:06:53 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRWlGSWpSXmKPExsVysyfVTVfmY1i 4walT+hZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8a+DQdYC9bzVUyefYCtgfEfVxcjF4eQwCZG iSuv9zFBOKcZJT7PnsDSxcjJwSagKXHn8ycmEFtEQFri2ufLjCA2s0Azo8TCA34gtrBAosSO3 79ZQWwWAVWJvZ0vwep5BVwk2pf+ZQexJQTkJE4emwxWwwkUb3vwiA3EFhJwllj6q4FxAiP3Ak aGVYwaxalFZalFuobGeklFmekZJbmJmTm6hoYmermpxcWJ6ak5iUnFesn5uZsYgR6uZ2Bg3MG 4a7vnIUZJDiYlUd7Pz8LChfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwFr4DygkWpaanVqRl5gBD DSYtwcGjJMKbBZLmLS5IzC3OTIdInWJUlBLn1QFJCIAkMkrz4Npg4X2JUVZKmJeRgYFBiKcgt Sg3swRV/hWjOAejkjCvGcgUnsy8Erjpr4AWMwEtXnYtGGRxSSJCSqqBsXbB5gl5HE9KNyTM3n xu8wqGi6/ezHHVu3Xy2fLUmfdYuS4IRU3efviXqPZRI6m1RWlvRU3uGOXyTJGf5lSZb398Z+K k+P6pBc27bPZL7Jn11UfPPfMYn0/sA2F1/73XXD9N2cVXmbW0zFHkX2J4VvvOfvHW7Pd802dk MoflHc7f32djPHN7jBJLcUaioRZzUXEiANrkVvhqAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1465315612!34151952!1 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 53736 invoked from network); 7 Jun 2016 16:06:52 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-14.tower-27.messagelabs.com with SMTP; 7 Jun 2016 16:06:52 -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 45E17434; Tue, 7 Jun 2016 09:07:26 -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 B793F3F21A; Tue, 7 Jun 2016 09:06:50 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 7 Jun 2016 17:06:22 +0100 Message-Id: <1465315583-1278-16-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465315583-1278-1-git-send-email-julien.grall@arm.com> References: <1465315583-1278-1-git-send-email-julien.grall@arm.com> Cc: andre.przywara@arm.com, Julien Grall , sstabellini@kernel.org, wei.chen@arm.com, steve.capper@arm.com Subject: [Xen-devel] [PATCH v3 15/16] 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 Acked-by: Stefano Stabellini --- 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 a4eedca..175033b 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2408,7 +2408,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); @@ -2420,7 +2420,6 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs, break; } -bad_insn_abort: inject_iabt_exception(regs, gva, hsr.len); } @@ -2450,7 +2449,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 )