Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6259187imu; Mon, 21 Jan 2019 06:00:58 -0800 (PST) X-Google-Smtp-Source: ALg8bN5rGebIXRaier3Wyt77SeaLMgMmvflaZ9tAx/7K2MYaMn+jJ+Gd9EFjuP73X5MqQ3P6+vq8 X-Received: by 2002:a17:902:a58a:: with SMTP id az10mr30802831plb.10.1548079258395; Mon, 21 Jan 2019 06:00:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548079258; cv=none; d=google.com; s=arc-20160816; b=n/c9Gn7woOYNOUCsmEnVfuwR4n0hI0iP3M/zpN0CZsYZoMZlXOp/29QaBJoy5uDe9Y 7I4cy/n8uvCLnMLzPBnd5W7k/1qNqNOOWsQffD6Z/xd6asY5+Wr9/Rg+P0d5ZMJLbCY1 3oawO+RNZKoj4acZuQ3a0QpMarXbPTLzXTsBVWti1mlpWhADdAV9AVr7ud3DEViKOuLY abIUrnKQ+FofsbIQfiKxYloA7r/CxGTdsMp+MADadCvefhvqpyaikyx69+7yTJCsSTR6 6ZjqszktwiLtzjVR83QF8LM4uz88cON5w8+gAkE3XCVT9ePs7MBrD23+wNHR/PWPr7zw nNRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EKTo3AD9YmQW8clfC5eU+SG3oV4TGe/LMAUq0yNJNPs=; b=RNKv64Bw8BoodlXZCbb7G8qrveulGzvgNTuXWq0Ai2zJwYCt3Li2hsq0VEZFT/ERx5 fgq8EmfL2Vd4olVdpeLb4oJIoOhpfG3zMDFN7yJZBfrCjDmu1i6zZHR0dT1PsePNem3k aRQnA1uNvhMA/OUqS3VsBw4o4O3ZEuC+zyFbldblWtgtBdgNx152hyTnWbtDdK44B4QO QK9RnMOtQwZePwDnFYtkdsr4ydeiiP8YjhlO1T+4HkO4s9LWZSCA+YivdxlH6eocUYqa qF4RBw8DzX6gk567KCj4j1auscIBr8H/7nI+F8OQkUT08YFh8TJVXYDSaeb8yVVDKA7o oJvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="pxqdjW/t"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g184si6596921pfb.288.2019.01.21.06.00.42; Mon, 21 Jan 2019 06:00:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="pxqdjW/t"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731737AbfAUN6v (ORCPT + 99 others); Mon, 21 Jan 2019 08:58:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:44528 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731588AbfAUN6t (ORCPT ); Mon, 21 Jan 2019 08:58:49 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3B98420879; Mon, 21 Jan 2019 13:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548079128; bh=GJDIiy22ilWUqSxOANVreEeVQ83Dfll38upW8Fg2aOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pxqdjW/tVwcNRqYBlv8rJ21y/pN1w9MEEVA81ib8oxPnZgrwij9S2av44kj6ivnDX km5mmXPHmk6jWKSV/1YO2viOsSo2SOUGrP6X8xZpwmaiTeeitqqLovPQp6BjUdiPt+ KmsyQvqGHpyANcOzshsCtHto0NJdaK6Qqv985Um0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Henderson , Mark Rutland , Kristina Martsenko , Christoffer Dall , Catalin Marinas , Marc Zyngier , Will Deacon , kvmarm@lists.cs.columbia.edu, Sasha Levin Subject: [PATCH 4.19 19/99] arm64: Dont trap host pointer auth use to EL2 Date: Mon, 21 Jan 2019 14:48:11 +0100 Message-Id: <20190121134914.646580377@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190121134913.924726465@linuxfoundation.org> References: <20190121134913.924726465@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit b3669b1e1c09890d61109a1a8ece2c5b66804714 ] To allow EL0 (and/or EL1) to use pointer authentication functionality, we must ensure that pointer authentication instructions and accesses to pointer authentication keys are not trapped to EL2. This patch ensures that HCR_EL2 is configured appropriately when the kernel is booted at EL2. For non-VHE kernels we set HCR_EL2.{API,APK}, ensuring that EL1 can access keys and permit EL0 use of instructions. For VHE kernels host EL0 (TGE && E2H) is unaffected by these settings, and it doesn't matter how we configure HCR_EL2.{API,APK}, so we don't bother setting them. This does not enable support for KVM guests, since KVM manages HCR_EL2 itself when running VMs. Reviewed-by: Richard Henderson Signed-off-by: Mark Rutland Signed-off-by: Kristina Martsenko Acked-by: Christoffer Dall Cc: Catalin Marinas Cc: Marc Zyngier Cc: Will Deacon Cc: kvmarm@lists.cs.columbia.edu Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/include/asm/kvm_arm.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h index 2297284e33f2..8b284cbf8162 100644 --- a/arch/arm64/include/asm/kvm_arm.h +++ b/arch/arm64/include/asm/kvm_arm.h @@ -24,6 +24,8 @@ /* Hyp Configuration Register (HCR) bits */ #define HCR_FWB (UL(1) << 46) +#define HCR_API (UL(1) << 41) +#define HCR_APK (UL(1) << 40) #define HCR_TEA (UL(1) << 37) #define HCR_TERR (UL(1) << 36) #define HCR_TLOR (UL(1) << 35) @@ -87,7 +89,7 @@ HCR_AMO | HCR_SWIO | HCR_TIDCP | HCR_RW | HCR_TLOR | \ HCR_FMO | HCR_IMO) #define HCR_VIRT_EXCP_MASK (HCR_VSE | HCR_VI | HCR_VF) -#define HCR_HOST_NVHE_FLAGS (HCR_RW) +#define HCR_HOST_NVHE_FLAGS (HCR_RW | HCR_API | HCR_APK) #define HCR_HOST_VHE_FLAGS (HCR_RW | HCR_TGE | HCR_E2H) /* TCR_EL2 Registers bits */ -- 2.19.1