Skip to content

[lightbeam] panic due to unreachable! in backend.rs  #674

Closed
@pventuzelo

Description

@pventuzelo

Issue description

wasmtime with lightbeam backend panic due to an unreachable!. This issue will make program calling lightbeam as 3rd party library to crash. Instead an error should be through to let the caller handle it properly.

Reproduction

wasmtime commit: 3558d41

Compilation with debug info:

$ RUSTFLAGS=-g cargo build --release --features lightbeam

Download & run testcase:
panic_internal_unreachable_code.zip

$ unzip panic_internal_unreachable_code.zip
$ ./target/release/wasmtime --lightbeam panic_internal_unreachable_code.wasm
thread 'main' panicked at 'internal error: entered unreachable code', crates/lightbeam/src/backend.rs:3559:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Related piece of code

lightbeam panics because of a calling to unreachable! macro.

}
_ => unreachable!(),
}

Fix proposal

After applying the pull request 672, wasmtime will return:

$ ./target/release/wasmtime --lightbeam panic_internal_unreachable_code.wasm
Error: failed to process main module `panic_internal_unreachable_code.wasm`

Caused by:
    0: WebAssembly failed to compile
    1: Compilation error: Failed to translate function: Microwasm error: i32_extend_s unreachable code

Metadata

Metadata

Assignees

No one assigned

    Labels

    fuzz-bugBugs found by a fuzzerlightbeamIssues related to the Lightbeam compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions