-
Notifications
You must be signed in to change notification settings - Fork 18k
[dev.fuzz] minimization discards crasher in favour of a non-crasher #48327
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
Comments
I was able to replicate this locally. Still diagnosing the cause of this though. |
When I instrument with this bpftrace script (I'm building for amd64)
failure cases look like this:
It looks like a -20000 is passed to the fuzzing function and is mutated. The mutation results in the value -19983 which I then find in the corpus. Sometimes, the next mutation is less than -20000 and the value in the corpus (18446) is a crasher:
|
I modified my script to capture the return value of mutateInt to be sure about what was going on:
(358 is the offset of the RET instruction in With minimization disabled with
and Line-by-line:
|
This was a bit tricky to figure out, but I believe I have a fix. The configuration in this bug was a bit different than how I would expect most people to run fuzzing: namely that the test binary was built without coverage instrumentation, which means the "coverage only" run we do at the beginning of fuzzing will never get run. We had a bug in our code that didn't allow coverage instrumentation to be fully disabled, so something that the fuzzing engine thought expanded coverage ended up being written as a crasher incorrectly. The PR I'm about to send should fix this for now, though we need to think a bit more about what the development flow should look like when a test binary is run without coverage instrumentation, and the preliminary tests of the seed corpus for the target are disabled (e.g. with |
Change https://golang.org/cl/349630 mentions this issue: |
@katiehockman I'm a bit confused about being built without coverage instrumentation. If I run this without building a test executable I get
The corpus contains a value which doesn't crash. Does running in this way mean that coverage instrumentation isn't available? |
Ah sorry @stevenjohnstone I wrote my response before I saw your other comments. When I said "built without coverage instrumentation" I was referring to your first comment which is running a generated test binary. I'll take a look at that reproducer too and see what's going on. |
I was able to reproduce this and I'm pretty sure I know what's going on and how to fix it. This is actually a different, but related, issue. Will add that to the patch (or make a new one, depending on size) shortly. |
This should be fixed now. |
This change refactors some of the code to support skipping a run of the seed corpus by the go command before runFuzzing occurs. Previously, the go command would run all seed corpus for all targets that match the provided `run` argument. This will be redundant when fuzzing a target. Now, the seed corpus is only run by targets other than the one that's about to be fuzzed, and the worker handles running and reporting issues with the seed corpus. Part of the logic that needed close inspection is what to do if a failure occurs during a testing-only or coverage-only fail. If the input is already in the seed corpus, the fuzzing engine shouldn't add it. If the input is currently in the cache, then it should be written to testdata. In all cases, if an error occurs, we need to report this to the user with enough information for them to debug it. This uncovered some issues with our code when fuzzing without instrumentation, and when -run=None was provided. There are some logic fixes in this change, and some small refactors. Fixes #48327 Fixes #48296 Change-Id: I9ce2be0219c5b09277ddd308df8bc5a46d4558fa Reviewed-on: https://go-review.googlesource.com/c/go/+/349630 Trust: Katie Hockman <[email protected]> Run-TryBot: Katie Hockman <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
The "crasher" is
-19978
which doesn't cause a crash.What did you expect to see?
Minimization failed to find an alternative similar crash. It should have a correct value in the corpus.
What did you see instead?
A crasher in the corpus which doesn't cause a crash.
The text was updated successfully, but these errors were encountered: