From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2EC6C4167B for ; Mon, 27 Nov 2023 10:34:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Jda640Pg9DRftBzTWCkREJMioi/FGAwppzKDwxokOGc=; b=b/wO1IIXEntEiw +5vvie2FEBXX9OpirCXYTmtCUNKUK5M5ycduKV5lH/Z/VJ0MBy69hSmii8/D9mEgAY4KjmXOlz0bW Ft5pg1zhaKhBZLS6uH8II+KlRkDXYEDB+ki6phoeWyy3jewgJsaTajWqc4JXinm42K42w1SyYOtnY fnCpO86UoTNclJihVVEwPEy1YwZZxe7ynUVRVWaR8sCqXKuFdeN6QS8uoFl6DPbe7TD1x7E9qLPlU 6OkUUORmHYYwmk6qHQWDyIxO/wTY/mdLSby65BXrzwQL4n+hTFrvvnCz2W1ou1k95GeId4Nk1Hwp0 LjVi8ijjEEgYDZIPOEvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r7YwI-0026Lu-0E; Mon, 27 Nov 2023 10:34:06 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r7YwF-0026L3-2I for linux-arm-kernel@lists.infradead.org; Mon, 27 Nov 2023 10:34:04 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4DC0161129; Mon, 27 Nov 2023 10:34:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6249C433C7; Mon, 27 Nov 2023 10:34:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701081242; bh=/rkJpaB5NVVV3+tkPvl6JbdAXg/jSIdG4sK2vuVyJe4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=mVBxFdDIWk08yQGWIMPYUSsMChTtt6yENHyTZM5INd6UQ74uIPAfXPLEuPHhUOjOP vqK5M1MEBs3+o3UJA7U4oGcnaGzgK4bk1ohoLZUp3ZZ/nKSOOiDQyFUiSGkgZCXpas xXZX36ITg75UL3uD4LcmPzoZw19jQ6oo7eWJ7Xrqb0oIM13HZMpig1HKm1nryjzqFF PZYB3l8uZ5bGT9qqtUDXOKTZW6K+V1XiGi72a7P/TU/Km711lKEOaioa4nRyo/3VEd Zo0YHrjPUVip3bffYOir+gqjF3B1563/6BUIw1m3r3lA5kdpoNpf0ZzTmYzkxJzl6n dHu8BBeds38Sw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1r7YwB-00GkJ6-H6; Mon, 27 Nov 2023 10:33:59 +0000 Date: Mon, 27 Nov 2023 10:33:59 +0000 Message-ID: <86h6l7cwo8.wl-maz@kernel.org> From: Marc Zyngier To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, Ard Biesheuvel Subject: Re: [PATCH] arm64: Avoid enabling KPTI unnecessarily In-Reply-To: <20231127102141.2241123-2-ardb@google.com> References: <20231127102141.2241123-2-ardb@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: ardb@google.com, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, ardb@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231127_023403_786580_73DDE8DF X-CRM114-Status: GOOD ( 21.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 27 Nov 2023 10:21:42 +0000, Ard Biesheuvel wrote: > > From: Ard Biesheuvel > > Commit 42c5a3b04bf6 refactored the KPTI init code in a way that results > in the use of non-global kernel mappings even on systems that have no > need for it, and even when KPTI has been disabled explicitly via the > command line. > > Ensure that this only happens when we have decided (based on the > detected CPU features) that KPTI should be enabled. > > Fixes: 42c5a3b04bf6 ("arm64: Split kpti_install_ng_mappings()") > Signed-off-by: Ard Biesheuvel > --- > arch/arm64/kernel/cpufeature.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > index 646591c67e7a..4b1762b9c37c 100644 > --- a/arch/arm64/kernel/cpufeature.c > +++ b/arch/arm64/kernel/cpufeature.c > @@ -3352,7 +3352,8 @@ void __init setup_system_features(void) > */ > enable_cpu_capabilities(SCOPE_ALL & ~SCOPE_BOOT_CPU); > > - kpti_install_ng_mappings(); > + if (arm64_kernel_unmapped_at_el0()) > + kpti_install_ng_mappings(); > > sve_setup(); > sme_setup(); Reviewed-by: Marc Zyngier Tested-by: Marc Zyngier M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel