Skip to content

Fix guest register recovery at restarted host syscalls - #7

Merged
losfair merged 1 commit into
mainfrom
fix/vector-segfault
Oct 25, 2026
Merged

losfair merged 1 commit into
mainfrom
fix/vector-segfault

Conversation

@losfair

@losfair losfair commented Oct 25, 2026

Copy link
Copy Markdown
Owner

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 at 0x40000040 and 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:

  • Both the unit regression and the guest syscall test fail without the fix. The latter corrupts registers in all four threads on kemu 3dbb1a0.
  • 34 core unit tests pass; 10,000 JIT differential cases pass with 1,651 asynchronous recoveries.
  • l4h guest build passes. With kemu.stress=1, the ABI suite, 400,000 syscall iterations under signals, and 100 consecutive runs of the original kemu-vectors test pass.
  • The same l4h checks pass with kemu.stress=1 kemu.jitoff=64: another 400,000 syscall iterations and 100 vector runs.
  • The new syscall test also passes under QEMU AArch64.

@losfair
losfair merged commit 96271af into main Oct 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant