Stream: git-wasmtime

Topic: wasmtime / issue #3190 fuzz: Don't canonicalize NaN while...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 16 2021 at 16:09):

alexcrichton commented on issue #3190:

Someone should definitely double-check me on this. My vague historical experience with NaN is that one machine produces the same nan bits all the time, but the theoretical possibility is that different machines produce different nan bits. I don't know the historical reasoning behind the canonicalization of nan pass in Cranelift, but I suspect it was to produce entirely deterministic execution results of wasm, regardless of environment. I believe, though, that within one environment (such as the same process on the same machine) it's not necessary for that level of determinism?

view this post on Zulip Wasmtime GitHub notifications bot (Aug 16 2021 at 16:21):

sunfishcode commented on issue #3190:

In practice, CPUs do produce different NaN bits. For example, x86 produces NaNs with the sign bit set; ARM produces NaNs with the sign bit unset.

Also, JITs sometimes need to use custom code sequences which produce different NaNs than the hardware's typical behavior. For example, x86 doesn't have instructions corresponding to wasm's min and max, so JITs have to use sequences of several instructions to implement wasm's semantics, and there are a few different ways to do it, and they produce different NaN results.

So I expect disabling nan canonicalization will reduce the number of spurious fuzz differences, but won't reliably eliminate them. Ideally, the spec interpreter should have an option to canonicalize NaNs as well.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 16 2021 at 16:30):

github-actions[bot] commented on issue #3190:

Subscribe to Label Action

cc @fitzgen

<details>
This issue or pull request has been labeled: "fuzzing"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Aug 16 2021 at 18:44):

alexcrichton commented on issue #3190:

Ok if that's the case I don't think this will work out. I like your suggestion of implementing this in wasm-smith, though, so I'll do that!

view this post on Zulip Wasmtime GitHub notifications bot (Aug 16 2021 at 20:23):

alexcrichton commented on issue #3190:

https://github.com/bytecodealliance/wasm-tools/pull/319 contains the wasm-smith-does-the-canonicalization strategy. I'll disable cranelift-based canonicalization just for the differential fuzzers, but ensure that wasm-smith-canonicalization is enabled for those fuzzers.


Last updated: Dec 23 2024 at 12:05 UTC