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

Linus Walleij linus.walleij at linaro.org
Tue Jun 30 09:22:19 EDT 2020


Hi Mike!

First a BIG THANKS for your help! With the aid of your review comments
and the further comments from Russell I have really progressed with this
patch set the last few days.

On Mon, Jun 15, 2020 at 4:33 PM Mike Rapoport <rppt at linux.ibm.com> wrote:

> > -#define pud_populate(mm,pmd,pte)     BUG()
> > -
> > +#ifndef CONFIG_KASAN
> > +#define pud_populate(mm, pmd, pte)   BUG()
> > +#else
> > +#define pud_populate(mm, pmd, pte)   do { } while (0)
>
> Hmm, is this really necessary? Regardless of CONFIG_KASAN pud_populate()
> should never be called for non-LPAE case...

It is necessary because the generic KASan code in
mm/kasan/init.c unconditionally calls pud_populate() and act as
if pud's always exist and need to be populated.

Possibly this means that pud_populate() should just be turned
into do { } while (0) as well (like other functions called unconditionally
from the VMM) but I'll leave this in for now.

>         cpu_switch_mm(tmp_pgd_table, &init_mm);
>
> And, why do we need a context switch here at all?

This is really just a way of reusing that function call to replace
the master page table pointer TTBR0 (Translation Table Base Register)
while setting up the shadow memory.

Yours,
Linus Walleij



More information about the linux-arm-kernel mailing list