Skip to content
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

Added a first fuzzer for integration with OSS-Fuzz. #2255

Merged
merged 1 commit into from
Jul 10, 2023

Conversation

DavidKorczynski
Copy link
Contributor

Hi Maintainers,

I would like to set up continuous fuzzing of jq by way of OSS-Fuzz. Essentially, OSS-Fuzz is a free service run by Google that performs continuous fuzzing of important open source projects. The only expectation of integrating into OSS-Fuzz is that bugs will be fixed. This is not a "hard" requirement in that no one enforces this and the main point is if bugs are not fixed then it is a waste of resources to run the fuzzers, which we would like to avoid.

In this PR google/oss-fuzz#4980 I have done exactly that, namely created the necessary logic from an OSS-Fuzz perspective to integrate jq. If you would like to integrate, could you please provide a set of email(s) that will get access to the data produced by OSS-Fuzz, such as bug reports, coverage reports and more stats. The emails should be linked to a Google account in order to view the detailed reports and notice the emails affiliated with the project will be public in the OSS-Fuzz repo, as they will be part of a configuration file.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 84.525% when pulling 7ae0df6 on DavidKorczynski:master into 80052e5 on stedolan:master.

@nicowilliams
Copy link
Contributor

nicowilliams commented Jul 7, 2023

How does this work? Why wouldn't we just use AFL? EDIT: Because Google will run the fuzzer for us.

@nicowilliams
Copy link
Contributor

Thanks! I'll rebase this and play with it.

@DavidKorczynski
Copy link
Contributor Author

How does this work? Why wouldn't we just use AFL? EDIT: Because Google will run the fuzzer for us.

Yeah, Google will run the fuzzers by way of OSS-Fuzz and this includes both AFL++, libFuzzer, Honggfuzz and Centipede. This will be done continuously.

@nicowilliams
Copy link
Contributor

Yeah, Google will run the fuzzers by way of OSS-Fuzz and this includes both AFL++, libFuzzer, Honggfuzz and Centipede. This will be done continuously.

Yeah, I'm very keen on adding support for all the fuzzing libraries that only need us to provide the same function -- it will be very easy to support all of them.

@DavidKorczynski
Copy link
Contributor Author

Yeah, Google will run the fuzzers by way of OSS-Fuzz and this includes both AFL++, libFuzzer, Honggfuzz and Centipede. This will be done continuously.

Yeah, I'm very keen on adding support for all the fuzzing libraries that only need us to provide the same function -- it will be very easy to support all of them.

Great! If you'd like I can fix this PR up again (am not sure what has changed since it was made, on the JQ side) and ensure things are working on the OSS-Fuzz side? Once that is done we just merge in the pull requests and you will shortly after have code coverage reports available as well as emails with any potential bugs found.

@nicowilliams
Copy link
Contributor

Great! If you'd like I can fix this PR up again (am not sure what has changed since it was made, on the JQ side) and ensure things are working on the OSS-Fuzz side? Once that is done we just merge in the pull requests and you will shortly after have code coverage reports available as well as emails with any potential bugs found.

That would be fantastic! Thanks for your help!

@DavidKorczynski
Copy link
Contributor Author

@nicowilliams this is ready now.

The corresponding PR is google/oss-fuzz#4980

In order to complete the OSS-Fuzz integration:

  1. merge this PR
  2. I will adjust initial integration of jq. google/oss-fuzz#4980 to use fuzzers from here upstream, rather than the one provided from that PR
  3. The PR on OSS-Fuzz will be merged
  4. OSS-Fuzz will start running the fuzzer using the engines libFuzzer, AFL++, Honggfuzz, Centipede

Could you share an email address that I can attach to the OSS-Fuzz integration? This is used to e.g. receive bug reports. It shuold be affiliated with a Google account due to the authenticate measures used. This email will receive bug reports and also be able to log on to oss-fuzz.com where there will be detailed bug reports, stack traces, reproducer inputs etc.

@nicowilliams
Copy link
Contributor

nicowilliams commented Jul 10, 2023

No changes needed to Makefile.am? EDIT: No, the OSS-Fuzz PR builds this.

@nicowilliams nicowilliams merged commit 3df8f90 into jqlang:master Jul 10, 2023
null_terminated[size] = '\0';

// Fuzzer entrypoint
jv res = jv_parse(null_terminated);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, we do have a jv_parse_sized() so you don't have to add a NUL terminator.

@nicowilliams
Copy link
Contributor

I've sent you an email, so now you'll have my email.

@nicowilliams
Copy link
Contributor

I sent three gmail-related emails: for me, for @emanuele6, and for @pkoppstein. Other maintainers/owners will get forwarded copies from us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants