kasan:add kasan_start/stop api to control kasan check
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
be86b03794
commit
2d8b582ce6
@ -34,14 +34,17 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define kasan_init_early() kasan_stop()
|
||||
|
||||
#ifndef CONFIG_MM_KASAN
|
||||
# define kasan_is_poisoned(addr, size) false
|
||||
# define kasan_poison(addr, size)
|
||||
# define kasan_unpoison(addr, size) addr
|
||||
# define kasan_register(addr, size)
|
||||
# define kasan_unregister(addr)
|
||||
# define kasan_init_early()
|
||||
# define kasan_stop()
|
||||
# define kasan_reset_tag(addr) addr
|
||||
# define kasan_start()
|
||||
#else
|
||||
|
||||
/****************************************************************************
|
||||
@ -144,10 +147,26 @@ void kasan_register(FAR void *addr, FAR size_t *size);
|
||||
void kasan_unregister(FAR void *addr);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: kasan_init_early
|
||||
* Name: kasan_start
|
||||
*
|
||||
* Description:
|
||||
* Initialize the kasan early, setup g_region_init variable.
|
||||
* Let kasan start check.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None.
|
||||
*
|
||||
* Returned Value:
|
||||
* None.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void kasan_start(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: kasan_stop
|
||||
*
|
||||
* Description:
|
||||
* Stop kasan check, setup g_region_init variable.
|
||||
* This used for some platfroms clear bss late, and error use kasan before
|
||||
* called kasan_register().
|
||||
*
|
||||
@ -159,7 +178,7 @@ void kasan_unregister(FAR void *addr);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void kasan_init_early(void);
|
||||
void kasan_stop(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: kasan_reset_tag
|
||||
|
@ -303,7 +303,12 @@ void kasan_unregister(FAR void *addr)
|
||||
spin_unlock_irqrestore(&g_lock, flags);
|
||||
}
|
||||
|
||||
void kasan_init_early(void)
|
||||
void kasan_start(void)
|
||||
{
|
||||
g_region_init = KASAN_INIT_VALUE;
|
||||
}
|
||||
|
||||
void kasan_stop(void)
|
||||
{
|
||||
g_region_init = 0;
|
||||
}
|
||||
|
@ -192,7 +192,12 @@ void kasan_register(FAR void *addr, FAR size_t *size)
|
||||
*size -= KASAN_REGION_SIZE(*size);
|
||||
}
|
||||
|
||||
void kasan_init_early(void)
|
||||
void kasan_start(void)
|
||||
{
|
||||
g_region_init = KASAN_INIT_VALUE;
|
||||
}
|
||||
|
||||
void kasan_stop(void)
|
||||
{
|
||||
g_region_init = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user