-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decide whether to enable HW_STACK_PROTECTION by default #28664
Comments
I'd be ok, stack overflows are indeed a major but simple to catch source of application problems. Or, make it default enabled when DEBUG is enabled? |
|
Nope, other than the fact that it increases code and ram footprint. ARM_MPU is enabled by default in the majority of Cortex-M boards that support it. |
My vote goes for enabling this by default for all SoCs that support it. |
I think this has already been an adopted policy, at least for Cortex-M platforms in the tree, including, among others, Atmel, Nordic, NXP and STm32. It has been documented as well in the board porting guidelines: https://docs.zephyrproject.org/latest/guides/porting/board_porting.html?highlight=board%20porting so, I am going to close this ticket. |
Introduction
Decide whether to enable HW STACK PROTECTION by default in builds.
Problem description
It has been identified that the root-cause in many of issues reported by users, while trying out Zephyr applications, is thread stack corruption. Therefore, turning HW_STACK_PROTECTION on by default in Board definition is a valuable feature during application development.
Proposed change
Turn HW_STACK_PROTECTION ON by default in Zephyr builds, where the platform supports it.
This is currently done in Nordic official DK Boards, but it could be extended to a wider list of Boards (if not allover the place).
Concerns and Unresolved Questions
The feature comes with some increase in code footprint, RAM, and runtime performance (e.g. in ARMv7-M it increases the time required for context-switch). This should be documented.
The feature needs to be explicitly disable in tests that require HW stack protection to be OFF (e.g. for benchmark or profiling)
If we agree to do this everywhere, we should add this in the Board porting guidelines.
The text was updated successfully, but these errors were encountered: