[PATCH 01/13] sptls0*: Enable stack checker

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Sep 30 09:21:24 UTC 2022


The thread-local storage area is located close to other stacks.  Try to detect
overwrites.
---
 testsuites/sptests/sptls01/init.c  | 4 ++++
 testsuites/sptests/sptls02/init.cc | 4 ++++
 testsuites/sptests/sptls03/init.c  | 4 ++++
 3 files changed, 12 insertions(+)

diff --git a/testsuites/sptests/sptls01/init.c b/testsuites/sptests/sptls01/init.c
index efd0fb4c6c..64860ec9c9 100644
--- a/testsuites/sptests/sptls01/init.c
+++ b/testsuites/sptests/sptls01/init.c
@@ -30,6 +30,7 @@
 #endif
 
 #include <rtems/bspIo.h>
+#include <rtems/stackchk.h>
 #include <rtems/sysinit.h>
 
 #include "tmacros.h"
@@ -109,6 +110,7 @@ static void Init(rtems_task_argument arg)
 {
   test();
 
+  rtems_test_assert(!rtems_stack_checker_is_blown());
   TEST_END();
 
   rtems_test_exit(0);
@@ -123,6 +125,8 @@ RTEMS_SYSINIT_ITEM(
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
 
+#define CONFIGURE_STACK_CHECKER_ENABLED
+
 #define CONFIGURE_MAXIMUM_TASKS 2
 
 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
diff --git a/testsuites/sptests/sptls02/init.cc b/testsuites/sptests/sptls02/init.cc
index 712358f978..e4791cffd6 100644
--- a/testsuites/sptests/sptls02/init.cc
+++ b/testsuites/sptests/sptls02/init.cc
@@ -36,6 +36,7 @@
 
 #include <rtems.h>
 #include <rtems/libcsupport.h>
+#include <rtems/stackchk.h>
 
 #include <tmacros.h>
 
@@ -288,6 +289,7 @@ extern "C" void Init(rtems_task_argument arg)
 	testWorkerTask();
 
 	rtems_test_assert(rtems_resource_snapshot_check(&snapshot));
+	rtems_test_assert(!rtems_stack_checker_is_blown());
 
 	TEST_END();
 
@@ -297,6 +299,8 @@ extern "C" void Init(rtems_task_argument arg)
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
 
+#define CONFIGURE_STACK_CHECKER_ENABLED
+
 #define CONFIGURE_MAXIMUM_TASKS 2
 #define CONFIGURE_MAXIMUM_SEMAPHORES 3
 
diff --git a/testsuites/sptests/sptls03/init.c b/testsuites/sptests/sptls03/init.c
index 6625327f45..119c0cb29c 100644
--- a/testsuites/sptests/sptls03/init.c
+++ b/testsuites/sptests/sptls03/init.c
@@ -29,6 +29,7 @@
 #include "config.h"
 #endif
 
+#include <rtems/stackchk.h>
 #include <rtems/score/thread.h>
 
 #include "tmacros.h"
@@ -55,6 +56,7 @@ static void Init(rtems_task_argument arg)
 
   test();
 
+  rtems_test_assert(!rtems_stack_checker_is_blown());
   TEST_END();
 
   rtems_test_exit(0);
@@ -75,6 +77,8 @@ static void Init(rtems_task_argument arg)
  */
 #define CONFIGURE_DISABLE_NEWLIB_REENTRANCY
 
+#define CONFIGURE_STACK_CHECKER_ENABLED
+
 #define CONFIGURE_MAXIMUM_TASKS 1
 
 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
-- 
2.35.3



More information about the devel mailing list