1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __ASM_UM_KASAN_H 3 #define __ASM_UM_KASAN_H 4 5 #include <linux/init.h> 6 #include <linux/const.h> 7 8 #define KASAN_SHADOW_OFFSET _AC(CONFIG_KASAN_SHADOW_OFFSET, UL) 9 10 /* used in kasan_mem_to_shadow to divide by 8 */ 11 #define KASAN_SHADOW_SCALE_SHIFT 3 12 13 #ifdef CONFIG_X86_64 14 #define KASAN_HOST_USER_SPACE_END_ADDR 0x00007fffffffffffUL 15 /* KASAN_SHADOW_SIZE is the size of total address space divided by 8 */ 16 #define KASAN_SHADOW_SIZE ((KASAN_HOST_USER_SPACE_END_ADDR + 1) >> \ 17 KASAN_SHADOW_SCALE_SHIFT) 18 #else 19 #error "KASAN_SHADOW_SIZE is not defined for this sub-architecture" 20 #endif /* CONFIG_X86_64 */ 21 22 #define KASAN_SHADOW_START (KASAN_SHADOW_OFFSET) 23 #define KASAN_SHADOW_END (KASAN_SHADOW_START + KASAN_SHADOW_SIZE) 24 25 #ifdef CONFIG_KASAN 26 void kasan_init(void); 27 extern int kasan_um_is_ready; 28 29 #ifdef CONFIG_STATIC_LINK 30 #define kasan_arch_is_ready() (kasan_um_is_ready) 31 #endif 32 #else kasan_init(void)33static inline void kasan_init(void) { } 34 #endif /* CONFIG_KASAN */ 35 36 #endif /* __ASM_UM_KASAN_H */ 37