compiler.h: Add nosanitize_address macro

and replace all __attribute__((no_sanitize_address)) with it

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2022-08-20 07:11:52 +08:00
committed by Petro Karashchenko
parent c44a7cbf88
commit d22e1e1998
5 changed files with 26 additions and 60 deletions
+2 -6
View File
@@ -43,9 +43,7 @@
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
nosanitize_address
static int backtrace(uintptr_t *base, uintptr_t *limit,
uintptr_t *fp, uintptr_t *pc,
void **buffer, int size, int *skip)
@@ -106,9 +104,7 @@ static int backtrace(uintptr_t *base, uintptr_t *limit,
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
nosanitize_address
int up_backtrace(struct tcb_s *tcb,
void **buffer, int size, int skip)
{
+7 -24
View File
@@ -99,10 +99,7 @@ static void **g_backtrace_code_regions;
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
static int getlroffset(uint8_t *lr)
nosanitize_address static int getlroffset(uint8_t *lr)
{
lr = (uint8_t *)((uintptr_t)lr & 0xfffffffe);
@@ -130,10 +127,7 @@ static int getlroffset(uint8_t *lr)
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
static bool in_code_region(void *pc)
nosanitize_address static bool in_code_region(void *pc)
{
int i = 0;
@@ -181,9 +175,7 @@ static bool in_code_region(void *pc)
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
nosanitize_address
static void *backtrace_push_internal(void **psp, void **ppc)
{
uint8_t *sp = *psp;
@@ -311,9 +303,7 @@ static void *backtrace_push_internal(void **psp, void **ppc)
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
nosanitize_address
static int backtrace_push(void *limit, void **sp, void *pc,
void **buffer, int size, int *skip)
{
@@ -361,9 +351,7 @@ static int backtrace_push(void *limit, void **sp, void *pc,
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
nosanitize_address
static int backtrace_branch(void *limit, void *sp,
void **buffer, int size, int *skip)
{
@@ -445,10 +433,7 @@ static int backtrace_branch(void *limit, void *sp,
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
void up_backtrace_init_code_regions(void **regions)
nosanitize_address void up_backtrace_init_code_regions(void **regions)
{
g_backtrace_code_regions = regions;
}
@@ -477,9 +462,7 @@ void up_backtrace_init_code_regions(void **regions)
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
nosanitize_address
int up_backtrace(struct tcb_s *tcb,
void **buffer, int size, int skip)
{
+7 -24
View File
@@ -81,10 +81,7 @@ static void **g_backtrace_code_regions;
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
static int getlroffset(uint8_t *lr)
nosanitize_address static int getlroffset(uint8_t *lr)
{
lr = (uint8_t *)((uintptr_t)lr & 0xfffffffe);
@@ -116,10 +113,7 @@ static int getlroffset(uint8_t *lr)
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
static bool in_code_region(void *pc)
nosanitize_address static bool in_code_region(void *pc)
{
int i = 0;
@@ -167,9 +161,7 @@ static bool in_code_region(void *pc)
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
nosanitize_address
static void *backtrace_push_internal(void **psp, void **ppc)
{
uint8_t *sp = *psp;
@@ -290,9 +282,7 @@ static void *backtrace_push_internal(void **psp, void **ppc)
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
nosanitize_address
static int backtrace_push(void *limit, void **sp, void *pc,
void **buffer, int size, int *skip)
{
@@ -340,9 +330,7 @@ static int backtrace_push(void *limit, void **sp, void *pc,
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
nosanitize_address
static int backtrace_branch(void *limit, void *sp,
void **buffer, int size, int *skip)
{
@@ -425,10 +413,7 @@ static int backtrace_branch(void *limit, void *sp,
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
void up_backtrace_init_code_regions(void **regions)
nosanitize_address void up_backtrace_init_code_regions(void **regions)
{
g_backtrace_code_regions = regions;
}
@@ -457,9 +442,7 @@ void up_backtrace_init_code_regions(void **regions)
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
nosanitize_address
int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
{
struct tcb_s *rtcb = running_task();
+2 -6
View File
@@ -44,9 +44,7 @@
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
nosanitize_address
static int backtrace(uintptr_t *base, uintptr_t *limit,
uintptr_t *fp, uintptr_t *pc,
void **buffer, int size, int *skip)
@@ -107,9 +105,7 @@ static int backtrace(uintptr_t *base, uintptr_t *limit,
*
****************************************************************************/
#ifdef CONFIG_MM_KASAN
__attribute__((no_sanitize_address))
#endif
nosanitize_address
int up_backtrace(struct tcb_s *tcb,
void **buffer, int size, int skip)
{
+8
View File
@@ -191,6 +191,10 @@
# define noinstrument_function __attribute__ ((no_instrument_function))
/* The nosanitize_address attribute informs GCC don't sanitize it */
# define nosanitize_address __attribute__ ((no_sanitize_address))
/* The nostackprotect_function attribute disables stack protection in
* sensitive functions, e.g., stack coloration routines.
*/
@@ -460,6 +464,7 @@
# define inline_function
# define noinline_function
# define noinstrument_function
# define nosanitize_address
# define nostackprotect_function
# define unused_code
@@ -591,6 +596,7 @@
# define inline_function
# define noinline_function
# define noinstrument_function
# define nosanitize_address
# define nostackprotect_function
# define unused_code
# define unused_data
@@ -691,6 +697,7 @@
# define inline_function
# define noinline_function
# define noinstrument_function
# define nosanitize_address
# define nostackprotect_function
# define unused_code
# define unused_data
@@ -757,6 +764,7 @@
# define inline_function
# define noinline_function
# define noinstrument_function
# define nosanitize_address
# define nostackprotect_function
# define unused_code
# define unused_data