-
Notifications
You must be signed in to change notification settings - Fork 7.5k
ARM NXP hardware stack overflows do not report _NANO_ERR_STACK_CHK_FAIL or provide MPU fault information #7706
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
Comments
An errant commit accidentally disabled all testing of hardware-based stack protection. Restore it, and work around a problem with how these kinds of exceptions are reported on ARM until #7706 is fixed. Signed-off-by: Andrew Boie <[email protected]>
An errant commit accidentally disabled all testing of hardware-based stack protection. Restore it, and work around a problem with how these kinds of exceptions are reported on ARM until #7706 is fixed. We need to globally disable user mode due to how the select statements in Kconfig work, the stack sentinel is incompatible with user mode. Some build warnings when compiling as native_posix fixed. Signed-off-by: Andrew Boie <[email protected]>
per @MaureenHelm this may be specific to the NXP MPU |
The NXP MPU throws a bus fault on an access violation, whereas the ARM MPU throws a MemManage fault. Running this test on the mimxrt1050_evk board, which has the ARM MPU, gives the result:
|
An errant commit accidentally disabled all testing of hardware-based stack protection. Restore it, and work around a problem with how these kinds of exceptions are reported on ARM until zephyrproject-rtos#7706 is fixed. We need to globally disable user mode due to how the select statements in Kconfig work, the stack sentinel is incompatible with user mode. Some build warnings when compiling as native_posix fixed. Signed-off-by: Andrew Boie <[email protected]>
An errant commit accidentally disabled all testing of hardware-based stack protection. Restore it, and work around a problem with how these kinds of exceptions are reported on ARM until #7706 is fixed. We need to globally disable user mode due to how the select statements in Kconfig work, the stack sentinel is incompatible with user mode. Some build warnings when compiling as native_posix fixed. Signed-off-by: Andrew Boie <[email protected]>
If I understand correctly, @andrewboie , _NANO_ERR_HW_EXCEPTION is the sole error code used in arm's fault.c, so this part of the problem does not look like it is only an NXP issue, right? Looking at @MaureenHelm 's log, "reason" is still 0. |
Right. The NXP-specific issue is @andrewboie 's first bullet about not dumping MPU faults on parts like k64f that have the NXP MPU, because they take a bus fault instead. Parts like i.mx rt1050 that have the ARM MPU do dump MPU faults as expected. In both cases, the reason code is still 0. |
Should we try to get this into 1.14, @MaureenHelm ? I might have some time for that, but only after Friday (bu that is ok for bug fixes, right?) |
we have plenty of time to address bug fixes for the LTS |
we tripped over this again in #13166 |
This commit does the following: - Refactors the Stack Corruption reporting in ARM platforms, by moving the evaluation of stack corruption out of the fault.c file. - Fixes the issue of NXP_MPU-based platforms not reporting stack corruption failures properly. - Modify the #ifdef guards around ARMv8-M stack overflow capturing in UsageFault handler, so the BUILTIN_STACK_GUARD macro is used instead of the (generic) HW_STACK_PROTETION. Fixes zephyrproject-rtos#7706 Signed-off-by: Ioannis Glaropoulos <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
When stack guard pages are enabled and a thread overflows its stack, the error reported is as follows, causing tests/kernel/fatal to work improperly:
Reason code 0 is _NANO_ERR_CPU_EXCEPTION, the expected code of 2 is _NANO_ERR_STACK_CHK_FAIL.
I reproduced this on frdm_k64f.
We need to fix this:
I'm committing a FIXME workaround to the fatal test until this is fixed.
The text was updated successfully, but these errors were encountered: