soc: renesas: rcar_gen5: R52 MPU regions break userspace (kernel.memory_protection fails)
Author: vinhdaowrCreated Sep 27, 2026Updated Sep 27, 2026
Labelspriority: lowplatform: Renesas
Describe the bug
On rcar_ironhide_x5h/r8a78000/r52, the static MPU configuration in soc/renesas/rcar/rcar_gen5/r52/mpu_regions.c maps the whole chosen SRAM (sram0, 0x10200000) as a single region with privileged read/write, unprivileged no access, and execute permission.
The SoC selects ARM_MPU, so CONFIG_ARCH_HAS_USERSPACE is enabled and userspace tests are built for this platform. With this configuration:
- Unprivileged threads cannot fetch instructions from kernel
.textor read.rodata, so every user-mode thread takes a prefetch abort (permission fault) on its first instruction. - Kernel text and rodata are writable, and data, BSS, stacks and heap are executable. There is no W^X separation.
As a result, tests/kernel/mem_protect/mem_protect fails at the first test case that enters user mode (test_permission_inheritance).
Regression
- This is a regression.
Steps to reproduce
west build -p always -b rcar_ironhide_x5h/r8a78000/r52 tests/kernel/mem_protect/mem_protect/- Flash the image.
test_inherit_resource_poolpasses (supervisor mode only).test_permission_inheritance, the first case that enters user mode, fails with a prefetch abort.
Relevant log output
Running TESTSUITE mem_protect
===================================================================
START - test_inherit_resource_pool
PASS - test_inherit_resource_pool in 0.001 seconds
===================================================================
START - test_permission_inheritance
E: ***** PREFETCH ABORT *****
E: Permission Fault @ 0x10206a00
E: r0/a1: 0x10201444 r1/a2: 0x00000000 r2/a3: 0x00000000
E: r3/a4: 0x00000000 r12/ip: 0x00000001 r14/lr: 0x10201444
E: xpsr: 0x60000110
E: Faulting instruction address (r15/pc): 0x10206a00
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x10227ce0 (unknown)
Caught system error -- reason 0 0
fatal error was unexpected, aborting
===================================================================
PROJECT EXECUTION FAILEDImpact
Functional Limitation – Some features not working as expected, but system usable.
Environment
- OS: Windows (WSL2)
- Toolchain: Zephyr SDK v1.0.1
- Commit SHA:
3e7672a71bd954ca46c38c99d8d8f68a0fb23090 - Board:
rcar_ironhide_x5h/r8a78000/r52
Additional Context
No response
Source: zephyrproject-rtos/zephyr