From 64fbeaa0d1b4321cb439923c86993d134fbd3acb Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 6 Oct 2022 08:47:14 +0200 Subject: score: INTERNAL_ERROR_IDLE_THREAD_STACK_TOO_SMALL Ensure that the IDLE storage allocator did allocate a suffiently large area. Update #3835. Update #4524. --- cpukit/include/rtems/score/interr.h | 3 ++- cpukit/sapi/src/interrtext.c | 3 ++- cpukit/score/src/threadcreateidle.c | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'cpukit') diff --git a/cpukit/include/rtems/score/interr.h b/cpukit/include/rtems/score/interr.h index f21e8d58a1..003e80e0bd 100644 --- a/cpukit/include/rtems/score/interr.h +++ b/cpukit/include/rtems/score/interr.h @@ -230,7 +230,8 @@ typedef enum { INTERNAL_ERROR_TOO_LARGE_TLS_SIZE = 41, INTERNAL_ERROR_RTEMS_INIT_TASK_CONSTRUCT_FAILED = 42, INTERNAL_ERROR_IDLE_THREAD_CREATE_FAILED = 43, - INTERNAL_ERROR_NO_MEMORY_FOR_IDLE_TASK_STORAGE = 44 + INTERNAL_ERROR_NO_MEMORY_FOR_IDLE_TASK_STORAGE = 44, + INTERNAL_ERROR_IDLE_THREAD_STACK_TOO_SMALL = 45 } Internal_errors_Core_list; typedef CPU_Uint32ptr Internal_errors_t; diff --git a/cpukit/sapi/src/interrtext.c b/cpukit/sapi/src/interrtext.c index e828a82051..34b51419cf 100644 --- a/cpukit/sapi/src/interrtext.c +++ b/cpukit/sapi/src/interrtext.c @@ -85,7 +85,8 @@ static const char *const internal_error_text[] = { "INTERNAL_ERROR_TOO_LARGE_TLS_SIZE", "INTERNAL_ERROR_RTEMS_INIT_TASK_CONSTRUCT_FAILED", "INTERNAL_ERROR_IDLE_THREAD_CREATE_FAILED", - "INTERNAL_ERROR_NO_MEMORY_FOR_IDLE_TASK_STORAGE" + "INTERNAL_ERROR_NO_MEMORY_FOR_IDLE_TASK_STORAGE", + "INTERNAL_ERROR_IDLE_THREAD_STACK_TOO_SMALL" }; const char *rtems_internal_error_text( rtems_fatal_code error ) diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c index 04565f910b..cb15d5cc3c 100644 --- a/cpukit/score/src/threadcreateidle.c +++ b/cpukit/score/src/threadcreateidle.c @@ -84,6 +84,10 @@ static void _Thread_Create_idle_for_CPU( &config.stack_size ); + if ( config.stack_size < storage_size ) { + _Internal_error( INTERNAL_ERROR_IDLE_THREAD_STACK_TOO_SMALL ); + } + /* * The entire workspace is zeroed during its initialization. Thus, all * fields not explicitly assigned were explicitly zeroed by -- cgit v1.2.3