`wasm32-wasip3` with `flto` traps
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
Research direction
Reproduce the failure with the shown clang command and wasmtime invocation, then compare it with the non-LTO and wasm32-wasip2 builds. Trace the generated out.wasm execution around main and the reported out-of-bounds access; done means the wasm32-wasip3 build with -flto runs without trapping.
Written by the indexing model from the issue text.
Description
Combining wasm32-wasip3 with flto causes a traps.
Given this simple code:
#include <stdio.h>
int main(int argc, char **argv) {
printf("hello world\n");
return 0;
}
Compiled with
$WASI_SDK_PATH/bin/clang --target=wasm32-wasip3 -flto main.c -o out.wasm
And run with wasmtime:
wasmtime run out.wasm
Gives the following crash:
Error: failed to run main module `out.wasm`
Caused by:
0: error while executing at wasm backtrace:
0: 0xe3c - out.wasm!main
1: 0xfdd - out.wasm!__main_void
2: 0xdd0 - out.wasm!_start
3: 0x6963c - <unknown>!<wasm function 15>
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information
1: memory fault at wasm address 0xfffffffc in linear memory of size 0x20000
2: wasm trap: out of bounds memory access
When removing -flto or changing to wasm32-wasip2 the resulting wasm binary runs just fine.
- Dominant language
- CMake
- Stars
- 1.7k
- Forks
- 242
- Avg merge
- 7h 43m
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from WebAssembly/wasi-sdk
-
`sprintf`, `snprintf` pull in `fd_close`, `fd_seek`, `fd_write` despite no stdin/stdout/stderr usagePossibly taken @jeremy-code claimed this 6 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 54/100
WebAssembly/wasi-sdk#666 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
WebAssembly/wasi-sdk#639 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
WebAssembly/wasi-sdk#638 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
WebAssembly/wasi-sdk#629 · 2 comments · 2 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
WebAssembly/wasi-sdk#588 · 1 comment ·
All issues in WebAssembly/wasi-sdk
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
DAE2 crashes on call.without.effects with a non ref.func expressionPossibly taken @stevenfontanella claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
WebAssembly/binaryen#9404 ·
Maintainers usually reply within 1 day
-
area:compiler effort:S impact:med platform:windows type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
area:Analysis enhancement
Difficulty 1/5 1-3 hours Newbie friendliness 69/100
facebookresearch/atlas-lean#5118 ·
Maintainers usually reply within 1 day
-
C-bugfix
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Quantinuum/hugr#3354 ·
Maintainers usually reply within 1 day