mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
mm/kasan: support Disable Kasan read Panic
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
+12
-3
@@ -320,14 +320,23 @@ config MM_KASAN_GLOBAL
|
|||||||
KEEP ( *(. data. rel. local.. LASAN0))
|
KEEP ( *(. data. rel. local.. LASAN0))
|
||||||
}", used to extract data generated by the compiler
|
}", used to extract data generated by the compiler
|
||||||
|
|
||||||
config MM_KASAN_DISABLE_PANIC
|
config MM_KASAN_DISABLE_READ_PANIC
|
||||||
bool "Disable panic on kasan error"
|
bool "Disable panic on kasan read error"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
This option disable panic on kasan read error. It will print error info
|
||||||
|
and continue to run.
|
||||||
|
|
||||||
|
config MM_KASAN_DISABLE_WRITE_PANIC
|
||||||
|
bool "Disable panic on kasan write error"
|
||||||
depends on MM_KASAN
|
depends on MM_KASAN
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
This option disable panic on kasan error. It will print error info
|
This option disable panic on kasan write error. It will print error info
|
||||||
and continue to run.
|
and continue to run.
|
||||||
|
|
||||||
|
endif # MM_KASAN
|
||||||
|
|
||||||
config MM_UBSAN
|
config MM_UBSAN
|
||||||
bool "Undefined Behavior Sanitizer"
|
bool "Undefined Behavior Sanitizer"
|
||||||
default n
|
default n
|
||||||
|
|||||||
+22
-5
@@ -71,6 +71,18 @@
|
|||||||
kasan_check_report(addr, size, true, return_address(0)); \
|
kasan_check_report(addr, size, true, return_address(0)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_MM_KASAN_DISABLE_READ_PANIC
|
||||||
|
# define MM_KASAN_DISABLE_READ_PANIC 1
|
||||||
|
#else
|
||||||
|
# define MM_KASAN_DISABLE_READ_PANIC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_MM_KASAN_DISABLE_WRITE_PANIC
|
||||||
|
# define MM_KASAN_DISABLE_WRITE_PANIC 1
|
||||||
|
#else
|
||||||
|
# define MM_KASAN_DISABLE_WRITE_PANIC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -130,11 +142,16 @@ static void kasan_report(FAR const void *addr, size_t size,
|
|||||||
addr, size, return_address);
|
addr, size, return_address);
|
||||||
|
|
||||||
kasan_show_memory(addr, size, 80);
|
kasan_show_memory(addr, size, 80);
|
||||||
#ifndef CONFIG_MM_KASAN_DISABLE_PANIC
|
|
||||||
PANIC();
|
if ((is_write && MM_KASAN_DISABLE_WRITE_PANIC) ||
|
||||||
#else
|
(!is_write && MM_KASAN_DISABLE_READ_PANIC))
|
||||||
dump_stack();
|
{
|
||||||
#endif
|
dump_stack();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PANIC();
|
||||||
|
}
|
||||||
|
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user