kasan: remove kasan report recursive check

PANIC never returns and abort is called to exit the process after calling assert
When BOARD_RESET_ON_ASSERT < 2, the second kasan_report will not be executed.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2024-04-22 18:21:04 +08:00 committed by Xiang Xiao
parent 5ee7c563a5
commit d365be9f2f
1 changed files with 7 additions and 12 deletions

View File

@ -121,26 +121,21 @@ static void kasan_show_memory(FAR const uint8_t *addr, size_t size,
static void kasan_report(FAR const void *addr, size_t size,
bool is_write, FAR void *return_address)
{
static int recursion;
irqstate_t flags;
flags = enter_critical_section();
if (++recursion == 1)
{
_alert("kasan detected a %s access error, address at %p,"
"size is %zu, return address: %p\n",
is_write ? "write" : "read",
addr, size, return_address);
_alert("kasan detected a %s access error, address at %p,"
"size is %zu, return address: %p\n",
is_write ? "write" : "read",
addr, size, return_address);
kasan_show_memory(addr, size, 80);
kasan_show_memory(addr, size, 80);
#ifndef CONFIG_MM_KASAN_DISABLE_PANIC
PANIC();
PANIC();
#else
dump_stack();
dump_stack();
#endif
}
--recursion;
leave_critical_section(flags);
}