Open szekelyisz opened 2 years ago
This is a duplicate of #1138.
The problem is that __stack_chk_guard
is initialized as prvProcessTimerOrBlockTask
executes.
The initial value for __stack_chk_guard
is NULL
. This value is stored on the stack as a guard when prvProcessTimerOrBlockTask
runs for the first time. During this call the main thread is woken up which executes __esp_stack_guard_setup
that replaces the guard with a random value. After control returns to prvProcessTimerOrBlockTask
, at the end of the function the re-initialized value is compared with the initial NULL
value, and thus the check returns an error.
The problem is that
__stack_chk_guard
is initialized asprvProcessTimerOrBlockTask
executes.The initial value for
__stack_chk_guard
isNULL
. This value is stored on the stack as a guard whenprvProcessTimerOrBlockTask
runs for the first time. During this call the main thread is woken up which executes__esp_stack_guard_setup
that replaces the guard with a random value. After control returns toprvProcessTimerOrBlockTask
, at the end of the function the re-initialized value is compared with the initialNULL
value, and thus the check returns an error.
You have described the root cause of the issue, but I'm afraid can't figure out a solution based on the description.
Could you please elaborate on how can I correctly initialise the __stack_chk_guard
variable in order to avoid running into this issue?
Could you please elaborate on how can I correctly initialise the
__stack_chk_guard
variable in order to avoid running into this issue?
I'll try moving the __esp_stack_guard_setup
call into the bootloader. I'll submit a PR if it works.
Environment
Problem Description
Starting a periodic timer triggers stack smashing protection. The overflow actually happens in
prvProcessTimerOrBlockTask
.Expected Behavior
Run without error.
Actual Behavior
See debug log below.
Steps to reproduce
COMPILER_STACK_CHECK_MODE_STRONG
Code to reproduce this issue
Debug Logs