-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wasm module fails with memory bound issue (runs on other runtimes, or when compiled with emscripten) #6695
Comments
Can you clarify more why you think this program should work? The program itself appears to exhibit undefined behavior at the C level as you're allocating an array Given the debugging I'm doing it appears that iwasm or WAMR may not be executing this wasm correctly because it's indeed attempting a store at address 0x20000 which is out-of-bounds for this wasm instance. I'm not sure why WAMR would not be reporting the out-of-bounds. |
Thanks @alexcrichton , changing that line to allocate The reason why I thought the program should work is because it is part of sightglass and when running it there it seems to work with wasmtime, albeit called in a different way than with the cli. The error is in sightglass https://github.com/bytecodealliance/sightglass/blob/04546548e60dcce4b6691f8ddb75442c4d251ad9/benchmarks/shootout-heapsort/benchmark.c#L62 so I should make a pull request to fix it there. |
Ah ok, in that case it seems like this may be compiler differences. Using emcc seems to create a linear memory with an initial and maximum size of 256, but using |
@matsbror, just a heads up: I also ran into this issue when I was working on bytecodealliance/sightglass#260 and ended up fixing it in bytecodealliance/sightglass@8b9855b. Once that PR is merged this should be fixed. |
Test Case
shootout-heapsort.zip
Steps to Reproduce
wasmtime heapsort.wasm
To rebuild the program:
/opt/wasi-sdk/share/wasi-sysroot
Expected Results
I would expect wasmtime to run the program without any errors. It runs well using other runtimes such as iwasm (WAMR). However, wasmer has a similar issue.
Actual Results
Versions and Environment
Wasmtime version or commit:
wasmtime-cli 9.0.3
Operating system: WSL2 Ubuntu-2204, kernel 5.15.90
Architecture: x86-64
Extra Info
Anything else you'd like to add?
If I compile with emscripten instead of regular clang (or the clang included in wasi-sdk), then the resulting webassembly module runs fine also with wasmtime.
The text was updated successfully, but these errors were encountered: