WebAssembly / WebAssembly/wasi-libc
sbrk only works for limited inputs
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1k
- Forks
- 251
- Avg merge
- 7h 15m
- Merged PRs (30d)
- 3
Description
sbrk implementation in wasi-libc assumes the input is aligned to 64KB, and doesn't support negative inputs.
Presumably this is sufficient for malloc implementation, but I'm not sure this is conformant (I don't see any restrictions on the alignment of the increment value mentioned in sbrk man page), and this is a problem for cases when sbrk is used directly (which is very valuable in Wasm because it allows to avoid the size overhead of malloc, which - especially in the dlmalloc case - is very significant).
Would it be possible to support sbrk() for arbitrary inputs? Emscripten does this.
Contributor guide
No contributing guide indexed for this repository
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 at the wasi-libc sbrk implementation and inspect how it handles 64KB alignment and increment direction. Compare the behavior with the sbrk contract and Emscripten's implementation, then verify that arbitrary positive and negative inputs work without breaking the existing malloc use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, wasm
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100