2019-04-26 16:23:26 +00:00
/* SPDX-License-Identifier: GPL-2.0 */
# ifndef __ASM_KASAN_H
# define __ASM_KASAN_H
# ifdef CONFIG_KASAN
# define _GLOBAL_KASAN(fn) _GLOBAL(__##fn)
# define _GLOBAL_TOC_KASAN(fn) _GLOBAL_TOC(__##fn)
# define EXPORT_SYMBOL_KASAN(fn) EXPORT_SYMBOL(__##fn)
# else
# define _GLOBAL_KASAN(fn) _GLOBAL(fn)
# define _GLOBAL_TOC_KASAN(fn) _GLOBAL_TOC(fn)
# define EXPORT_SYMBOL_KASAN(fn)
# endif
2019-04-26 16:23:32 +00:00
# ifndef __ASSEMBLY__
# include <asm/page.h>
2020-08-05 15:27:29 +00:00
# include <linux/sizes.h>
2019-04-26 16:23:32 +00:00
# define KASAN_SHADOW_SCALE_SHIFT 3
2021-04-24 10:34:43 +00:00
# ifdef CONFIG_MODULES
2020-08-05 15:27:29 +00:00
# define KASAN_KERN_START ALIGN_DOWN(PAGE_OFFSET - SZ_256M, SZ_256M)
# else
# define KASAN_KERN_START PAGE_OFFSET
# endif
2019-04-26 16:23:32 +00:00
# define KASAN_SHADOW_START (KASAN_SHADOW_OFFSET + \
2020-08-05 15:27:29 +00:00
( KASAN_KERN_START > > KASAN_SHADOW_SCALE_SHIFT ) )
2019-04-26 16:23:32 +00:00
# define KASAN_SHADOW_OFFSET ASM_CONST(CONFIG_KASAN_SHADOW_OFFSET)
2020-05-19 05:48:44 +00:00
# define KASAN_SHADOW_END (-(-KASAN_SHADOW_START >> KASAN_SHADOW_SCALE_SHIFT))
2019-04-26 16:23:32 +00:00
2019-04-26 16:23:34 +00:00
# ifdef CONFIG_KASAN
void kasan_early_init ( void ) ;
2020-07-02 11:52:02 +00:00
void kasan_mmu_init ( void ) ;
2019-04-26 16:23:34 +00:00
void kasan_init ( void ) ;
2020-01-14 17:54:00 +00:00
void kasan_late_init ( void ) ;
2019-04-26 16:23:34 +00:00
# else
static inline void kasan_init ( void ) { }
2020-07-02 11:52:02 +00:00
static inline void kasan_mmu_init ( void ) { }
2020-01-14 17:54:00 +00:00
static inline void kasan_late_init ( void ) { }
2019-04-26 16:23:34 +00:00
# endif
2020-05-19 05:49:29 +00:00
void kasan_update_early_region ( unsigned long k_start , unsigned long k_end , pte_t pte ) ;
2020-05-19 05:48:48 +00:00
int kasan_init_shadow_page_tables ( unsigned long k_start , unsigned long k_end ) ;
int kasan_init_region ( void * start , size_t size ) ;
2019-04-26 16:23:32 +00:00
# endif /* __ASSEMBLY */
2019-04-26 16:23:26 +00:00
# endif