Fuzz: Wire up ClusterFuzzLite CI fuzzing - #2527
Conversation
|
A bit unexpected, but no crash on the first fuzz makes sense given how weak is the current harness. The next PRs will bring better harnesses and a decent seed body. |
alamb
left a comment
There was a problem hiding this comment.
Thanks @LucaCappelletti94 -- I left some comments. Let me know what you think
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| name: ClusterFuzzLite continuous builds |
There was a problem hiding this comment.
I am not sure about the value of running fuzzing on main pushes as well -- my rationale is that if the fuzz test hits an issue on main then there will be a red x recorded on that commit and we will perhaps be mislead into thinking that a bug was introduced by that commit (or at least will have to rule it out)
Also it seems strange to me to make the amount of effort devoted to fuzz testing a function of the number of PRs merged to main (which is what this will do)
I personally suggest just running the fuzz testing in batch mode to begin with. If you want more fuzz time, then just crank it up there
There was a problem hiding this comment.
This particular workflow is solely focused on ensuring the fuzzer harnesses keep building. It does not run the harnesses themselves.
It additionally works alongside the PR fuzzing job as it is the harness built that is used for the differential fuzzing.
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| name: ClusterFuzzLite PR fuzzing |
There was a problem hiding this comment.
likewise here I think PR fuzzing will just generate more confusion to contributors than it is worth -- if the fuzz test fails on their PR they probably will either
- Rerun it
- Get confused and think it is related to something in their PR
I think both of these are confusing outcomes and recommend against it
There was a problem hiding this comment.
My hope was that, as the fuzzer stabilizes over time, the bugs that get raised by a PR fuzzing run are exactly bugs of the PR, and this should simplify a lot the job of reviewers.
I do agree that at this time most bugs raised by the fuzzer are pre-existing things that need handling before it can be deployed on PRs as at this time yes they would be confusing.
There was a problem hiding this comment.
I am a tad new to ClusterFuzzLite specifically, so I double checked. In theory, IF I configured this correctly (and I primarely copied the documentation examples) if a bug exists on main and survives in the PR, it is reported as pre-existing, and if it exists in the PR and not in the main it is noted as new bug. Only the latter case should be marked as a blocking error.
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| name: ClusterFuzzLite corpus pruning |
There was a problem hiding this comment.
I am not familiar with corpus pruning -- maybe a definition to the link would be helpful
Also I don't understand why this is a separate job from fuzz testing -- why not make the daily schedule a single action (perhaps with two jobs)?
There was a problem hiding this comment.
TLDR of it, the corpus entries over time become overlapping/redundant, and we want to keep the minimum set of entries that seed the maximum coverage. This minimization procedure trims down the corpus by assigning to each entry a fingerprint of the coverage it produces, and then keeps sufficiently distinct ones. It is generally done less frequently than fuzzing itself.
I will add a definition and link the documentation.
Yes I expect this too -- but I would recommend shielding other contributors from the pain (and yourself from having to explain it to them) |
|
I will set up analogous workflows in a test repo to verify whether the PR workflow behaves as I described, just in case I either (a) copied the wrong documentation examples / configured them poorly (b) misunderstood anything of the documentation. I believe it works as advertised but given it is a relatively new tool for me (I generally just fuzz locally) I want to make extra sure. If it goes red only when the bug is new, that would be exactly what we want and should put the issue of having random red CIs in PR at rest, I suppose. |
I think the gate should also be about false positives (not just true negatives) So in theory I would hope our existing process / new unit tests would cover regressions and then the fuzzing is a net new set of tests |
What do you mean by false positives? |
I mean the chance of the fuzz test failing on a PR that did not cause whatever problem the fuzzer found. I think if we run non deterministic tests on PRs we are going to inject some noise into the process -- I would recommend against it if at all possible (at least until we have some confidence that the fuzz test is mostly successful -- e.g. run it for a week or more every day and not find anything new) |
I am not sure how that would occur, suppose the PR compiles to The scenario you describe where To be clear, I perfectly agree that if the CI starts to randomly give out bugs to PRs that have nothing to do with that bug it would be something extremely problematic and to be absolutely avoided. If it happens to be the case, I would suggest to only keep the periodic fuzz job. That being said, again if I understood correctly its documentation, that should not be the case as it would make ClusterFuzzLite principal use case be nigh useless. |
Maybe it is different in ClusterFuzz but with most fuzzers, if you run them twice they test two different sets of queries. So in that case you don't actually compare Perhaps I am misunderstanding 🤔 |
|
Basically here if I understood how it works, you have:
So for any given fuzzer iteration, |
alamb
left a comment
There was a problem hiding this comment.
Sounds like a solid plan -- Let's give it a try!
|
Thank you for the lesson @LucaCappelletti94 🙏 |
e85e2c5 to
9a28f7b
Compare
Step 2 of #2519, modelled on diesel-rs/diesel#5212.
Adds the ClusterFuzzLite configuration and four workflows for the existing
fuzz_parse_sqltarget.Every pull request fuzzes for 10 minutes in code-change mode, pushes to main refresh a runner-cached build, and a daily batch at 06:00 UTC plus a corpus prune at 05:00 keep the shared corpus on the clusterfuzzlite branch of this repository using the default GITHUB_TOKEN.
Given this is the first time we actually start to fuzz the code automatically and the various PRs, I expect some blood bath of bugs will ensue, but that is sort of the point. We will add more fuzz harnesses over time.