Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
GH-130397: use __stack_high and __stack_low LLVM WASM attributes#131855
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Signed-off-by: Filipe Laíns <lains@riseup.net>
hoodmane commentedMar 28, 2025
This same approach would also work on emscripten but instead I think we're going the route of making |
| #endif | ||
| #if defined(__wasi__)&_Py__has_attribute(weak) | ||
| extern __attribute__((weak))unsignedchar__stack_high; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This should besize_t, notchar right?
brettcannon commentedApr 4, 2025
CI suggests this isn't enough to fix the issue. Do we need to manually set the stack size, roll back the stack checking changes that are causing the issue, or something else? |
hoodmane commentedApr 4, 2025
I was just looking into this today and I think a big part of the problem is that Not only does it get nowhere close to exhausting the 5mb of shadow stack, the shadow stack pointer only seems to move up/down by about ~4000. I am not sure if you'll get the same results on WASI, but if this is true and not just some measurement artifact, the whole approach to stack checks might not be workable at all. |
mdboom commentedApr 30, 2025
Is that a debug build? Those stack frames are surprisingly small. |
hoodmane commentedApr 30, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I think the shadow stack consists of:
I don't have a good sense for how much any of this stuff happens, but it is entirely possible to run out of true stack space without allocating anything on the shadow stack at all. It's also entirely possible that I was not measuring correctly. |
FFY00 commentedApr 30, 2025
Then maybe we should just turn it off? With all the trouble it's causing right now, it probably isn't worth keeping this mechanism. |
hoodmane commentedApr 30, 2025
Yeah it seems like there is currently no reasonable way to measure the available stack space for wasm runtimes so I'd agree we should turn it off. |
brettcannon commentedJul 25, 2025
At EuroPython we agreed not to worry about blowing the stack for WebAssembly since the hosts will catch that issue and prevent any security concerns. @FFY00 did you still want to pursue this PR or close it? |
FFY00 commentedAug 28, 2025
No, I just wanted to fix the tests. I'll close it. |
Uh oh!
There was an error while loading.Please reload this page.