Skip to content
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

Error: failed to run main module when executing WebAssembly module processed with wasm-opt --remove-memory in wasm runtime #6442

Closed
Uh5GoKGJ9X opened this issue Mar 26, 2024 · 2 comments

Comments

@Uh5GoKGJ9X
Copy link

Hello,
I attempted to process a file test.wasm using wasm-opt with --remove-memory option, which generated test.opt.wasm. When trying to execute it in the wasmtime runtime, I encountered the following error:

$ wasmtime ./test.wasm
16871285034349708082

$ wasm-opt ./test.wasm --remove-memory -o ./test.opt.wasm
$ wasmtime ./test.opt.wasm
Error: failed to run main module `./test.opt.wasm`
Caused by:
    0: failed to invoke command default
    1: error while executing at wasm backtrace:
           0: 0xb6 - <unknown>!<wasm function 7>
           1: 0xc3 - <unknown>!<wasm function 6>
           2: 0xcb - <unknown>!<wasm function 8>
    2: memory fault at wasm address 0xfffffffa in linear memory of size 0x80000
    3: wasm trap: out of bounds memory access

Environment Information:

wasm-opt version:

wasm-opt version 117 (version_117-31-g6e8fefe1e)

wasmtime version:

wasmtime-cli 18.0.3 (ff528a2ba 2024-03-12)

Operating System:

Ubuntu 20.04.6 LTS

@kripken
Copy link
Member

kripken commented Mar 26, 2024

That looks like the expected behavior. The wasm module is doing a store to address $2 = $0 - $1 = 0 - 6 = -6 which is a very large unsigned number, well beyond the Memory which is just 8 pages of 64K.

@kripken
Copy link
Member

kripken commented Mar 26, 2024

(--remove-memory does not affect this, as it only removes memory segments, and there are none)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants