bytecodealliance / bytecodealliance/wasmtime

Run Cranelift tests under Valgrind to catch JIT issues

Open
#2,582 1 comment 1 reaction 0 assignees View on GitHub
cranelift enhancement
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

We should consider adding a CI job that runs at least the Cranelift Wasm spec tests using Valgrind. This would allow us to more easily and deterministically catch subtle issues with generated code.

As an example, in #2432, we found that we were JIT'ing a sequence of instructions that depended in a subtle way on initial (undefined) register state. Specifically, we used an SSE compare instruction, comparing a temp reg against itself to produce all-ones, because `x == x` always... except when `x` is NaN, hence nondeterministic failures. Valgrind correctly models the semantics of the compare instruction that we used, and detected that our generated code depended on the initial (undefined) value of an XMM register.

We would likely benefit at least from the undefined-state tracking, as in above. ABI and VM interface-adjacent work (which tend to be pointer-heavy) may benefit from memcheck as well.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.