-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
fuzz-bugBugs found by a fuzzerBugs found by a fuzzer
Description
This input module:
(module
(func (param i32) (result f32)
f32.const 0
local.get 0
f32.load offset=1
f32.copysign
)
(memory 1)
(export "" (func 0))
)yields:
$ cargo run -q testcase0.shrunken.wat --invoke '' 0
warning: using `--invoke` with a function that takes arguments is experimental and may break in the future
Error: failed to run main module `testcase0.shrunken.wat`
Caused by:
0: failed to invoke ``
1: wasm trap: out of bounds memory access
wasm backtrace:
0: 0x2e - <unknown>!<wasm function 0>
but the trap reported here is incorrect because there is no out-of-bounds memory access in this module. Instead what's happening is that in the compile function:
0000000000000000 <_wasm_function_0>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 8b c2 mov %edx,%eax
6: 48 8b 4f 50 mov 0x50(%rdi),%rcx
a: 41 ba 00 00 00 80 mov $0x80000000,%r10d
10: 66 45 0f 6e da movd %r10d,%xmm11
15: 66 41 0f 6f c3 movdqa %xmm11,%xmm0
1a: 0f 55 05 0f 00 00 00 andnps 0xf(%rip),%xmm0 # 30 <_wasm_function_0+0x30>
21: 44 0f 54 5c 01 01 andps 0x1(%rcx,%rax,1),%xmm11
27: 41 0f 56 c3 orps %xmm11,%xmm0
2b: 48 89 ec mov %rbp,%rsp
2e: 5d pop %rbp
2f: c3 retqThe instruction at 0x21 is segfaulting due to a misaligned address. The segfault is also registered as a trap point in Wasmtime since I believe this is a folding of the f32.load into the f32.copysign and so this could also segfault due to an out-of-bounds memory access.
Bisection reveals that this issue become a segfault in #4730 and then became a trap in #4790 (cc @elliottt). We'll want to be sure to backport the fix for this to the release-1.0.0 branch as well.
Metadata
Metadata
Assignees
Labels
fuzz-bugBugs found by a fuzzerBugs found by a fuzzer