From patchwork Fri May 5 14:30:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 98643 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp154775qge; Fri, 5 May 2017 07:32:39 -0700 (PDT) X-Received: by 10.107.175.78 with SMTP id y75mr51163902ioe.87.1493994750454; Fri, 05 May 2017 07:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1493994750; cv=none; d=google.com; s=arc-20160816; b=PGhywjLX5c9D4jakunnP/Ugv8xKfX0kPvf4AqnpKqOx1GQKXPrbxfpnFfFljKGlKNC M3kEmwzQdJpMX0ZUE2M3/v8Rsbxz2Jvl30F40d/fUhTCdJc4kwp6DYQwq9w1IPf7socD XUPJ1HcVC+LK81mUtAoyS3XxWFNFKlQmFNncd3iBwtTe4YXoqZE8OXqYBCa801MB2Tn1 4Xw3uVPXe0ZgAYg9/nlK7+dQlcohI0SSJYmBPLHBA4aBa4HJ+bZgbSIMDtfU+6jjwojR awebYV4nHMU5eipnrbzRtLYxr54w2x+8BG3ITyMM7Sh7NJrgvSwz+nuKREOh6s6iAJoo +ZLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=l8nw0T1nCaIBODLPvfh54w8oNhd0H+Ue3r3+OfyUNwc=; b=c4XPkshC5GDTRcCFtVBUcPgVFa6VIJ4mo24GYSTl6KvGJ+XMQX7bY4xLkOQFNrlpfd wBD4OOz2APC/Fn+RSrJccqAgUGW6VNucRUxZa11jbtfoJTjHXHWvNLqnqUGacfFb1Zmq GwHgCh+d/2C6hCvG7pJC5rdfiDXOwCOpjHlILVUUxsmyi9CkQ4p5S4l9W71k3ZMRl+HT R+q3IAd5SMe0FjOJ0NsJWwt54dsxjBTzP03MjxyIQD1VaYVqWeq5lfAoHA81IAlTSCsp +ij8yDNLAD1CY9bdSxW0w2ZCQ2sPK328Hi66N5eNrj6x856fLMY7RT7rxif2Fd7bn50A J2sw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id z16si28824465ioz.131.2017.05.05.07.32.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 May 2017 07:32:30 -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 1d6eFr-0006rz-Mg; Fri, 05 May 2017 14:30:47 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d6eFq-0006pl-Dc for xen-devel@lists.xen.org; Fri, 05 May 2017 14:30:46 +0000 Received: from [85.158.137.68] by server-17.bemta-3.messagelabs.com id 5F/0A-01868-59C8C095; Fri, 05 May 2017 14:30:45 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrILMWRWlGSWpSXmKPExsVysyfVTXdqD0+ kwZJTAhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bFplOsBe/5Kvb0NTA1MPbwdDFycggJbGKU uL27touRC8g+zSjR1DSJDSTBJqApcefzJyYQW0RAWuLa58uMIDazQJrEshWvwWxhASeJ6ztaw WpYBFQlVq08DWbzClhKLHk3FWyOhIC8xK62i6wgNqeAlcSZ//uYIRZbSsxZ3sU+gZF7ASPDKk b14tSistQiXWO9pKLM9IyS3MTMHF1DA2O93NTi4sT01JzEpGK95PzcTYxA7zIAwQ7G5i9Ohxg lOZiURHnTRHkihfiS8lMqMxKLM+KLSnNSiw8xynBwKEnwXusGygkWpaanVqRl5gDDDCYtwcGj JML7uwsozVtckJhbnJkOkTrFqMvxbumH90xCLHn5ealS4rzrQGYIgBRllObBjYCF/CVGWSlhX kago4R4ClKLcjNLUOVfMYpzMCoJ8waATOHJzCuB2/QK6AgmoCOiRcGOKElESEk1MIophC67Ev BI4+jVHZG5DoEv19rm3W7mTd6huITPir9EWXVf55t/LEvlFAXFJZfMj9UU2Me+SPFqmvfxIPM ablv2ny7mQlENezcerVKP65wyddNUPvb5vIuWd1vtVFh7J8fT9fCMyRVr3IzbZpzfx88t+e2L RVKivoT3hcmbfJdebi29r1dUqcRSnJFoqMVcVJwIALY8iYx0AgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1493994644!99056222!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32645 invoked from network); 5 May 2017 14:30:45 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-8.tower-31.messagelabs.com with SMTP; 5 May 2017 14:30:45 -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 78FD4344; Fri, 5 May 2017 07:30:44 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B5DC53F3E1; Fri, 5 May 2017 07:30:43 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 5 May 2017 15:30:36 +0100 Message-Id: <20170505143036.27405-4-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170505143036.27405-1-julien.grall@arm.com> References: <20170505143036.27405-1-julien.grall@arm.com> Cc: Mark Rutland , Julien Grall , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v2 3/3] xen/arm: Survive unknown traps from guests 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" Currently we crash Xen if we see an ESR_EL2.EC value we don't recognise. As configurable disables/enables are added to the architecture (controlled by RES1/RESO bits respectively), with associated synchronous exceptions, it may be possible for a guest to trigger exceptions with classes that we don't recognise. While we can't service these exceptions in a manner useful to the guest, we can avoid bringing down the host. Per ARM DDI 0487A.k_iss10775, page D7-1937, EC values within the range 0x00 - 0x2c are reserved for future use with synchronous exceptions, and EC within the range 0x2d - 0x3f may be used for either synchronous or asynchronous exceptions. The patch makes Xen handle any unknown EC by injecting an UNDEFINED exception into the guest, with a corresponding (ratelimited) warning in the log. This patch is based on Linux commit f050fe7a9164 "arm: KVM: Survive unknown traps from the guest". Signed-off-by: Julien Grall Acked-by: Mark Rutland Reviewed-by: Stefano Stabellini --- Changes in v2: - Add Stefano's reviewed-by --- xen/arch/arm/traps.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 645812210d..6cf9ee7244 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2926,9 +2926,10 @@ asmlinkage void do_trap_guest_sync(struct cpu_user_regs *regs) break; default: - printk("Unknown Guest Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=0x%"PRIx32"\n", - hsr.bits, hsr.ec, hsr.len, hsr.iss); - do_unexpected_trap("Guest", regs); + gprintk(XENLOG_WARNING, + "Unknown Guest Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=0x%"PRIx32"\n", + hsr.bits, hsr.ec, hsr.len, hsr.iss); + inject_undef_exception(regs, hsr); } }