WebAssembly / WebAssembly/binaryen
StackCheck pass can do that wrong thing when no stack pointer is present
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 69
Description
I notices a strange failure on HEAD with a test that I guess we don't run anywhere: ./test/runner core2ss.test_pthread_dylink_tls .
The problem is with -sSTACK_OVERFLOW_CHECK which runs that StackCheck check pass, which depends on being able to find the stack pointer global (__stack_pointer), but in this case the side module its being run on doesn't contain any stack usage and so it simply doesn't have a __stack_pointer global. The StackCheck pass then assumes that the first imported global is that stack pointer (but in fact its env.__memory_base).. and then it fails the stack check during __wasm_init_memory when it first reads this global.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running ./test/runner core2ss.test_pthread_dylink_tls with -sSTACK_OVERFLOW_CHECK and inspect the StackCheck pass behavior for a side module without a __stack_pointer global. Done means the test no longer treats env.__memory_base as the stack pointer and the stack check does not fail during __wasm_init_memory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100