[rtems commit] libtests/crypt01: Avoid stack overflows

Sebastian Huber sebh at rtems.org
Mon Jul 4 06:24:57 UTC 2022


Module:    rtems
Branch:    master
Commit:    9dd4bd3963d1e5c249086cae439e86081959bab8
Changeset: http://git.rtems.org/rtems/commit/?id=9dd4bd3963d1e5c249086cae439e86081959bab8

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jun 28 17:40:49 2022 +0200

libtests/crypt01: Avoid stack overflows

The SHA512 functions may use huge amounts of stack space if compiled without
optimization.

---

 testsuites/libtests/crypt01/init.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/testsuites/libtests/crypt01/init.c b/testsuites/libtests/crypt01/init.c
index 0944aa60f7..26ba70e250 100644
--- a/testsuites/libtests/crypt01/init.c
+++ b/testsuites/libtests/crypt01/init.c
@@ -36,6 +36,8 @@
 #include <crypt.h>
 #include <string.h>
 
+#include <rtems/stackchk.h>
+
 #include "tmacros.h"
 
 const char rtems_test_name[] = "CRYPT 1";
@@ -234,18 +236,20 @@ static void Init(rtems_task_argument arg)
   test_sha512();
   test_generic();
 
+  rtems_test_assert(!rtems_stack_checker_is_blown());
   TEST_END();
   rtems_test_exit(0);
 }
 
 #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
+#define CONFIGURE_STACK_CHECKER_ENABLED
 
 #define CONFIGURE_MAXIMUM_TASKS 1
 
 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
 
-#define CONFIGURE_INIT_TASK_STACK_SIZE (2 * RTEMS_MINIMUM_STACK_SIZE)
+#define CONFIGURE_INIT_TASK_STACK_SIZE (8 * RTEMS_MINIMUM_STACK_SIZE)
 
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
 



More information about the vc mailing list