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

Pass actual stack pointers around instead of address 8 #2249

Merged
merged 2 commits into from
Jul 23, 2020

Conversation

alexcrichton
Copy link
Contributor

This commit updates the implementation of passing return pointers from
JS to wasm to actually modify the wasm's shadow stack pointer instead of
manufacturing the arbitrary address of 8. The purpose of this is to
correctly handle threaded scenarios where each thread will write to its
own area instead of everyone trying to compete at address 8.

The implementation here will lazily, if necessary, export the stack
pointer we find the module and modify it as necessary.

Closes #2218

This commit updates the implementation of passing return pointers from
JS to wasm to actually modify the wasm's shadow stack pointer instead of
manufacturing the arbitrary address of 8. The purpose of this is to
correctly handle threaded scenarios where each thread will write to its
own area instead of everyone trying to compete at address 8.

The implementation here will lazily, if necessary, export the stack
pointer we find the module and modify it as necessary.

Closes rustwasm#2218
@alexcrichton alexcrichton requested a review from fitzgen July 22, 2020 18:42
@alexcrichton alexcrichton force-pushed the fix-threaded-sp branch 3 times, most recently from 0157bf6 to e8a2af2 Compare July 23, 2020 18:03
@alexcrichton alexcrichton merged commit 60f3b1d into rustwasm:master Jul 23, 2020
@alexcrichton alexcrichton deleted the fix-threaded-sp branch July 23, 2020 18:21
@d3lm
Copy link
Contributor

d3lm commented Jul 27, 2020

Ah, this is awesome! Thanks @alexcrichton for implementing this. I totally did not get around it and had too much on my plate. Sorry I couldn't get involved earlier and work on a PR.

When do you cut the next version of wasm-bindgen that includes this fix?

@alexcrichton
Copy link
Contributor Author

No worries!

I basically do releases when requested, no schedule currently. Would you like a release to be made?

@d3lm
Copy link
Contributor

d3lm commented Jul 28, 2020

Yep, that would be amazing, so I could bumped the version in my project and make sure the js binding is thread safe.

@alexcrichton
Copy link
Contributor Author

Ok, I'm doing the bump at #2256

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.

Generated JS binding is not thread-safe
3 participants