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 DC5A9C369AB for ; Tue, 15 Apr 2025 17:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: MIME-Version:References:In-Reply-To:Subject:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1EfRfRqZty/phg79wR/+NBJcpg8BeMm7F0L+7mvixTY=; b=5AQQGHAWBWrYAPCNSH9JvfxVmG 5IlHl1RBI5KRwbG4h3nJuyHM4TajTeEkpLAuo8DH8nQwyqfgZOs2jWa+GLlZR7P52fCEYaS7VMUKH ds+/+Yo8Xc9yE/rSILXVZLigZdGZhZ6kZqrlCBL64J1d5GxvIlMSuwjrlW96GAckZ+L0pnmIsRWzo p7LtKaeGRMfNfCCw0etTZlE/PBNSkrQj6pEaZahr9avpXIW4V9b5fCkQy4qeMsWTR/uCc0wUYj40Z 1PM7S8CiSD+9Su5H2rpSApVX4+UN/qxhzvZvqswdlXauWerR7GNmQWB7bYYIbgmNhqWBoxC1HJaqB rDZ0ByxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1u4jnq-00000006WN1-1Bo6; Tue, 15 Apr 2025 17:10:30 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1u4jRn-00000006Sf8-1zt7 for linux-arm-kernel@lists.infradead.org; Tue, 15 Apr 2025 16:47:45 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 5208FA4A4B5; Tue, 15 Apr 2025 16:42:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5216AC4CEEB; Tue, 15 Apr 2025 16:47:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1744735662; bh=JYZJzr7x+Atlm+fxY93DHOqC1gun/3AWa+eqzCQCrVc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FBCkaEqJjhqXWmSH+6Fp9cIhLQgWDGLX/1L+PLdWUmgkojwyMzb+Njwm8C7xSpsYj 1O0BA6ypfhrXTXOjf2gWXZAWJjtNxiswOtfJiK3ArbPjlBqPNogbqc5h5x1wJBue7w 9qX4V+xoanLsf5v02Sni+QuszVVpXNESmlXPj9eIg2go9na8tcOY/G7mHDY6H6OdX7 Uq9WMQgTtL2Uo+eLg25e0C78qT/yRQg3oqUVvfDwOBJvKDdew7CmKCa1MkjMOTqJbI diPMiWOMkGj2GyjwNzs225eyntShpooAw/4A2DzLQIVeL0sUeRLajpGuKo6r7r2uDE 7V8ksA7be1e9w== 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 1u4jRk-005kZx-3z; Tue, 15 Apr 2025 17:47:40 +0100 Date: Tue, 15 Apr 2025 17:47:39 +0100 Message-ID: <864iypl6c4.wl-maz@kernel.org> From: Marc Zyngier To: Catalin Marinas Subject: Re: [BUG][PATCH v8 4/6] arm64: Make _midr_in_range_list() an exported function In-Reply-To: References: <20250221140229.12588-1-shameerali.kolothum.thodi@huawei.com> <20250221140229.12588-5-shameerali.kolothum.thodi@huawei.com> <3d97e45a-23cf-419b-9b6f-140b4d88de7b@arm.com> <865xj5la2q.wl-maz@kernel.org> 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.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: catalin.marinas@arm.com, ada.coupriediaz@arm.com, shameerali.kolothum.thodi@huawei.com, kvmarm@lists.linux.dev, oliver.upton@linux.dev, will@kernel.org, mark.rutland@arm.com, cohuck@redhat.com, eric.auger@redhat.com, sebott@redhat.com, yuzenghui@huawei.com, wangzhou1@hisilicon.com, jiangkunkun@huawei.com, jonathan.cameron@huawei.com, anthony.jebson@huawei.com, linux-arm-kernel@lists.infradead.org, linuxarm@huawei.com 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-20250415_094743_640420_9CC92295 X-CRM114-Status: GOOD ( 32.43 ) 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: , Cc: mark.rutland@arm.com, jiangkunkun@huawei.com, eric.auger@redhat.com, cohuck@redhat.com, linuxarm@huawei.com, oliver.upton@linux.dev, yuzenghui@huawei.com, wangzhou1@hisilicon.com, Shameer Kolothum , jonathan.cameron@huawei.com, kvmarm@lists.linux.dev, sebott@redhat.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, anthony.jebson@huawei.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 15 Apr 2025 16:54:58 +0100, Catalin Marinas wrote: > > On Tue, Apr 15, 2025 at 04:26:53PM +0100, Marc Zyngier wrote: > > On Tue, 15 Apr 2025 11:57:50 +0100, > > Ada Couprie Diaz wrote: > > > I discovered that this patch breaks boot for some CPUs when building > > > the default defconfig plus KASAN. This is still the case in v6.15-rc1 > > > and rc2. > > > > > > This patch marks `is_midr_in_range_list` as position independent but > > > it isn't, breaking early boot when instrumented with KASAN and > > > `CONFIG_RANDOMIZE_BASE` enabled. > > > > > > The breaking usage seems to be in `kaslr_requires_kpti()` called in > > > `early_map_kernel()`. > > > My testing on an AMD Seattle board does crash, but newer machines > > > implementing E0PD do not crash as they do not need to check MIDRs in > > > `kaslr_requires_kpti()`. > > > `is_mdr_in_range_list` did work in PI code previously because it was > > > `inline`, which this patch changes. > > > > OK, this is much more of a pain than I thought. > > > > I tried bringing the various helpers into the PI section, but it ended > > up being extremely ugly. > > > > More importantly, this is something that is pretty much at odds with > > the whole idea of the MIDR override -- it happens way earlier than we > > can populate the table. > > > > The thing is, the only reason we need to do this is that we need to > > support the Cavium SEFAC (Sorry Excuse For A Computer) that cannot run > > with KPTI. > > > > I can restore harmony with the following hack. But maybe we should > > just prune TX from the kernel and be done with this contraption. > > That works for me. Well, we can still keep it around but panic on boot > if kpti is enabled on this platform. Just don't bother checking it via > early_map_kernel() from the PI code. early_map_kernel() immediately builds nG page tables, and that's a strong guarantee to catch fire on this machine. Which means that distro kernels (which all have KPTI enabled by default) would explode. The only way to avoid it would be to mandate that users of these machines have nokaslr on the command-line. I'm happy to do so on my box, but I'm hardly representative of arm64 users... M. -- Without deviation from the norm, progress is not possible.