Skip to content

tests: drivers: reset: mmio: keep the fake registers out of kernel RAM - #116545

Merged
kartben merged 1 commit into
zephyrproject-rtos:mainfrom
nashif:topic/hotfix/reset_crash
Aug 18, 2026
Merged

tests: drivers: reset: mmio: keep the fake registers out of kernel RAM#116545
kartben merged 1 commit into
zephyrproject-rtos:mainfrom
nashif:topic/hotfix/reset_crash

Conversation

@nashif

@nashif nashif commented Aug 18, 2026

Copy link
Copy Markdown
Member

The qemu_cortex_m3 overlay placed the fake reset-mmio registers at
0x20000004/0x20000008, inside the SRAM the kernel links into. The
words they occupy are owned by whatever .data the linker places at
the start of RAM, so every write through the reset driver corrupts
live kernel state, and the test only ever passed by layout luck.

A recent timer-core change added an 8-byte .data variable that landed
at 0x20000000, which pushed libc's _char_out console output function
pointer to exactly 0x20000008: the active-low test case then wrote
its register patterns over the pointer, console output jumped through
the corrupted value into a HardFault, the fault handler's own print
re-took the fault, and QEMU stopped with "Lockup: can't escalate 3 to
HardFault". Any future .data layout change could break this test the
same way.

Shrink the kernel's view of the 64 KiB SRAM by one KiB in the overlay
and move the fake registers into the carved-out tail, so no linker
layout can ever place kernel data under them.

@nashif nashif added the Hotfix Fix for issues blocking development, i.e. upstream CI issues, tests failing in upstream CI , etc. label Aug 18, 2026
@zephyrbot zephyrbot added area: Reset area: Tests Issues related to a particular existing or missing test labels Aug 18, 2026
@nashif
nashif force-pushed the topic/hotfix/reset_crash branch from 38d9ce2 to b140b73 Compare August 18, 2026 00:36
The qemu_cortex_m3 overlay placed the fake reset-mmio registers at
0x20000004/0x20000008, inside the SRAM the kernel links into. The
words they occupy are owned by whatever .data the linker places at
the start of RAM, so every write through the reset driver corrupts
live kernel state, and the test only ever passed by layout luck.

A recent timer-core change added an 8-byte .data variable that landed
at 0x20000000, which pushed libc's _char_out console output function
pointer to exactly 0x20000008: the active-low test case then wrote
its register patterns over the pointer, console output jumped through
the corrupted value into a HardFault, the fault handler's own print
re-took the fault, and QEMU stopped with "Lockup: can't escalate 3 to
HardFault". Any future .data layout change could break this test the
same way.

Shrink the kernel's view of the 64 KiB SRAM by one KiB in the overlay
and move the fake registers into the carved-out tail, so no linker
layout can ever place kernel data under them.

Assisted by Claude (claude-opus-4-8).
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
@nashif
nashif force-pushed the topic/hotfix/reset_crash branch from b140b73 to 9b66b51 Compare August 18, 2026 00:36
@nashif
nashif requested a review from a team August 18, 2026 03:26
@kartben
kartben merged commit 352f20e into zephyrproject-rtos:main Aug 18, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Reset area: Tests Issues related to a particular existing or missing test Hotfix Fix for issues blocking development, i.e. upstream CI issues, tests failing in upstream CI , etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants