From patchwork Wed Jul 27 16:37:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 72898 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp410087qga; Wed, 27 Jul 2016 09:40:00 -0700 (PDT) X-Received: by 10.36.60.215 with SMTP id m206mr35004517ita.95.1469637600736; Wed, 27 Jul 2016 09:40:00 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id k90si8187581ioi.0.2016.07.27.09.40.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jul 2016 09:40:00 -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 1bSRpn-0001RJ-Q6; Wed, 27 Jul 2016 16:37:27 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bSRpm-0001O2-Bh for xen-devel@lists.xen.org; Wed, 27 Jul 2016 16:37:26 +0000 Received: from [85.158.139.211] by server-3.bemta-5.messagelabs.com id 1E/F0-12946-543E8975; Wed, 27 Jul 2016 16:37:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrKLMWRWlGSWpSXmKPExsVysyfVTdf18Yx wg66FghZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bi7avYCv7xVfx+Z9vAuJ27i5GLQ0hgI6PE mktn2LsYOYGc04wSP29ygdhsApoSdz5/YgKxRQSkJa59vswIYjMLREo8mXmDGcQWFoiXeN+8A yzOIqAq8ffnUTYQm1fAWWL5p7esILaEgJzEyWOTwWxOAReJH5N+sUHscpb4tu8x8wRG7gWMDK sYNYpTi8pSi3QNTfWSijLTM0pyEzNzdA0NTPVyU4uLE9NTcxKTivWS83M3MQK9ywAEOxgbtns eYpTkYFIS5V3kOCNciC8pP6UyI7E4I76oNCe1+BCjDAeHkgTv54dAOcGi1PTUirTMHGCYwaQl OHiURHhXgKR5iwsSc4sz0yFSpxgVpcR5a0ESAiCJjNI8uDZYaF9ilJUS5mUEOkSIpyC1KDezB FX+FaM4B6OSMO99kCk8mXklcNNfAS1mAlpcHAu2uCQRISXVwNgZvSj0buLcZ6HfOjnFewJm2I vunDCfZ451kdSeGKkXd6rkxQscfomlpDFbTJzp05b/dBNjkND/X22/A59w5LsoTWIo7yjf1H2 U4Yu9cYHfAzceVaGlfxwTLgZ9aG2JLmzz2ca6f3fDbzUZI7kZq6bF8lz+mrvPY0ezJW/wQ6b2 5ZL7O7Z9VmIpzkg01GIuKk4EAGgFDptoAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-6.tower-206.messagelabs.com!1469637444!51405658!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.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 49598 invoked from network); 27 Jul 2016 16:37:25 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-6.tower-206.messagelabs.com with SMTP; 27 Jul 2016 16:37:25 -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 DEF682F; Wed, 27 Jul 2016 09:38:40 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.218.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BA1763F25F; Wed, 27 Jul 2016 09:37:23 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 27 Jul 2016 17:37:11 +0100 Message-Id: <1469637431-1069-8-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469637431-1069-1-git-send-email-julien.grall@arm.com> References: <1469637431-1069-1-git-send-email-julien.grall@arm.com> Cc: Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v6 7/7] 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 2482a20..2d05936 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2412,7 +2412,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); @@ -2424,7 +2424,6 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs, break; } -bad_insn_abort: inject_iabt_exception(regs, gva, hsr.len); } @@ -2448,7 +2447,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 )