-
Notifications
You must be signed in to change notification settings - Fork 8.2k
ARM: Cortex-M: minor fix in the fault handling so some rare stack overflows are identified and are not reported as generic CPU errors. #31144
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
|
@chrisc11 FYI, please take a look, if possible. |
cf533a9 to
c770157
Compare
|
@galak @carlescufi pls take a quick look here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @ioannisg!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could fold this into 236 and update mmfar with SCB->MMFAR there directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, for the reasons explained above, in the inline comment, I'd rather keep the design as is, because theoretically the MemManage handler could be preempted rigth after reading the MMARVALID flag, and there would be cases where the flag would not be valid any more.
By design in Zephyr the fault handlers have highest configurable priority, but i wanted to have a design that would be robust against changes :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hrm, yeah I guess one could have the MemManage exception at a lower priority than another ISR, get interrupted here, and fault from that ISR. That would be a tricky crash to investigate! :)
When the MMARVALID bit is not set, do not read the MMFAR register to get the fault address in a MemManage fault. This change prevents the fault handler to erroneously assume MMFAR contains a valid address. Signed-off-by: Ioannis Glaropoulos <[email protected]>
c770157 to
7aca8ef
Compare
In rare cases when a thread may overflow its stack, the core will not report a Stacking Error. This is the case when a large stack array is created, making the PSP cross beyond the stack guard; in this case a MemManage fault won't cause a stacking error (but only a Data Access Violation error). We fix the fault handling logic so such errors are reported as stack overflows and not as generic CPU exceptions. Signed-off-by: Ioannis Glaropoulos <[email protected]>
7aca8ef to
db4372d
Compare
Two fixes here
Issue identified when working on #30028