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

Fix/improve stack pointer detection #4036

Merged
merged 1 commit into from
Aug 1, 2024
Merged

Conversation

daxpedda
Copy link
Collaborator

@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 rustwasm:main Aug 1, 2024
25 checks passed
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