Re: [PATCH v2 1/2] arm: kasan: support CONFIG_KASAN_VMALLOC

From: Linus Walleij
Date: Sat Feb 12 2022 - 16:26:48 EST


Hi Lecopzer,

thanks for working on this! I need this support too.

On Sat, Feb 12, 2022 at 8:47 AM Lecopzer Chen
<lecopzer.chen@xxxxxxxxxxxx> wrote:

> Simply make shadow of vmalloc area mapped on demand.
>
> This can fix ARM_MODULE_PLTS with KASAN and provide first step
> to support CONFIG_VMAP_STACK in ARM.
>
> Signed-off-by: Lecopzer Chen <lecopzer.chen@xxxxxxxxxxxx>

(...)

> - kasan_populate_early_shadow(kasan_mem_to_shadow((void *)VMALLOC_START),
> + if (!IS_ENABLED(CONFIG_KASAN_VMALLOC))
> + kasan_populate_early_shadow(kasan_mem_to_shadow((void *)VMALLOC_START),
> + kasan_mem_to_shadow((void *)VMALLOC_END));
> +
> + kasan_populate_early_shadow(kasan_mem_to_shadow((void *)VMALLOC_END),
> kasan_mem_to_shadow((void *)-1UL) + 1);

Where is this actually mapped?

Can you print out where
kasan_mem_to_shadow((void *)VMALLOC_START)
kasan_mem_to_shadow((void *)VMALLOC_END)
as well as KASAN_SHADOW_START and KASAN_SHADOW_END
points?

When I looked into this getting the shadow memory between
KASAN_SHADOW_START and KASAN_SHADOW_END
seemed like the big problem since this is static, so how is Kasan
solving this now?

Please patch the picture in
include/asm/kasan_def.h
and the info in
Documentation/arm/memory.rst
so it clearly reflects where VMALLOC is shadowed.

Yours,
Linus Walleij