[PATCH v3 0/2] firmware: Initial compiler built-in stack protector support
Alvin Chang
alvinga at andestech.com
Thu Jul 3 08:19:55 PDT 2025
This series add initial compiler built-in stack protector support into OpenSBI
firmware. The __stack_chk_fail() and __stack_chk_guard variable are added into
firmware assembly files accordingly.
Introduce three Kconfig configurations to enable the stack protector:
1. CONFIG_STACK_PROTECTOR to enable the stack protector feature by
providing "-fstack-protector" compiler flag
2. CONFIG_STACK_PROTECTOR_STRONG to provide "-fstack-protector-strong"
3. CONFIG_STACK_PROTECTOR_ALL to provide "-fstack-protector-all"
---
Changes from v2
- Adopt Xiang's suggestion on __stack_chk_fail in fw_payload.bin
- Adopt Peter's suggestion to print error message
Changes from v1
- Fix boot hang when compiling with DEBUG=1 and -fstack-protector-all
- Move implementation to firmware
Alvin Chang (2):
lib: sbi: Remove redundant call to sbi_hart_expected_trap_addr()
firmware: Initial compiler built-in stack protector support
firmware/Kconfig | 27 +++++++++++++++++++++++++++
firmware/fw_base.S | 21 +++++++++++++++++++++
firmware/objects.mk | 9 +++++++++
firmware/payloads/test_head.S | 15 +++++++++++++++
include/sbi/sbi_csr_detect.h | 4 ++--
include/sbi/sbi_hart.h | 4 ----
lib/sbi/sbi_illegal_atomic.c | 4 ++--
lib/sbi/sbi_unpriv.c | 6 +++---
8 files changed, 79 insertions(+), 11 deletions(-)
--
2.43.0
More information about the opensbi
mailing list