wasm-micro-runtime icon indicating copy to clipboard operation
wasm-micro-runtime copied to clipboard

Crash in fast interpreter

Open erxiaozhou opened this issue 1 year ago • 1 comments
trafficstars

Build commands

I compile the code with commit id 1977ad23efb3b3f2d4ae0ddf49096a05464f488f. Platform: Ubuntu 20.04 CPU: amd64 compile:

export CC=/usr/lib/llvm-16/bin/clang
export CXX=/usr/lib/llvm-16/bin/clang++
cd product-mini/platforms/linux/;rm -rf build
cmake  -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_SIMD=1 -DWASM_ENABLE_BULK_MEMORY=1 -DWAMR_BUILD_AOT=0 -DCMAKE_BUILD_TYPE=Release -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_LIBC_WASI=0 -DWAMR_BUILD_LIBC_BUILTIN=1 -Bbuild

execute:

iwasm --heap-size=0  <tc_name>

Cases

wamr_fast_interpreter_SIGSEGV.zip

Code in WAT

(module
  (type (;0;) (func))
  (type (;1;) (func (param i32)))
  (type (;2;) (func (param f64)))
  (type (;3;) (func (param i64 f32 i32)))
  (func (;0;) (type 0)
    i64.const 1522971970233122829
    f32.const -0x1.e0b49cp-60 (;=-1.62869e-18;)
    i32.const 21979
    i32.const 891
    i32.const 10275
    i32.const 10973
    if (param i32)  ;; label = @1
      drop
    else
      drop
      f64.const 0x1.b3d05980fc69cp+102 (;=8.63218e+30;)
      i32.const 2939
      if (param f64)  ;; label = @2
        drop
      else
        drop
      end
    end
    if (param i64 f32 i32)  ;; label = @1
      drop
      drop
      drop
    else
      drop
      drop
      drop
    end)
  (export "_start" (func 0))
  (export "to_test" (func 0)))

Actual output:

unhandled SIGSEGV, si_addr: (nil)
[1]    3544186 abort

Expected output:

No exception

erxiaozhou avatar Jan 26 '24 06:01 erxiaozhou

@erxiaozhou thanks for reporting the issue, it was fixed with https://github.com/bytecodealliance/wasm-micro-runtime/pull/3100, please pull the latest code to test again.

wenyongh avatar Feb 02 '24 06:02 wenyongh