-
Notifications
You must be signed in to change notification settings - Fork 3k
Allow NS HardFault to be handled by NS code #8633
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
Conversation
Set the BFHFNMINS bit of the AIRCR to 1 on secure boot so non-secure code can handle its own hard faults. This enables mbed-os to performs recovery operations on crashes along with hooking the HardFault handler for testing.
@c1728p9 Cmse_lib.o should be added as well. @ARMmbed/mbed-os-maintainers - Changes in secure side should come in minor release or patch release ? CC @ARMmbed/team-nuvoton @gaborkertesz FYI, This might be a requirement for upcoming features in Mbed OS. |
Event though I rebuilt cmse_lib.o, was an identical binary so there is no diff for it. |
If Arm-v8M security extension is to be used for secure/non-secure isolation, this bit must not be set to 1. |
To elaborate further: keeping BFHFNMINS at 0 is a requirement for secure execution from the Arm-v8M security extension hardware architecture point of view in Trusted Firmware M. |
Not totally following the BFHFNMINS=1 objections - I'm not that familiar with the architecture, but seems to me to be far more heavily engineered for correct operation in that mode than these comments suggest:
Certainly there are setups where the secure side may be needing these exceptions - eg if the main OS is secure - but we're talking here about a non-secure OS calling secure subroutines, aren't we? And system death/reboot (or recovery) in the non-secure OS side on failure? Anyway, if BFHFNMINS is set to 0, the secure code would get in the way less if you could avoid hitting the HardFault or BusFault in the first place. Mainly it arises as an escalation, many of which could be avoided by:
(both assuming Main Extension, which Cortex-M33 has) Also, if the secure code is having BFHFNMINS=0, then it really should be providing an alternative non-secure interrupt to report BusFaults and HardFaults to the non-secure code, once it's finished doing whatever it needs to do. We need to be able to reach |
@kjbracey-arm the target this change was made for is the |
Closing this due to its security implications. |
Description
Set the BFHFNMINS bit of the AIRCR to 1 on secure boot so non-secure code can handle its own hard faults. This enables mbed-os to performs recovery operations on crashes along with hooking the HardFault handler for testing.
Pull request type