Re: [PATCH v6 4/4] powerpc: Book3S 64-bit "heavyweight" KASAN support

From: Daniel Axtens
Date: Wed Feb 12 2020 - 05:12:18 EST


Christophe Leroy <christophe.leroy@xxxxxx> writes:

> Le 12/02/2020 Ã 06:47, Daniel Axtens a ÃcritÂ:
>> diff --git a/arch/powerpc/include/asm/kasan.h b/arch/powerpc/include/asm/kasan.h
>> index fbff9ff9032e..2911fdd3a6a0 100644
>> --- a/arch/powerpc/include/asm/kasan.h
>> +++ b/arch/powerpc/include/asm/kasan.h
>> @@ -2,6 +2,8 @@
>> #ifndef __ASM_KASAN_H
>> #define __ASM_KASAN_H
>>
>> +#include <asm/page.h>
>> +
>> #ifdef CONFIG_KASAN
>> #define _GLOBAL_KASAN(fn) _GLOBAL(__##fn)
>> #define _GLOBAL_TOC_KASAN(fn) _GLOBAL_TOC(__##fn)
>> @@ -14,29 +16,41 @@
>>
>> #ifndef __ASSEMBLY__
>>
>> -#include <asm/page.h>
>> -
>> #define KASAN_SHADOW_SCALE_SHIFT 3
>>
>> #define KASAN_SHADOW_START (KASAN_SHADOW_OFFSET + \
>> (PAGE_OFFSET >> KASAN_SHADOW_SCALE_SHIFT))
>>
>> +#ifdef CONFIG_KASAN_SHADOW_OFFSET
>> #define KASAN_SHADOW_OFFSET ASM_CONST(CONFIG_KASAN_SHADOW_OFFSET)
>> +#endif
>>
>> +#ifdef CONFIG_PPC32
>> #define KASAN_SHADOW_END 0UL
>>
>> -#define KASAN_SHADOW_SIZE (KASAN_SHADOW_END - KASAN_SHADOW_START)
>> +#ifdef CONFIG_KASAN
>> +void kasan_late_init(void);
>> +#else
>> +static inline void kasan_late_init(void) { }
>> +#endif
>> +
>> +#endif
>> +
>> +#ifdef CONFIG_PPC_BOOK3S_64
>> +#define KASAN_SHADOW_END (KASAN_SHADOW_OFFSET + \
>> + (RADIX_VMEMMAP_END >> KASAN_SHADOW_SCALE_SHIFT))
>> +
>> +static inline void kasan_late_init(void) { }
>> +#endif
>>
>> #ifdef CONFIG_KASAN
>> void kasan_early_init(void);
>> void kasan_mmu_init(void);
>> void kasan_init(void);
>> -void kasan_late_init(void);
>> #else
>> static inline void kasan_init(void) { }
>> static inline void kasan_mmu_init(void) { }
>> -static inline void kasan_late_init(void) { }
>> #endif
>
> Why modify all this kasan_late_init() stuff ?
>
> This function is only called from kasan init_32.c, it is never called by
> PPC64, so you should not need to modify anything at all.

I got a compile error for a missing symbol. I'll repro it and attach it.

Regards,
Daniel

>
> Christophe