[BUG][PATCH v8 4/6] arm64: Make _midr_in_range_list() an exported function
Marc Zyngier
maz at kernel.org
Tue Apr 15 09:47:39 PDT 2025
On Tue, 15 Apr 2025 16:54:58 +0100,
Catalin Marinas <catalin.marinas at arm.com> 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 <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.
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.
More information about the linux-arm-kernel
mailing list