Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arm64: Fixes a race condition on syscall spilling SRA #2420

Merged
merged 1 commit into from
Feb 20, 2023

Conversation

Sonicadvance1
Copy link
Member

When executing a non-inlined syscall, we spill all static registers. We weren't storing in to the thread context that we have done this. If a signal occured between FEX returning from the syscall (after the blr) and before the FillStaticRegs then the signal handler would get the incorrect register state.

This typically manifested as Steam getting a SIGCHLD, trying to recover the guest stack pointer, and it that pointer would be zero or some other corrupt value. Thus crashing inside of the signal handler.

Surprising that we hadn't hit this way more before this point, must have needed hardware that tickled the race condition just right.

When executing a non-inlined syscall, we spill all static registers.
We weren't storing in to the thread context that we have done this.
If a signal occured between FEX returning from the syscall (after the
blr) and before the `FillStaticRegs` then the signal handler would get
the incorrect register state.

This typically manifested as Steam getting a SIGCHLD, trying to recover
the guest stack pointer, and it that pointer would be zero or some other
corrupt value. Thus crashing inside of the signal handler.

Surprising that we hadn't hit this way more before this point, must have
needed hardware that tickled the race condition *just* right.
@lioncash lioncash merged commit f6e2fe1 into FEX-Emu:main Feb 20, 2023
@Sonicadvance1 Sonicadvance1 deleted the fix_syscall_race branch February 20, 2023 22:54
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