diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-07-06 21:11:36 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-07-06 21:11:36 +0000 |
commit | 2b596c698695c9225d02c3e704d519aceda7e924 (patch) | |
tree | 4cf1237e3747d1399987f25c24525beaa4007253 /cpukit | |
parent | Move stack outside of _rtems_end marked area. (diff) | |
download | rtems-2b596c698695c9225d02c3e704d519aceda7e924.tar.bz2 |
2007-07-06 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/stackchk/check.c: Make checking the integrity of the pattern
area contingent on the stack checker user extension having been
initialized.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 6 | ||||
-rw-r--r-- | cpukit/libmisc/stackchk/check.c | 23 |
2 files changed, 21 insertions, 8 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index b08c303d3f..227c9548b3 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,9 @@ +2007-07-06 Joel Sherrill <joel.sherrill@oarcorp.com> + + * libmisc/stackchk/check.c: Make checking the integrity of the pattern + area contingent on the stack checker user extension having been + initialized. + 2007-06-21 Joel Sherrill <joel.sherrill@OARcorp.com> * libnetworking/rtems/rtems_syscall.c: Remove RTEMS versions of send() diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c index bc9dc66481..3e0a39651a 100644 --- a/cpukit/libmisc/stackchk/check.c +++ b/cpukit/libmisc/stackchk/check.c @@ -266,10 +266,10 @@ void rtems_stack_checker_switch_extension( pattern = (void *) Stack_check_Get_pattern_area(the_stack)->pattern; /* - * Check for an out of bounds stack pointer and then an overwrite + * Check for an out of bounds stack pointer or an overwrite */ - sp_ok = Stack_check_Frame_pointer_in_range( the_stack ); + pattern_ok = (!memcmp( pattern, (void *) Stack_check_Pattern.pattern, PATTERN_SIZE_BYTES)); @@ -284,19 +284,26 @@ void rtems_stack_checker_switch_extension( boolean rtems_stack_checker_is_blown( void ) { Stack_Control *the_stack = &_Thread_Executing->Start.Initial_stack; - void *pattern; boolean sp_ok; boolean pattern_ok = TRUE; - pattern = (void *) Stack_check_Get_pattern_area(the_stack)->pattern; - /* - * Check for an out of bounds stack pointer and then an overwrite + * Check for an out of bounds stack pointer */ sp_ok = Stack_check_Frame_pointer_in_range( the_stack ); - pattern_ok = (!memcmp( pattern, - (void *) Stack_check_Pattern.pattern, PATTERN_SIZE_BYTES)); + + /* + * The stack checker must be initialized before the pattern is there + * to check. + */ + if ( Stack_check_Initialized ) { + pattern_ok = (!memcmp( + (void *) Stack_check_Get_pattern_area(the_stack)->pattern, + (void *) Stack_check_Pattern.pattern, + PATTERN_SIZE_BYTES + )); + } if ( !sp_ok || !pattern_ok ) { return TRUE; |