1 #ifndef __ASM_KASAN_H 2 #define __ASM_KASAN_H 3 4 #ifndef __ASSEMBLY__ 5 6 #ifdef CONFIG_KASAN 7 8 #include <linux/linkage.h> 9 #include <asm/memory.h> 10 #include <asm/pgtable-types.h> 11 12 /* 13 * KASAN_SHADOW_START: beginning of the kernel virtual addresses. 14 * KASAN_SHADOW_END: KASAN_SHADOW_START + 1/8 of kernel virtual addresses. 15 */ 16 #define KASAN_SHADOW_START (VA_START) 17 #define KASAN_SHADOW_END (KASAN_SHADOW_START + KASAN_SHADOW_SIZE) 18 19 /* 20 * This value is used to map an address to the corresponding shadow 21 * address by the following formula: 22 * shadow_addr = (address >> 3) + KASAN_SHADOW_OFFSET; 23 * 24 * (1 << 61) shadow addresses - [KASAN_SHADOW_OFFSET,KASAN_SHADOW_END] 25 * cover all 64-bits of virtual addresses. So KASAN_SHADOW_OFFSET 26 * should satisfy the following equation: 27 * KASAN_SHADOW_OFFSET = KASAN_SHADOW_END - (1ULL << 61) 28 */ 29 #define KASAN_SHADOW_OFFSET (KASAN_SHADOW_END - (1ULL << (64 - 3))) 30 31 void kasan_init(void); 32 void kasan_copy_shadow(pgd_t *pgdir); 33 asmlinkage void kasan_early_init(void); 34 35 #else 36 static inline void kasan_init(void) { } 37 static inline void kasan_copy_shadow(pgd_t *pgdir) { } 38 #endif 39 40 #endif 41 #endif 42