Skip to content

Commit

Permalink
esp_system: fix placement of __stack_chk_fail from flash to RAM
Browse files Browse the repository at this point in the history
When stack check is enabled, certain functions (sometimes placed in RAM)
are being decorated with stack guards and a call to __stask_chk_fail() in
case ofr stack corruption. For this reason, __stack_chk_fail() must be
placed in RAM too.

Add stack check config in heap tests on all targets to find eventual flash to RAM
calls due to stack checks when running callgraph_check.py
  • Loading branch information
SoucheSouche committed Dec 14, 2022
1 parent 72e7cbe commit 87a7389
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions components/esp_system/stack_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ __esp_stack_guard_setup (void)
__stack_chk_guard = (void *)esp_random();
}

void __stack_chk_fail (void)
IRAM_ATTR void __stack_chk_fail (void)
{
esp_rom_printf("\r\nStack smashing protect failure!\r\n\r\n");
abort();
esp_system_abort(DRAM_STR("Stack smashing protect failure!"));
}

#endif

0 comments on commit 87a7389

Please sign in to comment.