1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 01:18:28 +00:00

refactor(core/embed): move __stack_chk_fail to a better location

[no changelog]
This commit is contained in:
cepetr 2024-08-18 12:00:30 +02:00 committed by cepetr
parent b1a41ded79
commit 0e45f92d3b
3 changed files with 8 additions and 12 deletions

View File

@ -38,6 +38,14 @@
#define COLOR_FATAL_ERROR COLOR_BLACK
#endif
uint32_t __stack_chk_guard = 0;
// Calls to this function are inserted by the compiler
// when stack protection is enabled.
void __attribute__((noreturn, used)) __stack_chk_fail(void) {
error_shutdown("(SS)");
}
void __attribute__((noreturn))
error_shutdown_ex(const char *title, const char *message, const char *footer) {
if (title == NULL) {

View File

@ -36,12 +36,6 @@
#include "backlight_pwm.h"
#endif
uint32_t __stack_chk_guard = 0;
void __attribute__((noreturn)) __stack_chk_fail(void) {
error_shutdown("(SS)");
}
// reference RM0090 section 35.12.1 Figure 413
#define USB_OTG_HS_DATA_FIFO_RAM (USB_OTG_HS_PERIPH_BASE + 0x20000U)
#define USB_OTG_HS_DATA_FIFO_SIZE (4096U)

View File

@ -32,12 +32,6 @@
#include "stm32u5xx_ll_utils.h"
uint32_t __stack_chk_guard = 0;
void __attribute__((noreturn)) __stack_chk_fail(void) {
error_shutdown("(SS)");
}
void invalidate_firmware(void) {
// on stm32u5, we need to disable the instruction cache before erasing the
// firmware - otherwise, the write check will fail