1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __ASM_KASAN_H 3 #define __ASM_KASAN_H 4 5 #ifdef CONFIG_KASAN 6 #define _GLOBAL_KASAN(fn) _GLOBAL(__##fn) 7 #define _GLOBAL_TOC_KASAN(fn) _GLOBAL_TOC(__##fn) 8 #define EXPORT_SYMBOL_KASAN(fn) EXPORT_SYMBOL(__##fn) 9 #else 10 #define _GLOBAL_KASAN(fn) _GLOBAL(fn) 11 #define _GLOBAL_TOC_KASAN(fn) _GLOBAL_TOC(fn) 12 #define EXPORT_SYMBOL_KASAN(fn) 13 #endif 14 15 #ifndef __ASSEMBLY__ 16 17 #include <asm/page.h> 18 19 #define KASAN_SHADOW_SCALE_SHIFT 3 20 21 #define KASAN_SHADOW_START (KASAN_SHADOW_OFFSET + \ 22 (PAGE_OFFSET >> KASAN_SHADOW_SCALE_SHIFT)) 23 24 #define KASAN_SHADOW_OFFSET ASM_CONST(CONFIG_KASAN_SHADOW_OFFSET) 25 26 #define KASAN_SHADOW_END (-(-KASAN_SHADOW_START >> KASAN_SHADOW_SCALE_SHIFT)) 27 28 #ifdef CONFIG_KASAN 29 void kasan_early_init(void); 30 void kasan_mmu_init(void); 31 void kasan_init(void); 32 void kasan_late_init(void); 33 #else 34 static inline void kasan_init(void) { } 35 static inline void kasan_mmu_init(void) { } 36 static inline void kasan_late_init(void) { } 37 #endif 38 39 void kasan_update_early_region(unsigned long k_start, unsigned long k_end, pte_t pte); 40 int kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_end); 41 int kasan_init_region(void *start, size_t size); 42 43 #endif /* __ASSEMBLY */ 44 #endif 45