Stream: git-wasmtime

Topic: wasmtime / issue #837 [lightbeam] remainder overflow in d...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 27 2021 at 17:30):

alexcrichton commented on issue #837:

Lightbeam was removed in https://github.com/bytecodealliance/wasmtime/pull/3390 as explained in RFC 14, so I'm going to close this.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 27 2021 at 17:30):

alexcrichton closed issue #837:

Issue description

lightbeam will try to calculate the remainder even if an overflow occurs in the function rem_s.

$ ./debug_diff_compile panic_remainder_overflow_868_2.wasm
thread 'main' panicked at 'attempt to calculate the remainder with overflow', XXX/wasmtime/crates/lightbeam/src/backend.rs:868:56
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

This issue is related to the function rem_s when dealing with the i32.rem_s opcode:

https://github.com/bytecodealliance/wasmtime/blob/420dcd76fd0d684291901c7a6afeb481481dea7e/crates/lightbeam/src/backend.rs#L867-L869

I suspect this issue can also occurs in rem_u:

https://github.com/bytecodealliance/wasmtime/blob/420dcd76fd0d684291901c7a6afeb481481dea7e/crates/lightbeam/src/backend.rs#L826-L829

Reproduction

Download
panic_remainder_overflow_868.zip

(module
  (type (;0;) (func (result i32)))
  (func (;0;) (type 0) (result i32)
    i32.const -2147483648
    i32.const -1
    i32.rem_s
    unreachable))

wasmtime commit: 7890fa670547578f549a5e4e5d0f69788bed96cf


Last updated: Nov 22 2024 at 16:03 UTC