WebAssembly / WebAssembly/binaryen
Asyncify "OOM" leaves broken state
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 69
Description
Right now, emitted Asyncify unwind/rewind mechanisms always stores all the variables while unwinding, and only performs bound checks in points like asyncify_stop_unwind when memory outside of bounds is already corrupted.
This leaves module in a broken state: even if you catch & handle the original error, calling into other exports after this point can result in all sorts of broken behaviour.
A better solution would be to perform bound checks right before storing the locals - their size is known in advance, so such condition should be fairly simple and wouldn't add any noticeable overhead, but would improve reliability a lot.
cc @kripken thoughts?
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 tracing the emitted Asyncify unwind/rewind mechanisms and the existing bound checks at points such as asyncify_stop_unwind. Verify how much local storage is required before unwinding, then confirm that an out-of-bounds condition is handled before locals are stored and that the module remains usable after the original error is caught.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100