Skip to content

fix potential speculative access that might trigger bus faults on Cortex-M7 #90305

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

Merged

Conversation

manuargue
Copy link
Member

Due to erratum 1013783-B, speculative accesses might be performed to normal memory unmapped in the MPU. This can be avoided by using MPU region 0 to cover all unmapped memory and make this region execute-never and inaccessible.

Note that this applies for all Cortex-M7 revisions implementing MPU and D-cache, so although the issue was reported for mr_canhubk3 board that implements custom SoC MPU regions, I added the fix for any Cortex-M7 SoC having those features enabled.

Fixes #89852

manuargue and others added 2 commits May 21, 2025 18:19
Due to erratum ERR011573, speculative accesses might be performed
to normal memory unmapped in the MPU. This can be avoided by using
MPU region 0 to cover all unmapped memory and make this region
execute-never and inaccessible.

Fixes zephyrproject-rtos#89852

Co-authored-by: Peter van der Perk <peter.vanderperk@nxp.com>
Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
Due to erratum 1013783-B, speculative accesses might be performed
to normal memory unmapped in the MPU. This can be avoided by using
MPU region 0 to cover all unmapped memory and make this region
execute-never and inaccessible.

Note that this applies when CPU Cortex-M7 implements MPU and D-cache.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
Copy link

@manuargue
Copy link
Member Author

ping @wearyzen @PetervdPerk-NXP

Copy link
Collaborator

@PetervdPerk-NXP PetervdPerk-NXP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

/* Erratum 1013783-B (SDEN-1068427): use first region to prevent speculative access
* in entire memory space
*/
MPU_REGION_ENTRY("BACKGROUND",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "UNMAPPED" would be a better name

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn’t get to address this due to the timezone difference, already merged :)

Copy link
Collaborator

@wearyzen wearyzen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit but rest LGTM, thanks.

@kartben kartben merged commit 983b1d0 into zephyrproject-rtos:main May 29, 2025
34 checks passed
@manuargue manuargue deleted the nxp-k3-fix-speculative-access branch May 29, 2025 22:54
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 platform: NXP S32 NXP Semiconductors, S32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

S32K344 halts after a period of time
6 participants