-
Notifications
You must be signed in to change notification settings - Fork 26
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
Optionaly show stats during fuzzing session #144
Conversation
1beb7b8
to
62969c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed off-line: one possible solution might be to intercept the err output of the fuzzer and parse the logs with tables of successful and failed instructions. That way we might have the continuously updated cumulative values of successful and failed instructions and only output the final stats at the end of fuzzing.
518f50c
to
278a2ae
Compare
Yes, so I updated the feature implementation. Essentially:
Points to note:
|
041b0be
to
d0b375c
Compare
@Ikrk Ready for review |
fce9204
to
7eb533f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks much better and seems to be working besides some synchronizaiton issues. Please have a look at my comments.
e4e56e7
to
dead3a1
Compare
dead3a1
to
add07bc
Compare
I added also stats of failed invariants checks and I created a new Jira task to potentially extend the stats also with unhandled panics: https://ackeeblockchain.atlassian.net/browse/TRD-81 |
* Optionaly show stats during fuzzing session * 🐛 (store failed txs): Store failex txs * 🩹 Simplified stats logging * 📝 Added fuzzing stats to docs * ✨ Added failed invariants check stats --------- Co-authored-by: Ikrk <[email protected]>
* Optionaly show stats during fuzzing session * 🐛 (store failed txs): Store failex txs * 🩹 Simplified stats logging * 📝 Added fuzzing stats to docs * ✨ Added failed invariants check stats --------- Co-authored-by: Ikrk <[email protected]>
Currently, it is not possible to determine (or somehow debug) whether the fuzzing session is actually fuzzing something and if the instructions are successfully executed. This means that based solely on the fuzzer's output and zero crashes, the user cannot tell if their program has no errors or if none of the targeted instructions were successfully executed.
This PR introduces a simple stats logging mechanism.
The best option would be to show stats for the fuzzing session right after the session ends. However, the honggfuzz workflow is as follows:
Due to the
SIGKILL
, I think it is not possible to time the end of a fuzzing subprocess (fuzzing session) = we do not exactly know when to output the stats.So, this PR aims to provide stats during the whole fuzzing session. A new function called
run_fuzzer_with_stats
inside the commander is created.The stats collect an accumulating number of invocations and successful invocations of corresponding instructions. Then, at the end of a fuzzing iteration, stats are printed. If every instruction was successfully executed, the whole structure with a success message is printed; on the other hand, if any instruction has 0 successful invocations, an error message is printed.
This means as the underlying fuzzer tries to explore as many branches as possible, this can lead to two scenarios:
Lastly, we have two options for indicating to the fuzzer that we want to see stats.
I find the second option better because it has no impact on performance and for the first option, we can use:
However, this approach results in a full re-compilation even if
trident fuzz run <FUZZ_TARGET>
was already called.NOTE: regarding the
text_generator.rs
changes. Thecargo clippy
had problem with (used) unused variable SUCCESS within thelib.rs
. So I just changed FINISH -> SUCCESS.