Skip to content
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

ARM: Cortex-M: Fixing Context Stacking Error Reporting #25609

Merged

Conversation

ioannisg
Copy link
Member

@ioannisg ioannisg commented May 26, 2020

  • Fix the logic in IS_MPU_GUARD_VIOLATION macro
  • Add a CortexM-specific test case to verify the behavior

Fixes #25612

It is possible that MMFAR address is not written by the
Cortex-M core; this occurs when the stacking error is
not accompanied by a data access violation error (i.e.
when stack overflows due to the exception entry frame
stacking): z_check_thread_stack_fail() shall be able to
handle the case of 'mmfar' holding the -EINVAL value.

Add this node in mem_manage_fault() function to clarify
that it is valid for z_check_thread_stack_fail() to be
called with invalid mmfar address value.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
@ioannisg ioannisg changed the title Arch arm mpu guard fixes ARM: Cortex-M: Fixing Stacking Error Reporting May 26, 2020
@ioannisg ioannisg changed the title ARM: Cortex-M: Fixing Stacking Error Reporting ARM: Cortex-M: Fixing Context Stacking Error Reporting May 26, 2020
@zephyrbot zephyrbot added area: ARM ARM (32-bit) Architecture area: Tests Issues related to a particular existing or missing test labels May 26, 2020
@zephyrbot
Copy link
Collaborator

zephyrbot commented May 26, 2020

All checks passed.

Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages.

@ioannisg ioannisg force-pushed the arch_arm_mpu_guard_fixes branch from 02a895a to 5cfff97 Compare May 26, 2020 07:18
@ioannisg ioannisg added area: Memory Protection bug The issue is a bug, or the PR is fixing a bug labels May 26, 2020
We add a test case to verify that the Cortex-M fault
handling is able to catch stacking errors explicitly
due to exception entry frame stacking (that is, when
the Cortex-M MCU does not report Data Access Violation
MemManage fault with a valid MMFAR value, but only a
Stacking MemManage fault). We update the README file
accordingly.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
@ioannisg ioannisg force-pushed the arch_arm_mpu_guard_fixes branch from 5cfff97 to 630f698 Compare May 26, 2020 07:28
ioannisg added 2 commits May 26, 2020 12:20
Enhance the sample console output of the arm_interrupt
test, to reflect recent changes in test context as well
as kernel fault handling log output format.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
We fix (by inverting) the logic of the IS_MPU_GUARD_VIOLATION
macro, with respect to the value of the supplied 'fault_addr'.
We shall only be inspecting the fault_addr value if it is not
set to -EINVAL.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
@ioannisg ioannisg force-pushed the arch_arm_mpu_guard_fixes branch from 600e8b5 to bbd3e9a Compare May 26, 2020 10:21
@ioannisg ioannisg added this to the v2.3.0 milestone May 26, 2020
@ioannisg ioannisg marked this pull request as ready for review May 26, 2020 10:22
@ioannisg ioannisg requested a review from carlescufi May 26, 2020 10:22
@carlescufi carlescufi requested a review from andrewboie May 26, 2020 19:48
@stephanosio stephanosio dismissed their stale review May 27, 2020 01:05

misunderstanding

@carlescufi carlescufi merged commit 6b54958 into zephyrproject-rtos:master May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ARM ARM (32-bit) Architecture area: Memory Protection area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ARM: Cortex-M: CPU is not reporting Explicit MemManage Stacking Errors correctly
6 participants