[PATCH 4/5 v10] ARM: Initialize the mapping of KASan shadow memory

Linus Walleij linus.walleij at linaro.org
Mon Jun 29 10:07:06 EDT 2020


Asking for help here!

I have a problem with populating PTEs for the LPAE usecase using
Versatile Express Cortex A15 (TC1) in QEMU.

In this loop of the patch:

On Mon, Jun 15, 2020 at 11:05 AM Linus Walleij <linus.walleij at linaro.org> wrote:

> +static void __init kasan_pte_populate(pmd_t *pmdp, unsigned long addr,
> +                                     unsigned long end, int node, bool early)
> +{
> +       unsigned long next;
> +       pte_t *ptep = pte_offset_kernel(pmdp, addr);

(...)

> +       do {
> +               next = pmd_addr_end(addr, end);
> +               kasan_pte_populate(pmdp, addr, next, node, early);
> +       } while (pmdp++, addr = next, addr != end && pmd_none(READ_ONCE(*pmdp)));

I first populate the PMD for 0x6ee00000 .. 0x6f000000
and this works fine, and the PTEs are all initialized.
pte_offset_kernel() returns something reasonable.
(0x815F5000).

Next the kernel processes the PMD for
0x6f000000 .. 0x6f200000 and now I run into trouble,
because pte_offset_kernel() suddenly returns a NULL
pointer 0x00000000.

Naturally dereferencing the pointer when checking
if (pte_none(*ptep)) hangs the machine since this
is in early init.

Does anyone have hints on why this happens, and why it
only happens on LPAE? non-LPAE on the Versatile Express
QEMU A15 works fine.

I'm debugging, but any hints are very welcome.

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list