xref: /openbmc/linux/arch/x86/include/asm/kasan.h (revision 4f3db074)
1 #ifndef _ASM_X86_KASAN_H
2 #define _ASM_X86_KASAN_H
3 
4 /*
5  * Compiler uses shadow offset assuming that addresses start
6  * from 0. Kernel addresses don't start from 0, so shadow
7  * for kernel really starts from compiler's shadow offset +
8  * 'kernel address space start' >> KASAN_SHADOW_SCALE_SHIFT
9  */
10 #define KASAN_SHADOW_START      (KASAN_SHADOW_OFFSET + \
11 					(0xffff800000000000ULL >> 3))
12 /* 47 bits for kernel address -> (47 - 3) bits for shadow */
13 #define KASAN_SHADOW_END        (KASAN_SHADOW_START + (1ULL << (47 - 3)))
14 
15 #ifndef __ASSEMBLY__
16 
17 extern pte_t kasan_zero_pte[];
18 extern pte_t kasan_zero_pmd[];
19 extern pte_t kasan_zero_pud[];
20 
21 #ifdef CONFIG_KASAN
22 void __init kasan_map_early_shadow(pgd_t *pgd);
23 void __init kasan_init(void);
24 #else
25 static inline void kasan_map_early_shadow(pgd_t *pgd) { }
26 static inline void kasan_init(void) { }
27 #endif
28 
29 #endif
30 
31 #endif
32