testing/sig_sp_test: add test for SP context restore on signal return#3536
Open
cshung wants to merge 1 commit into
Open
testing/sig_sp_test: add test for SP context restore on signal return#3536cshung wants to merge 1 commit into
cshung wants to merge 1 commit into
Conversation
Add a test that verifies modifying SP (REG_R13) in the saved register context is honored on signal return. The test pushes values onto the stack, triggers SIGALRM, and in the handler advances SP to skip a value, then verifies the correct value is popped after signal return. This exercises the SP relocation fix in arm_sigdeliver.c for ARMv7-M and ARMv8-M architectures. Signed-off-by: Andrew Au <cshung@gmail.com>
8a1ed41 to
4760baa
Compare
xiaoxiang781216
approved these changes
Jun 19, 2026
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.
Summary
Add a test application that verifies modifying
REG_R13(SP) in saved register context during a signal handler is honored on exception return.Test scenario (simulates a managed runtime unwinding past a trampoline):
SIGALRM(async delivery from timer interrupt)This exercises the HW exception frame relocation fix in
arm_exception.S.Dependencies:
CONFIG_ARMV7M_SP_CONTEXT_RESTORE=yorCONFIG_ARMV8M_SP_CONTEXT_RESTORE=yBUILD_FLAT) — accessesnxsched_self()forsaved_regsCompanion OS fix PR: apache/nuttx#19123
Impact
Testing
Host: Ubuntu 22.04 x86_64, arm-none-eabi-gcc 13.3, QEMU 8.2.2 (via Docker)
Targets tested:
lm3s6965-ek:qemu-flat(ARMv7-M, Cortex-M3)mps2-an521:nsh(ARMv8-M, Cortex-M33)Test log (ARMv7-M):
Test log (ARMv8-M):
Sanity check (without SP adjustment in handler):