[cmake] Allow building fuzzers with OSS-Fuzz flags.

Authored by morehouse on Oct 12 2017, 12:15 PM.

Diff Detail

morehouse created this revision.Oct 12 2017, 12:15 PM
bogner added inline comments.Oct 12 2017, 12:56 PM
897 ↗(On Diff #118825)

How / where does this get set?

morehouse added inline comments.Oct 12 2017, 12:59 PM
897 ↗(On Diff #118825)

In the CMake configure command. See https://github.com/google/oss-fuzz/pull/885.

bogner added inline comments.Oct 12 2017, 1:12 PM
897 ↗(On Diff #118825)

Okay, if we're going to use a cmake variable for this we should do it right and define a cache variable with documentation in the top level CMakeLists.txt file. I'd probably add it next to where we add LLVM_USE_SANITIZER.

Also, we should namespace this appropriately. Something like LLVM_LIB_FUZZING_ENGINE or LLVM_FUZZING_ENGINE.

Optionally, we could also set it up so that we default that to libFuzzer in the LLVM_USE_SANITIZE_COVERAGE case so that we don't even need two cases here.

morehouse updated this revision to Diff 118839.Oct 12 2017, 1:53 PM
  • Add cache variable and rename to LLVM_LIB_FUZZING_ENGINE.
morehouse marked an inline comment as done.Oct 12 2017, 1:55 PM
morehouse added inline comments.
897 ↗(On Diff #118825)

Regarding switching the configuration under LLVM_USE_SANITIZE_COVERAGE, I don't think we want to do that. OSS-Fuzz uses its own instrumentation which we don't want to mix with -fsanitize=fuzzer. But having -fsanitize=fuzzer by default seems helpful for developers.

kcc added inline comments.Oct 12 2017, 2:06 PM
897 ↗(On Diff #118825)

oss-fuzz uses *different* build modes (e.g. one instrumentation for AFL, another for libFuzzer).

bogner accepted this revision.Oct 12 2017, 2:55 PM


This revision is now accepted and ready to land.Oct 12 2017, 2:55 PM
This revision was automatically updated to reflect the committed changes.
morehouse marked an inline comment as done.