use Owi to check for equivalence of the fuzzer-generated programs #7420
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
This PR adds the possibility to use Owi to check for the equivalence of programs generated by the fuzzer before and after optimization.
Owi performs symbolic execution, which allows to compare the output of two given functions "for any input value", rather than with concrete inputs (like
0
, or1
, as it is currently done IIUC what @tlively told me). Owi can perform symbolic execution in parallel and has been shown to be the best symbolic execution tool for Wasm (disclaimer: I am one of the author of the tool, you can have a look at the paper if you want more details, but I am also happy to answer any question you might have).This is implemented by using the new
owi iso file1.wasm file2.wasm
subcommand that I wrote for making this PR easier. This command will get the list of all common imports between the two modules (same name and signature). Then, for each of them, it'll build a harness to invoke the two functions with symbols and check if the two (symbolic) outputs can be shown to be equivalent.For now, this does not handle Wasm traps (as shown by the use of the
--fail-on-assertion-only
flag), but I plan to extend it in the short term. It needs the development version of Owi and the following PR: https://github.com/OCamlPro/owi/pull/582/filesThere are a few things left to do.
First, I don't understand why sometimes
log-i64
is imported with the following signature:And sometimes with the following one:
I also noticed some error happening during Owi's parsing of binary files. Is binaryen still generating non-standard opcodes in the binary format (for compatibily with previous proposal draft for instance)? If not, it may simply be a bug in Owi, or an unhandled Wasm proposal that I forgot in
all_disallowed
(is there a full list of the proposals somewhere?).Finally, a few imports are missing in Owi (
table-get
andtable-set
).(I commented out the other handlers, but this is of course only temporary to make testing easier).
Moreover, I only tested this locally. Is the fuzzer tested in CI or is there something special I should do about installing Owi?