Return true after queueing a guest syscall override - #211
Closed
Sinan-Karakaya wants to merge 1 commit into
Closed
Conversation
dispatchSyscallOverride returns bool, and its caller uses that to decide whether the built-in handler still needs to run. The success path -- the one that actually queues the guest's handler as an invocation -- fell off the end of the function without returning. That is undefined behaviour, and the practical failure mode is bad: whatever happened to be in the return register decided whether the built-in syscall ran in addition to the guest's override, so a game that overrides a syscall could get the effect applied twice, or not at all, depending on the build. (cherry picked from commit 6bf1feff8bd38892f1a464322f455fe016814c5c)
Sinan-Karakaya
force-pushed
the
fix/syscall-override-return
branch
from
August 18, 2026 09:25
32c182a to
8dc8b54
Compare
ran-j
requested changes
Aug 18, 2026
| parent.r[2] = completed.r[2]; | ||
| }; | ||
| scheduler.invokeCurrent(std::move(invocation)); | ||
| // The invocation is queued and the caller must not fall through to the |
Owner
There was a problem hiding this comment.
Nice, I think I remove the return when I has moving the code, can you remove this comments
Owner
There was a problem hiding this comment.
waitttt. I remenber now.
look at invokeCurrent its a [[noreturn]] so your return true; is unreachable
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.
dispatchSyscallOverridereturnsbool, and its caller uses that to decide whether the built-in handler still needs to run. The success path, the one that actually queues the guest's handler as an invocation falls off the end of the function without returning.That is undefined behaviour, and the practical failure mode is unpleasant: whatever happens to be in the return register decides whether the built-in syscall runs in addition to the guest's override. A game that overrides a syscall can get the effect applied twice, or not at all, depending on the build.
One-line fix.