-
Notifications
You must be signed in to change notification settings - Fork 18k
internal/fuzz: regression finding interesting inputs in simple tests #48179
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 a bit blocked on investigating this by coverage not working for fuzzing runs: #48178. I suspected that the fuzzer was making progress but nothing was being labelled as interesting. To give an idea of the coverage, I used bpftrace to instrument the function under test where the function returns (with offsets to RET instructions from the function address). This confirmed that the fuzzer generated an input which reached this line which I think qualifies as finding new coverage. In a checkout of https://github.com/stevenjohnstone/go-beta-fuzzer-vs-libfuzzer, I built a test executable
I then used my own hacky tool to generate a skeleton bpftrace program which ended up like this // exit from github.com/stevenjohnstone/fuzztests.loopmagic
uprobe:/home/stevie/code/go/fuzztests.test:"github.com/stevenjohnstone/fuzztests.loopmagic" + 169 {
@exit[169] = count();
}
// exit from github.com/stevenjohnstone/fuzztests.loopmagic
uprobe:/home/stevie/code/go/fuzztests.test:"github.com/stevenjohnstone/fuzztests.loopmagic" + 352 {
@exit[352] = count();
}
// exit from github.com/stevenjohnstone/fuzztests.loopmagic
uprobe:/home/stevie/code/go/fuzztests.test:"github.com/stevenjohnstone/fuzztests.loopmagic" + 377 {
@exit[377] = count();
}
This counts the exit points for go tool objdump -s 'fuzztests.loopmagic' fuzztests.test
After tracing the fuzzer for a few seconds, the output was
but the fuzzer displays
I think the bpftrace output indicates that new coverage has been found. I think those should turn up in the "interesting" count displayed when fuzzing? |
cc @golang/fuzzing |
Here's a simpler setup which doesn't need "unsafe" support in bpftrace. I built a test executable in a checkout of https://github.com/stevenjohnstone/go-beta-fuzzer-vs-libfuzzer
This is the function under test var leet = []byte{1, 3, 3, 7}
func loopmagic(input []byte) bool {
if len(input) != 4 {
return false
}
for i, v := range leet {
if input[i] != v {
return false
}
}
return true
} When I wrote a bpftrace script which captures the slice input to
I ran this with
Then run the fuzzer with
Fuzzer says there's no interesting input:
However, the bpftrace script output suggests that the fuzzer has guessed 6 slices of length 4 matching the first two bytes:
Going twice around the loop in if len(input) != 4 {
return false
} (552 times) is interesting coverage? |
@rolandshoemaker the tests at https://github.com/stevenjohnstone/go-beta-fuzzer-vs-libfuzzer now complete in under a second when I use gotip from https://go-review.googlesource.com/c/go/+/364214/ (#49601) 👍 |
Change https://golang.org/cl/364214 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
n/a
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Ran tests from https://github.com/stevenjohnstone/go-beta-fuzzer-vs-libfuzzer. Specifically, the test "FuzzLoop" which started to pass for the beta fuzzer after commit 7b6893d has stopped working with commit 5bc273a.
The fuzzer runs indefinitely (well, several hours so far) without finding a crasher. Notably the "interesting" column remains at zero for the duration of the run.
What did you expect to see?
Prior to 5bc273a, this test case would end with the fuzzer finding a crasher with the "interesting" count increasing through the run.
What did you see instead?
Now, no crasher is found and the "interesting" count remains zero.
The text was updated successfully, but these errors were encountered: