-
Notifications
You must be signed in to change notification settings - Fork 7.3k
ARM Memory Protection functions not invoked in SWAP for ARMv6/ARMv8-M Baseline #12961
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
Reducing impact to Low, since no issues were reported by the community, and we still do not have Baseline Cortex-M SOCs with MPU in the tree. |
We have tests which are supposed to verify access to memory ... are the tests inadequate to catch this, or were they never run on these platforms? |
@andrewboie there are no Cortex-M Baseline boards/SOCs in the tree with MPU support. |
The Nucleo G071RB from the "Supported Boards" list uses the STM32G071RB, which does have an MPU. This MCU is Cortex M0+ based. From the datasheet: "The memory protection unit (MPU) is used to manage the CPU accesses to memory to I do not know if the "Supported Boards" list is included in the tree referenced here. |
@ioannisg we really need to fix that, what board have you been testing with? |
@andrewboie I agree we should fix that. But we need a Baseline with MPU, and, ideally, with a sufficient number of MPU regions, e.g. 8. @jjmilburn thanks for the info; I will take a look. And I'll need to get a board, as well. |
@jjmilburn how many MPU regions does this CPU have? |
@ioannisg I believe the answer is 8. References: ST Appnote AN4838 indicates up to 16 (although thats inclusive of cores with more capability than the M0+):
See this table for confirmation of the 8 regions on the Cortex M0+ (Table from the same AN4838 linked above): Finally, programming manual PM0223 (specific to the Cortex M0+) indicates:
|
@jjmilburn thanks for your help on this. I've got this platform and will try to finally sort out this issue. |
Thanks! |
Describe the bug
It has, unfortunately, been the case since the very beginning, for example:
ARM swap (
__pend_SV
)) function does not invoke the memory protection functions for the ARMv6-M (and for the latter-added ARMv8-M Baseline) architecture.Since then, all patches have been ignoring this misbehavior.
This is a bug, IMHO, because:
_userspace_enter()
or_switch_to_main_thread()
, the memory protection functions are invoked, for all architectures.To Reproduce
Just browse the swap __pend_SV code and see that context-switch for ARMv6 does not call MPU re-programming functions.
Expected behavior
This behavior needs to be fixed; we need to make swap call mpu functions for ARMv6.
Impact
This is a critical bug, breaking User Mode for ARMv6-M and Stack Overflow Protection. I do not, know, however, if this affect any SOCs in the tree (need to be Cortex-M0+ with ARM MPU support, and I do not think that there is one). Therefore, I am adding Medium priority on this.
Additional context
Either we fix this as proposed, or not allow Memory Protection features on ARMv6-M at all.
The text was updated successfully, but these errors were encountered: