RTEMS | libmisc/stackchk: Add stack smashing protection (!277)

Joel Sherrill (@joel) gitlab at rtems.org
Wed Oct 30 23:03:07 UTC 2024




Joel Sherrill started a new discussion on cpukit/libmisc/stackchk/check.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/277#note_114082

 >    RTEMS_SYSINIT_ISR_STACK,
 >    RTEMS_SYSINIT_ORDER_MIDDLE
 >  );
 > +
 > +#ifdef DISABLE_STACK_CHK_GUARD_RUNTIME_CONFIG

This code is a bit of a complicated left turn from what I had in mind. @gedare also noticed that this resembles code on the net. What I had in mind was an RTEMS specific implementation of ___stack_chk_fail()_ that invoked the same configured _Stack_checker_Reporter_ that is currently used by the stack check extension.

This is a quick cut at what it is.

```
void __stack_chk_fail(void)
{
  Stack_checker_Reporter(running, true); // current thread and pattern at end of stack is OK
}
```

The only enhancement beyond what's there would be a way for the detection to tell the reporting function whether the stack checker extension or gcc stack protection detected the issue.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/277#note_114082
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20241030/1e88f0b8/attachment-0001.htm>


More information about the bugs mailing list