Re: [PATCHv7 03/19] x86/kasan: Use the same shadow offset for 4- and 5-level paging

From: Ingo Molnar
Date: Thu Sep 28 2017 - 04:15:25 EST



* Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> wrote:

> We are going to support boot-time switching between 4- and 5-level
> paging. For KASAN it means we cannot have different KASAN_SHADOW_OFFSET
> for different paging modes: the constant is passed to gcc to generate
> code and cannot be changed at runtime.
>
> This patch changes KASAN code to use 0xdffffc0000000000 as shadow offset
> for both 4- and 5-level paging.
>
> For 5-level paging it means that shadow memory region is not aligned to
> PGD boundary anymore and we have to handle unaligned parts of the region
> properly.
>
> In addition, we have to exclude paravirt code from KASAN instrumentation
> as we now use set_pgd() before KASAN is fully ready.
>
> Signed-off-by: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>
> [kirill.shutemov@xxxxxxxxxxxxxxx: clenaup, changelog message]
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>

Bad SOB chain. If Andrey the true author of this patch then it be reflected in a
"From:" line.

> ---
> arch/x86/Kconfig | 1 -
> arch/x86/kernel/Makefile | 3 +-
> arch/x86/mm/kasan_init_64.c | 86 ++++++++++++++++++++++++++++++++++-----------
> 3 files changed, 67 insertions(+), 23 deletions(-)

This is a lot of complex code added with exactly zero lines of comments that
explains all the complexity ...

Thanks,

Ingo