[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CACRpkdb73diprma9Z1-4nm5A9OTQMeGVK=Hcqiwny9VOVdA=QQ@mail.gmail.com>
Date: Sat, 9 Jan 2021 22:26:08 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Hailong liu <hailongliiu@...h.net>
Cc: Andrey Ryabinin <aryabinin@...tuozzo.com>,
Ziliang Guo <guo.ziliang@....com.cn>,
Hailong Liu <liu.hailong6@....com.cn>,
Russell King <linux@...linux.org.uk>,
kasan-dev <kasan-dev@...glegroups.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Linux Memory Management List <linux-mm@...ck.org>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] arm/kasan:fix the arry size of kasan_early_shadow_pte
On Sat, Jan 9, 2021 at 5:51 AM Hailong liu <hailongliiu@...h.net> wrote:
> From: Hailong Liu <liu.hailong6@....com.cn>
>
> The size of kasan_early_shadow_pte[] now is PTRS_PER_PTE which defined to
> 512 for arm architecture. This means that it only covers the prev Linux pte
> entries, but not the HWTABLE pte entries for arm.
>
> The reason it works well current is that the symbol kasan_early_shadow_page
> immediately following kasan_early_shadow_pte in memory is page aligned,
> which makes kasan_early_shadow_pte look like a 4KB size array. But we can't
> ensure the order always right with different compiler/linker, nor more bss
> symbols be introduced.
>
> We had a test with QEMU + vexpress:put a 512KB-size symbol with attribute
> __section(".bss..page_aligned") after kasan_early_shadow_pte, and poison it
> after kasan_early_init(). Then enabled CONFIG_KASAN, it failed to boot up.
>
> Signed-off-by: Hailong Liu <liu.hailong6@....com.cn>
> Signed-off-by: Ziliang Guo <guo.ziliang@....com.cn>
OK I see the problem, I think.
> +#ifndef PTE_HWTABLE_PTRS
> +#define PTE_HWTABLE_PTRS 0
> +#endif
Can this even happen? We have either pgtable-2level.h or
pgtable-3level.h, both of which define PTE_HWTABLE_PTRS.
> extern unsigned char kasan_early_shadow_page[PAGE_SIZE];
> -extern pte_t kasan_early_shadow_pte[PTRS_PER_PTE];
> +extern pte_t kasan_early_shadow_pte[PTRS_PER_PTE + PTE_HWTABLE_PTRS];
Yeah this looks exactly like bm_pte so it makes sense.
If you drop the first ifndef,
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
Yours,
Linus Walleij
Powered by blists - more mailing lists