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 283ABC4167B for ; Mon, 27 Nov 2023 15:48:58 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZTfmLr5Kwjs6hpXYUbQAzLniGOm9l4zdcbUyq1Rcew0=; b=nBt98BL9MP4WjA 1jJkKKHE0P1DFKfFoYFOpHRNp64xDrpCqWDSuyVit8bJ4zU4nsSIMyh3nFoul7mx2gbyNnzcQhcmU PJ6m3KM80BTa0Sx61tB/lsSCQairj73xC5ewtFHRabA0JmvKNL/6SyIquse6rRvzpobdq0I5nHFxX phma/83us2ghcRJeGY9a1HIfPsnqndjjmOrhDwMyaBFl7MSVDR+m+30kp6f4376aWH5u/5M5sMcJm LucJWrRnLpqtovWiFMhLNKKC4IZN3/IikMZ3Pwn+LtYj+rYzKpCT+3TDhF3X01XPXsp40DnTpRA9X vR/trpnZ1JF0jfXQcwig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r7dqY-002rok-2e; Mon, 27 Nov 2023 15:48:30 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r7dqW-002rnU-0D for linux-arm-kernel@lists.infradead.org; Mon, 27 Nov 2023 15:48:29 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 4C5D3CE1384; Mon, 27 Nov 2023 15:48:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 932E0C433C9; Mon, 27 Nov 2023 15:48:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701100103; bh=7/TsOMz5CFzKhM9Kjh1ZTrGDf4pDV5l9olKS6NJ9JWk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oyYYcXRkX+eJtm37zJnVJhcrzAP7gYgsOmWFFJEm1HDsRyhHFl91t5JkOa/+eoDCA /0BgXMP0Xx1H1uDudxlXO8QPlXEhZl+ki7lIEpzbhcdWYnu8EWF1ZrPYDtQbL+K29S NehLsEKnx+uh1JwsOOK/kyzscD0aJHag4P0zR5jNbfuwOJ0Jv4nm2eaM8NE2W8U4NM 6dayx69jAZ/yOaAgvLitMse2CLTCk87wHUsHhnWri1cR1NXpoWPNvmzGiCe1OBefi0 GNz09LFj5hAhqBdhe7FVzes1OKqYAQTQUE9rUZUz4+liDewSycugxp52klf1+nX9Ef t7UDQ0W/QMOjQ== Date: Mon, 27 Nov 2023 15:48:18 +0000 From: Will Deacon To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Catalin Marinas , Marc Zyngier , Mark Rutland Subject: Re: [PATCH v2 1/3] arm64: Avoid enabling KPTI unnecessarily Message-ID: <20231127154818.GA8453@willie-the-truck> References: <20231127120049.2258650-5-ardb@google.com> <20231127120049.2258650-6-ardb@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231127120049.2258650-6-ardb@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231127_074828_355005_99D4302F X-CRM114-Status: GOOD ( 20.16 ) 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, Nov 27, 2023 at 01:00:51PM +0100, 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 system-wide 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 | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > index 646591c67e7a..91d2d6714969 100644 > --- a/arch/arm64/kernel/cpufeature.c > +++ b/arch/arm64/kernel/cpufeature.c > @@ -1839,6 +1839,10 @@ static int __init __kpti_install_ng_mappings(void *__unused) > > static void __init kpti_install_ng_mappings(void) > { > + /* Check whether KPTI is going to be used */ > + if (!cpus_have_cap(ARM64_UNMAP_KERNEL_AT_EL0)) > + return; Why can't you use arm64_kernel_unmapped_at_el0() here? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel