mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:10:13 +08:00
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:
committed by
Petro Karashchenko
parent
c44a7cbf88
commit
d22e1e1998
@@ -43,9 +43,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
static int backtrace(uintptr_t *base, uintptr_t *limit,
|
static int backtrace(uintptr_t *base, uintptr_t *limit,
|
||||||
uintptr_t *fp, uintptr_t *pc,
|
uintptr_t *fp, uintptr_t *pc,
|
||||||
void **buffer, int size, int *skip)
|
void **buffer, int size, int *skip)
|
||||||
@@ -106,9 +104,7 @@ static int backtrace(uintptr_t *base, uintptr_t *limit,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
int up_backtrace(struct tcb_s *tcb,
|
int up_backtrace(struct tcb_s *tcb,
|
||||||
void **buffer, int size, int skip)
|
void **buffer, int size, int skip)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -99,10 +99,7 @@ static void **g_backtrace_code_regions;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address static int getlroffset(uint8_t *lr)
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
static int getlroffset(uint8_t *lr)
|
|
||||||
{
|
{
|
||||||
lr = (uint8_t *)((uintptr_t)lr & 0xfffffffe);
|
lr = (uint8_t *)((uintptr_t)lr & 0xfffffffe);
|
||||||
|
|
||||||
@@ -130,10 +127,7 @@ static int getlroffset(uint8_t *lr)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address static bool in_code_region(void *pc)
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
static bool in_code_region(void *pc)
|
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@@ -181,9 +175,7 @@ static bool in_code_region(void *pc)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
static void *backtrace_push_internal(void **psp, void **ppc)
|
static void *backtrace_push_internal(void **psp, void **ppc)
|
||||||
{
|
{
|
||||||
uint8_t *sp = *psp;
|
uint8_t *sp = *psp;
|
||||||
@@ -311,9 +303,7 @@ static void *backtrace_push_internal(void **psp, void **ppc)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
static int backtrace_push(void *limit, void **sp, void *pc,
|
static int backtrace_push(void *limit, void **sp, void *pc,
|
||||||
void **buffer, int size, int *skip)
|
void **buffer, int size, int *skip)
|
||||||
{
|
{
|
||||||
@@ -361,9 +351,7 @@ static int backtrace_push(void *limit, void **sp, void *pc,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
static int backtrace_branch(void *limit, void *sp,
|
static int backtrace_branch(void *limit, void *sp,
|
||||||
void **buffer, int size, int *skip)
|
void **buffer, int size, int *skip)
|
||||||
{
|
{
|
||||||
@@ -445,10 +433,7 @@ static int backtrace_branch(void *limit, void *sp,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address void up_backtrace_init_code_regions(void **regions)
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
void up_backtrace_init_code_regions(void **regions)
|
|
||||||
{
|
{
|
||||||
g_backtrace_code_regions = regions;
|
g_backtrace_code_regions = regions;
|
||||||
}
|
}
|
||||||
@@ -477,9 +462,7 @@ void up_backtrace_init_code_regions(void **regions)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
int up_backtrace(struct tcb_s *tcb,
|
int up_backtrace(struct tcb_s *tcb,
|
||||||
void **buffer, int size, int skip)
|
void **buffer, int size, int skip)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,10 +81,7 @@ static void **g_backtrace_code_regions;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address static int getlroffset(uint8_t *lr)
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
static int getlroffset(uint8_t *lr)
|
|
||||||
{
|
{
|
||||||
lr = (uint8_t *)((uintptr_t)lr & 0xfffffffe);
|
lr = (uint8_t *)((uintptr_t)lr & 0xfffffffe);
|
||||||
|
|
||||||
@@ -116,10 +113,7 @@ static int getlroffset(uint8_t *lr)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address static bool in_code_region(void *pc)
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
static bool in_code_region(void *pc)
|
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@@ -167,9 +161,7 @@ static bool in_code_region(void *pc)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
static void *backtrace_push_internal(void **psp, void **ppc)
|
static void *backtrace_push_internal(void **psp, void **ppc)
|
||||||
{
|
{
|
||||||
uint8_t *sp = *psp;
|
uint8_t *sp = *psp;
|
||||||
@@ -290,9 +282,7 @@ static void *backtrace_push_internal(void **psp, void **ppc)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
static int backtrace_push(void *limit, void **sp, void *pc,
|
static int backtrace_push(void *limit, void **sp, void *pc,
|
||||||
void **buffer, int size, int *skip)
|
void **buffer, int size, int *skip)
|
||||||
{
|
{
|
||||||
@@ -340,9 +330,7 @@ static int backtrace_push(void *limit, void **sp, void *pc,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
static int backtrace_branch(void *limit, void *sp,
|
static int backtrace_branch(void *limit, void *sp,
|
||||||
void **buffer, int size, int *skip)
|
void **buffer, int size, int *skip)
|
||||||
{
|
{
|
||||||
@@ -425,10 +413,7 @@ static int backtrace_branch(void *limit, void *sp,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address void up_backtrace_init_code_regions(void **regions)
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
void up_backtrace_init_code_regions(void **regions)
|
|
||||||
{
|
{
|
||||||
g_backtrace_code_regions = regions;
|
g_backtrace_code_regions = regions;
|
||||||
}
|
}
|
||||||
@@ -457,9 +442,7 @@ void up_backtrace_init_code_regions(void **regions)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
|
int up_backtrace(struct tcb_s *tcb, void **buffer, int size, int skip)
|
||||||
{
|
{
|
||||||
struct tcb_s *rtcb = running_task();
|
struct tcb_s *rtcb = running_task();
|
||||||
|
|||||||
@@ -44,9 +44,7 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
static int backtrace(uintptr_t *base, uintptr_t *limit,
|
static int backtrace(uintptr_t *base, uintptr_t *limit,
|
||||||
uintptr_t *fp, uintptr_t *pc,
|
uintptr_t *fp, uintptr_t *pc,
|
||||||
void **buffer, int size, int *skip)
|
void **buffer, int size, int *skip)
|
||||||
@@ -107,9 +105,7 @@ static int backtrace(uintptr_t *base, uintptr_t *limit,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_MM_KASAN
|
nosanitize_address
|
||||||
__attribute__((no_sanitize_address))
|
|
||||||
#endif
|
|
||||||
int up_backtrace(struct tcb_s *tcb,
|
int up_backtrace(struct tcb_s *tcb,
|
||||||
void **buffer, int size, int skip)
|
void **buffer, int size, int skip)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -191,6 +191,10 @@
|
|||||||
|
|
||||||
# define noinstrument_function __attribute__ ((no_instrument_function))
|
# 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
|
/* The nostackprotect_function attribute disables stack protection in
|
||||||
* sensitive functions, e.g., stack coloration routines.
|
* sensitive functions, e.g., stack coloration routines.
|
||||||
*/
|
*/
|
||||||
@@ -460,6 +464,7 @@
|
|||||||
# define inline_function
|
# define inline_function
|
||||||
# define noinline_function
|
# define noinline_function
|
||||||
# define noinstrument_function
|
# define noinstrument_function
|
||||||
|
# define nosanitize_address
|
||||||
# define nostackprotect_function
|
# define nostackprotect_function
|
||||||
|
|
||||||
# define unused_code
|
# define unused_code
|
||||||
@@ -591,6 +596,7 @@
|
|||||||
# define inline_function
|
# define inline_function
|
||||||
# define noinline_function
|
# define noinline_function
|
||||||
# define noinstrument_function
|
# define noinstrument_function
|
||||||
|
# define nosanitize_address
|
||||||
# define nostackprotect_function
|
# define nostackprotect_function
|
||||||
# define unused_code
|
# define unused_code
|
||||||
# define unused_data
|
# define unused_data
|
||||||
@@ -691,6 +697,7 @@
|
|||||||
# define inline_function
|
# define inline_function
|
||||||
# define noinline_function
|
# define noinline_function
|
||||||
# define noinstrument_function
|
# define noinstrument_function
|
||||||
|
# define nosanitize_address
|
||||||
# define nostackprotect_function
|
# define nostackprotect_function
|
||||||
# define unused_code
|
# define unused_code
|
||||||
# define unused_data
|
# define unused_data
|
||||||
@@ -757,6 +764,7 @@
|
|||||||
# define inline_function
|
# define inline_function
|
||||||
# define noinline_function
|
# define noinline_function
|
||||||
# define noinstrument_function
|
# define noinstrument_function
|
||||||
|
# define nosanitize_address
|
||||||
# define nostackprotect_function
|
# define nostackprotect_function
|
||||||
# define unused_code
|
# define unused_code
|
||||||
# define unused_data
|
# define unused_data
|
||||||
|
|||||||
Reference in New Issue
Block a user