F4.7: endurecimiento de memoria — política W^X (exec-never) MPU#85
Merged
Conversation
…es MPU
- W^X: toda región MPU escribible se marca exec-never (bit XN del RASR), de modo
que ninguna región es a la vez escribible y ejecutable. El código vive SOLO en
flash (RX, write-never):
* SDRAM (heap): + XN
* KERNEL_RAM (data/bss/stacks): + XN
* APP_STACK (stack userland, app_region_for): + XN — userland no puede
ejecutar shellcode depositado en su propia pila.
(periféricos y stack-guard ya eran XN; flash es RX.)
- Auditoría de regiones MPU: nueva `mpu::audit_wx(&mut MPU)` que relee RASR de
las 8 regiones y verifica la invariante W^X (escribible ⇒ exec-never),
devolviendo bool. Reexportada como `mpu_audit_wx`. Defensa en profundidad:
detecta una regresión de atributos antes de exponer la superficie a userland.
- Ejemplos F407/F769: auditan W^X tras `platform_init` y lo registran
("W^X audit: PASS"). Detección de stack overflow ya cubierta por STACK_GUARD.
Validado RTT: F769 y F407 "W^X audit: PASS", todos los selftests PASS, kernel
estable, churn fault/respawn + safe-mode sin regresión (marcar la RAM exec-never
no rompe nada: el kernel ejecuta solo desde flash). host-tests 29 OK.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumen
mpu::audit_wx(reexportmpu_audit_wx) que relee RASR de las 8 regiones y verifica la invariante W^X en runtime; defensa en profundidad. Los ejemplos la registran al boot ("W^X audit: PASS").Validación
Test plan
🤖 Generated with Claude Code