Skip to content

Preserve siginfo on HVC #9 faults#180

Merged
jserv merged 1 commit into
sysprog21:mainfrom
Max042004:fix-hvc9-siginfo-delivery
Jul 10, 2026
Merged

Preserve siginfo on HVC #9 faults#180
jserv merged 1 commit into
sysprog21:mainfrom
Max042004:fix-hvc9-siginfo-delivery

Conversation

@Max042004

@Max042004 Max042004 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Honor X8==2 after HVC Honor futex_waitv clockid and wake without polling #9 instruction and data abort returns so delivered SIGSEGV frames are not overwritten.
  • Clear X8 after successful W^X toggles to avoid stale guest state selecting the drop-frame path.
  • Update signal delivery comments for the shared marker contract.

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

  • make elfuse
  • make test-rosetta-audit
  • build/elfuse build/test-signal
  • build/elfuse build/test-fault-signal-mt

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.

Review in cubic

@Max042004 Max042004 changed the title [codex] Preserve siginfo on HVC #9 faults Preserve siginfo on HVC #9 faults Jul 9, 2026
@Max042004 Max042004 marked this pull request as ready for review July 9, 2026 06:15
cubic-dev-ai[bot]

This comment was marked as resolved.

@Max042004 Max042004 force-pushed the fix-hvc9-siginfo-delivery branch from 87ab7ff to 04edef5 Compare July 9, 2026 06:22
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.
@Max042004 Max042004 force-pushed the fix-hvc9-siginfo-delivery branch from 04edef5 to 2bb6256 Compare July 9, 2026 06:26
@jserv jserv merged commit c37a0e5 into sysprog21:main Jul 10, 2026
9 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.

2 participants