Skip to content

Fix/improve stack pointer detection#4036

Merged
daxpedda merged 1 commit intowasm-bindgen:mainfrom
daxpedda:stack-pointer
Aug 1, 2024
Merged

Fix/improve stack pointer detection#4036
daxpedda merged 1 commit intowasm-bindgen:mainfrom
daxpedda:stack-pointer

Conversation

@daxpedda
Copy link
Copy Markdown
Member

@daxpedda daxpedda commented Aug 1, 2024

Stack pointer detection war currently done by finding the one global that is an i32 and initialized to a non-zero.
This is unreliable, as encountered in #3995, in the worst case scenario this could lead to some pretty bad undefined behavior.
This PR tries to find the stack pointer by name first, __stack_pointer, before falling back to the old method.

Additionally, I renamed all instances of "shadow stack" to just "stack", as this was inaccurate and was previously meant to describe the fact that Wasm basically has two stacks: the user-managed stack inside the Wasm module and the other stack belonging to the Wasm engine.

@daxpedda daxpedda merged commit a4e5450 into wasm-bindgen:main Aug 1, 2024
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.

1 participant