1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #18448 from nmeum/pr/stack-overflow-panic

core: Treat stack overflows as an unrecoverable error
This commit is contained in:
Kaspar Schleiser 2022-09-21 15:11:12 +02:00 committed by GitHub
commit 6db9960741
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -51,6 +51,7 @@ typedef enum {
PANIC_DUMMY_HANDLER, /**< unhandled interrupt */
#endif
PANIC_SSP, /**< stack smashing protector failure */
PANIC_STACK_OVERFLOW, /**< stack overflow detected */
PANIC_UNDEFINED
} core_panic_t;

View File

@ -30,6 +30,7 @@
#include "log.h"
#include "sched.h"
#include "thread.h"
#include "panic.h"
#ifdef MODULE_MPU_STACK_GUARD
#include "mpu.h"
@ -130,9 +131,10 @@ static void _unschedule(thread_t *active_thread)
*/
if (*((uintptr_t *)(uintptr_t)active_thread->stack_start) !=
(uintptr_t)active_thread->stack_start) {
LOG_WARNING(
LOG_ERROR(
"scheduler(): stack overflow detected, pid=%" PRIkernel_pid "\n",
active_thread->pid);
core_panic(PANIC_STACK_OVERFLOW, "STACK OVERFLOW");
}
#endif
#ifdef MODULE_SCHED_CB