From d365be9f2f457140f8558d4b4c8c9b973c675f79 Mon Sep 17 00:00:00 2001 From: yinshengkai Date: Mon, 22 Apr 2024 18:21:04 +0800 Subject: [PATCH] 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 --- mm/kasan/hook.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/mm/kasan/hook.c b/mm/kasan/hook.c index 8db71f5d84..ff782a6152 100644 --- a/mm/kasan/hook.c +++ b/mm/kasan/hook.c @@ -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); }