Skip to content

Conversation

@Sonicadvance1
Copy link
Member

Fixes crash in thunks that use callbacks, introduced in #5148.

The dispatcher would call the syscallhandler to get the VDSO thunk callback. But due to reordering initialization, the VDSO thunk would have not been loaded at that point. This would cause thunks that use callbacks to crash with a nullptr exception.

Instead, defer the thunk callback pointer loading until the thread starts executing, and load the pointer in to our thread state's pointer struct instead.

Didn't get caught in my initial test sweep since I didn't run a Wine game with thunks.

Fixes crash in thunks that use callbacks, introduced in FEX-Emu#5148.

The dispatcher would call the syscallhandler to get the VDSO thunk
callback. But due to reordering initialization, the VDSO thunk would
have not been loaded at that point. This would cause thunks that use
callbacks to crash with a nullptr exception.

Instead, defer the thunk callback pointer loading until the thread
starts executing, and load the pointer in to our thread state's pointer
struct instead.

Didn't get caught in my initial test sweep since I didn't run a Wine
game with thunks.
@lioncash
Copy link
Contributor

lioncash commented Jan 7, 2026

Seems like instcountci needs to be updated

@lioncash
Copy link
Contributor

lioncash commented Jan 7, 2026

Oh, nvm, sent the comment right as the PR was updated

@lioncash lioncash merged commit 5627ddf into FEX-Emu:main Jan 7, 2026
13 checks passed
@Sonicadvance1 Sonicadvance1 deleted the 42 branch January 7, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants