[PATCH 3/3] stackchk: Fix stack checker thread initialization
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed Sep 7 12:45:36 UTC 2016
Commit 0fd6f25507fbea5f4892b71b58837cdda17856b4 relaxed the thread begin
extension execution environment. This broke the stack check which only
partially initialized the stack pattern in its create extension. Move
the part of the begin extension to the create extension.
---
cpukit/libmisc/stackchk/check.c | 19 +++----------------
cpukit/libmisc/stackchk/stackchk.h | 15 +--------------
2 files changed, 4 insertions(+), 30 deletions(-)
diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c
index 6b6b98b..ae4ae79 100644
--- a/cpukit/libmisc/stackchk/check.c
+++ b/cpukit/libmisc/stackchk/check.c
@@ -202,28 +202,15 @@ bool rtems_stack_checker_create_extension(
)
{
Stack_check_Initialize();
-
- if (the_thread)
- Stack_check_Dope_stack(&the_thread->Start.Initial_stack);
-
- return true;
-}
-
-/*
- * rtems_stack_checker_Begin_extension
- */
-void rtems_stack_checker_begin_extension(
- Thread_Control *the_thread
-)
-{
- if ( the_thread->Object.id == 0 ) /* skip system tasks */
- return;
+ Stack_check_Dope_stack(&the_thread->Start.Initial_stack);
memcpy(
Stack_check_Get_pattern(&the_thread->Start.Initial_stack),
Stack_check_Pattern,
PATTERN_SIZE_BYTES
);
+
+ return true;
}
/*
diff --git a/cpukit/libmisc/stackchk/stackchk.h b/cpukit/libmisc/stackchk/stackchk.h
index f7f75b6..8ad1733 100644
--- a/cpukit/libmisc/stackchk/stackchk.h
+++ b/cpukit/libmisc/stackchk/stackchk.h
@@ -97,19 +97,6 @@ bool rtems_stack_checker_create_extension(
);
/**
- * @brief Stack Checker Task Begin Extension
- *
- * This method is the task begin extension for the stack checker.
- *
- * @param[in] the_thread points to task starting to execute
- *
- * @note This is called from the internal method _Thread_Handler.
- */
-void rtems_stack_checker_begin_extension(
- Thread_Control *the_thread
-);
-
-/**
* @brief Stack Checker Task Context Switch Extension
*
* This method is the task context switch extension for the stack checker.
@@ -138,7 +125,7 @@ void rtems_stack_checker_switch_extension(
0, /* rtems_task_restart */ \
0, /* rtems_task_delete */ \
rtems_stack_checker_switch_extension, /* task_switch */ \
- rtems_stack_checker_begin_extension, /* task_begin */ \
+ 0, /* task_begin */ \
0, /* task_exitted */ \
0 /* rtems_stack_checker_fatal_extension */, /* fatal */ \
}
--
1.8.4.5
More information about the devel
mailing list