Repository navigation
Fix guest register recovery at restarted host syscalls - #7
Merged
Merged
Conversation
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.
Recovering a restarted host syscall could corrupt AArch64 X1 and X5 with the host RCX/R11 values. Under l4h, the syscall-register reproducer observes X1 become
0x40000040(the dispatcher address) or the host syscall return address, and X5 become x86 flags. This explains the vector stress test's write fault at0x40000040and the intermittent futex failures.The miss, chain, helper and SVC stubs have already spilled all guest registers before issuing the host syscall, but recovery still classified that region as pinned registers being live. Make the saved page authoritative immediately after the spill. Pending SVCs retain their PC rewind through
STUB_PAGE_STATE_SVC.Add a deterministic regression for clobbered host registers at each stub boundary, plus a four-thread AArch64 syscall preservation test in the VM smoke suite. The fix is generic; it adds no l4h architecture dependencies.
Validation:
3dbb1a0.kemu.stress=1, the ABI suite, 400,000 syscall iterations under signals, and 100 consecutive runs of the originalkemu-vectorstest pass.kemu.stress=1 kemu.jitoff=64: another 400,000 syscall iterations and 100 vector runs.