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

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

Closed
pventuzelo opened this issue Dec 5, 2019 · 4 comments
Closed

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

pventuzelo opened this issue Dec 5, 2019 · 4 comments
Labels
fuzz-bug Bugs found by a fuzzer lightbeam Issues related to the Lightbeam compiler

Comments

@pventuzelo
Copy link
Contributor

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
@pventuzelo
Copy link
Contributor Author

@fitzgen can you add fuzz-bug label on this one? Thanks

@fitzgen fitzgen added the fuzz-bug Bugs found by a fuzzer label Dec 10, 2019
@pepyakin pepyakin added the lightbeam Issues related to the Lightbeam compiler label Jan 6, 2020
@pventuzelo
Copy link
Contributor Author

Merged in master.

@eira-fransham
Copy link
Contributor

I'd like to reopen this issue, as it appears to be because ValueLocation::CondCode isn't covered. The correct fix is to support ValueLocation::CondCode, and furthermore to remove all _ => branches from matches in the backend.

@eira-fransham eira-fransham reopened this Feb 10, 2020
@alexcrichton
Copy link
Member

Lightbeam was removed in #3390 as explained in RFC 14, so I'm going to close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fuzz-bug Bugs found by a fuzzer lightbeam Issues related to the Lightbeam compiler
Projects
None yet
Development

No branches or pull requests

5 participants