[BUG][PATCH v8 4/6] arm64: Make _midr_in_range_list() an exported function

Catalin Marinas catalin.marinas at arm.com
Tue Apr 15 08:54:58 PDT 2025


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 <ada.coupriediaz at arm.com> 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.

-- 
Catalin



More information about the linux-arm-kernel mailing list