Integrate Kostya's clang-proto-fuzzer with LLVM.
authorMatt Morehouse <mascasa@google.com>
Tue, 8 Aug 2017 20:15:04 +0000 (20:15 +0000)
committerMatt Morehouse <mascasa@google.com>
Tue, 8 Aug 2017 20:15:04 +0000 (20:15 +0000)
commitf051f5d1e615e65f214a03472698612dc3754cdd
tree0d7aaaffeca99a0a0c3aa5824424ee28a098ec06
parent364359e4fc0a0673574a8b4e8a04039abbe9ce5e
Integrate Kostya's clang-proto-fuzzer with LLVM.

Summary:
The clang-proto-fuzzer models a subset of C++ as a protobuf and
uses libprotobuf-mutator to generate interesting mutations of C++
programs.  Clang-proto-fuzzer has already found several bugs in
Clang (e.g., https://bugs.llvm.org/show_bug.cgi?id=33747,
https://bugs.llvm.org/show_bug.cgi?id=33749).

As with clang-fuzzer, clang-proto-fuzzer requires the following
cmake flags:
- CMAKE_C_COMPILER=clang
- CMAKE_CXX_COMPILER=clang++
- LLVM_USE_SANITIZE_COVERAGE=YES  // needed for libFuzzer
- LLVM_USE_SANITIZER=Address  // needed for libFuzzer

In addition, clang-proto-fuzzer requires:
- CLANG_ENABLE_PROTO_FUZZER=ON

clang-proto-fuzzer also requires the following dependencies:
- binutils  // needed for libprotobuf-mutator
- liblzma-dev  // needed for libprotobuf-mutator
- libz-dev  // needed for libprotobuf-mutator
- docbook2x  // needed for libprotobuf-mutator
- Recent version of protobuf [3.3.0 is known to work]

A working version of libprotobuf-mutator will automatically be
downloaded and built as an external project.

Implementation of clang-proto-fuzzer provided by Kostya
Serebryany.

https://bugs.llvm.org/show_bug.cgi?id=33829

Reviewers: kcc, vitalybuka, bogner

Reviewed By: kcc, vitalybuka

Subscribers: thakis, mgorny, cfe-commits

Differential Revision: https://reviews.llvm.org/D36324

llvm-svn: 310408
14 files changed:
clang/CMakeLists.txt
clang/cmake/modules/ProtobufMutator.cmake [new file with mode: 0644]
clang/tools/clang-fuzzer/CMakeLists.txt
clang/tools/clang-fuzzer/ClangFuzzer.cpp
clang/tools/clang-fuzzer/ExampleClangProtoFuzzer.cpp [new file with mode: 0644]
clang/tools/clang-fuzzer/README.txt [new file with mode: 0644]
clang/tools/clang-fuzzer/cxx_proto.proto [new file with mode: 0644]
clang/tools/clang-fuzzer/handle-cxx/CMakeLists.txt [new file with mode: 0644]
clang/tools/clang-fuzzer/handle-cxx/handle_cxx.cpp [new file with mode: 0644]
clang/tools/clang-fuzzer/handle-cxx/handle_cxx.h [new file with mode: 0644]
clang/tools/clang-fuzzer/proto-to-cxx/CMakeLists.txt [new file with mode: 0644]
clang/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.cpp [new file with mode: 0644]
clang/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx.h [new file with mode: 0644]
clang/tools/clang-fuzzer/proto-to-cxx/proto_to_cxx_main.cpp [new file with mode: 0644]