[PATCH v5 15/21] arm64: idreg-override: use early FDT mapping in ID map

Mark Rutland mark.rutland at arm.com
Wed Jul 13 07:09:06 PDT 2022


On Tue, Jul 12, 2022 at 07:03:56PM +0200, Ard Biesheuvel wrote:
> On Mon, 11 Jul 2022 at 17:39, Mark Rutland <mark.rutland at arm.com> wrote:
> >
> > Hi Ard,
> >
> > On Fri, Jun 24, 2022 at 05:06:45PM +0200, Ard Biesheuvel wrote:
> > > Instead of calling into the kernel to map the FDT into the kernel page
> > > tables before even calling start_kernel(), let's switch to the initial,
> > > temporary mapping of the device tree that has been added to the ID map.
> > >
> > > Signed-off-by: Ard Biesheuvel <ardb at kernel.org>
> >
> > Unfortunately, this patch breaks KASAN_INLINE=y, as the accesses to the idmap
> > alias of the FDT get a poison check, which faults, resulting in a panic()
> > before any of the command line is parsed.
> >
> > It's a bit painful to fix this; I had hoped it would be simple to fix by
> > adding:
> >
> >         KASAN_SANITIZE_idreg-override.o := n
> >
> > ... to arch/arm64/kernel/Makefile, but there are a bunch of calls to
> > out-of-line functions that end up being instrumented (e.g. strncpy() and some
> > fdt_*() functions), and it doesn't look like it'll be simple to go fix those.
> 
> Ugh. I suppose the KASAN projection produces invalid shadow addresses
> for the TTBR0 range, so there is no way we can map some zero shadow
> for the FDT?

Yup, exactly.

> > Can we revert this? IIUC this patch is an optimization rather being necessary
> > for later changes.
> 
> Indeed, let's revert this for now, along with the follow-up patch that
> removes the early FDT fixmap remap hack.

I'll send a patch shortly.

Thanks,
Mark.



More information about the linux-arm-kernel mailing list