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.
This commit is contained in:
Joel Sherrill
2007-07-06 21:11:36 +00:00
parent 8ddf67e8a6
commit 2b596c6986
2 changed files with 21 additions and 8 deletions

View File

@@ -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;