Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As a developer, I need to have fuzzing testing for gossip messages so I can be sure decoding is safe and correct #9

Open
2 of 4 tasks
akoptelov opened this issue Aug 26, 2022 · 4 comments
Assignees

Comments

@akoptelov
Copy link
Contributor

akoptelov commented Aug 26, 2022

See #1

@akoptelov akoptelov changed the title Fuzz gossip messages As a developer, I need to fuzzing testing for gossip messages so I can be sure decoding is safe and correct Aug 26, 2022
@akoptelov akoptelov self-assigned this Aug 26, 2022
@akoptelov akoptelov changed the title As a developer, I need to fuzzing testing for gossip messages so I can be sure decoding is safe and correct As a developer, I need to have fuzzing testing for gossip messages so I can be sure decoding is safe and correct Aug 26, 2022
@akoptelov
Copy link
Contributor Author

akoptelov commented Aug 29, 2022

Fuzzing CI:

  • Servers
  • Patched Mina Image (for diff fuzzing)
  • Coverage reporting
  • GitHub integration (to restart on new changes)

@akoptelov
Copy link
Contributor Author

Regarding differential fuzzing. Currently we're using IPC to access OCaml-side decoder. That is because various troubles using Mina via FFI in Rust. Alternative way is to launch Rust fuzzer from OCaml instead. Some questions here:

  • Will we gain any performance improvement here (probably yes, because of less copying)?
  • Will we get OCaml coverage feedback for fuzzer?
  • How much work will it take to add more Rust stuff to Mina?

@tizoc and @dkuehr Can you answer any of these questions?

@tizoc
Copy link

tizoc commented Aug 29, 2022

@akoptelov I am thinking that for the linking issues, even if the fuzzer is launched from OCaml there may still be issues related to having various Rust components (our own, and o1labs proof-system) that don't know about each other (because they are compiled separately) but that depend on common code fail. So we probably need a proper solution and not just a workaround.

Regarding 1), maybe, but my guess is that the communication overhead is probably little compared to the work being done. Also, I am thinking that with IPC we can use multiple processes to have parallelism that would not be possible otherwise?

Regarding 2), I remember that for Tezedge @dkuehr did something, so he probably has something to say.

Regarding 3), right now there will be issues, but once the linking issue has been solved and I have figured what a proper setup should look like I don't think it should be hard. One thing I am not entirely sure is what will happen with the WASM target and linking + FFI (I guess it is doable, I am just not very familiar with how the WASM-target building process works)

@dkuehr
Copy link

dkuehr commented Aug 29, 2022

Let me elaborate on question #2. You are asking about coverage feedback, so for the specific case of fuzzcheck-rs the short answer is no. In Tezedge what I did was to add coverage reports for OCaml components by making a few modifications to bisect-ppx and rebuilding the project with it.

In a nutshell bisect-ppx doesn't do more than modifying the target's code AST and adding the needed counters and providing functions to reset/dump them. This is somewhat similar to what other compilers (Rust) can do to generate code with gcov but they are incompatible approaches. It is "easy" for tools like fuzzcheck-rs to read the gcov generated counters from memory on-the-fly and get feedback that way, but not so for the bisect-ppx ones because it works on a "higher" level. It could be possible to make to modify fuzzcheck-rs and bisect-ppx to make all this work but IMHO it is too much effort.

That said, some fuzzers have the ability to work with coverage at lower-level, for example if you use hongfuzz you can use CPU-level tracing (BTS and/or IntelPT), in this case you don't even need to compile the target with coverage information What you get is basically lists of instruction-pointer addresses of the assembly instructions that are hit during execution. Decent coverage reports could be generated if the target has debug symbols. Note that you will need a CPU that supports this (most modern Intel CPUs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants