[PATCH] cpukit: Prevent error with disabled stack checker

Kinsey Moore kinsey.moore at oarcorp.com
Thu Jan 27 14:54:31 UTC 2022


On 1/27/2022 01:20, Sebastian Huber wrote:
> On 26/01/2022 23:07, Kinsey Moore wrote:
>> diff --git a/cpukit/libmisc/stackchk/check.c 
>> b/cpukit/libmisc/stackchk/check.c
>> index a2b63345d9..9119f8d940 100644
>> --- a/cpukit/libmisc/stackchk/check.c
>> +++ b/cpukit/libmisc/stackchk/check.c
>> @@ -487,6 +487,12 @@ void rtems_stack_checker_report_usage_with_plugin(
>>     uint32_t cpu_max;
>>     uint32_t cpu_index;
>>   +  /* Make sure that the stack checker is enabled */
>> +  if ( Stack_check_Interrupt_stack[ 0 ].area == NULL ) {
>> +    rtems_printf(printer, "RTEMS Stack Checker not enabled\n");
>> +    return;
>> +  }
>> +
>>     rtems_printf(
>>        printer,
>>        "                             STACK USAGE BY THREAD\n"
>
> This check is insufficient in SMP configurations. It also prevents a 
> stack report without the stack usage information.
This should be sufficient for SMP because it only needs to verify that 
the CPU interrupt stack information has been initialized for one CPU to 
know whether initialization has been run at all and that the appropriate 
hooks are in place.
>
> I would move the check to Stack_check_Dump_stack_usage(). Simply 
> report nothing if stack == NULL.
>
I'll move the check so that a stack report is still generated.


Kinsey



More information about the devel mailing list