Preserve siginfo on HVC #9 faults#180
Merged
Merged
Conversation
87ab7ff to
04edef5
Compare
The HVC 9 W^X path can fall back to SIGSEGV when the fault is not a legitimate permission toggle. signal_deliver_fault() installs the SA_SIGINFO handler registers and marks X8=2, but the shim always ran the W^X retry epilogue and restored the saved fault frame over them. Teach both HVC 9 return sites to honor the existing frame-drop marker, and clear X8 after successful W^X toggles so stale guest state cannot select that path.
04edef5 to
2bb6256
Compare
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
Root Cause
HVC #9 always returned through the W^X TLBI/retry epilogue. When the host side decided the fault was not a W^X toggle and delivered SIGSEGV instead, that epilogue restored the pre-HVC register frame over the SA_SIGINFO handler arguments installed by signal_deliver_fault().
Validation
Skipped: make test-rosetta-jit because the x86_64 Luajit fixture is missing at externals/test-fixtures/x86_64-musl/rootfs/usr/bin/luajit.
Summary by cubic
Fixes corrupted SIGSEGV delivery after HVC #9 faults by preserving SA_SIGINFO frames. The shim now honors X8==2 on return at both abort paths, and the host clears X8 after successful W^X toggles.
Written for commit 2bb6256. Summary will update on new commits.