Skip to content

Return true after queueing a guest syscall override - #211

Closed
Sinan-Karakaya wants to merge 1 commit into
ran-j:mainfrom
Sinan-Karakaya:fix/syscall-override-return
Closed

Return true after queueing a guest syscall override#211
Sinan-Karakaya wants to merge 1 commit into
ran-j:mainfrom
Sinan-Karakaya:fix/syscall-override-return

Conversation

@Sinan-Karakaya

@Sinan-Karakaya Sinan-Karakaya commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

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 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.

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
Sinan-Karakaya force-pushed the fix/syscall-override-return branch from 32c182a to 8dc8b54 Compare August 18, 2026 09:25
parent.r[2] = completed.r[2];
};
scheduler.invokeCurrent(std::move(invocation));
// The invocation is queued and the caller must not fall through to the

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I think I remove the return when I has moving the code, can you remove this comments

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waitttt. I remenber now.

look at invokeCurrent its a [[noreturn]] so your return true; is unreachable

@ran-j ran-j closed this Aug 18, 2026
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