-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Code coverage support for gofuzz projects #2817
Comments
This is blocking #2714 |
One idea how to implement this was suggested by @catenacyber in #3106. It sounds doable, but I'm not sure if that's the best way to move forward, as well as I'm not sure anyone plans to work on it in the foreseeable future. An extra context for this is that we might change the way how we build fuzz targets (I think there are some changes in the most recent release), that might affect our coverage plans. |
Which code should I try to modify to get my proposition running ?
I can try to propose something even if it is not perfect, I think it can still be useful
Well, my methodology (which is like the one discussed in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16549) should not depend on how the fuzz targets are built. |
as of now we have so we might need to invent it, or consider some other name for sanitizer, or call it a new fuzzing engine instead that's why I'd rather wait on further gofuzz developments to see a standard way of generating coverage If you want to experiment with you solution, you can try adding extra code to your if [[ $SANITIZER = *coverage* ]]; then
exit 0
fi and updating the |
@catenacyber after we land #3142, two more things need to be done:
{
"data": [
{
"totals": {
"functions": {
"count": 171,
"covered": 113,
"percent": 66.08187134502924
},
"lines": {
"count": 5610,
"covered": 3820,
"percent": 68.09269162210339
},
"regions": {
"count": 5263,
"covered": 3478,
"notcovered": 1785,
"percent": 66.08398251947558
}
}
}
],
"type": "oss-fuzz.go.coverage.json.export",
"version": "1.0.0"
}
If that is doable, we should be able to enable Go coverage reports generation on the OSS-Fuzz build infrastructure.
|
And if/when 1) is done, we'll need to slightly update infra build scripts to enable code coverage for Go language. The change is trivial, but only someone from OSS-Fuzz team would be able to test it, as that would require access to the OSS-Fuzz build infra. |
CC @katiehockman re what go-fuzz support is needed for OSS-Fuzz integration. |
1 seems doable with some new golang script 2 is doable as well |
Here is a proposal for 1 Example output is
Does it look good to you ? If you look into the code, you will see that functions coverage is not straightforward |
I can also add the performance profiling while running a target over a corpus. |
Looks great!
I'd leave it out of scope for now, to avoid unnecessary complications. But it may be interesting in future, so it's good to know //cc @inferno-chromium |
Working on converting all the projects, it seems 2 projects with project.yaml having |
@catenacyber the latest version failed on the builder during the fuzzer stats uploading: oss-fuzz/infra/build/functions/build_and_run_coverage.py Lines 181 to 195 in b97f6e2
that fuzzer stats directory ( oss-fuzz/infra/base-images/base-runner/coverage Lines 100 to 101 in 07ea81b
summary.json file you generate for the whole project.
In other words, those are summary.json files for every single fuzz target. Would it be possible to generate those as well? |
…4671) * Golang coverage summary for each fuzz target * Document usage of compile_go_fuzzer * update the documentation change Co-authored-by: Max Moroz <[email protected]>
I think @catenacyber has completed this work. |
There was a good discussion in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16549
better to continue it here //cc @guidovranken @dvyukov
The text was updated successfully, but these errors were encountered: