summaryrefslogtreecommitdiffstats
path: root/tools/clang-fuzzer
Commit message (Collapse)AuthorAgeFilesLines
* [clang-fuzzer] Add explicit dependency on clangSerialization for ↵Alex Bradbury2018-12-121-0/+1
| | | | | | | | | | | | | clangHandleCXX after rC348907 This library was breaking my -DBUILD_SHARED_LIBS=1 build. rC348915 seemed to miss this case. As this seems an "obvious" fix, I am committing without pre-commit review as per the LLVM developer policy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348929 91177308-0d34-0410-b5e6-96231b3b80d8
* Update README and Dockerfile to include llvm-proto-fuzzerEmmett Neyman2018-08-162-0/+38
| | | | | | | | | | | | | | Summary: Added commands to Dockerfile to build llvm-proto-fuzzer and the other related tools. Also added a section to the bottom of the README describing what llvm-proto-fuzzer does and how to run it. Reviewers: morehouse, kcc Reviewed By: morehouse Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D50829 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339933 91177308-0d34-0410-b5e6-96231b3b80d8
* Implementation of nested loops in cxx_loop_protoEmmett Neyman2018-08-153-35/+116
| | | | | | | | | | | | | | Summary: Extended `cxx_loop_proto` to have neste for loops. Modified `loop_proto_to_llvm` and `loop_proto_to_cxx` to handle the new protos. All protos have a set of statements designated as "inner loop" statements and a set of statements designated as "outer loop" statements. Reviewers: morehouse, kcc Reviewed By: morehouse Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D50670 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339832 91177308-0d34-0410-b5e6-96231b3b80d8
* Added LLVM metadata to generated IR to increase vectorization widthEmmett Neyman2018-08-091-1/+6
| | | | | | | | | | | | | | Summary: Edited `loop_proto_to_llvm` to emit metadata at the end of the generated IR. This metadata will increase the vector width when the IR is optimized. Reviewers: morehouse, kcc Reviewed By: morehouse Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D50530 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339392 91177308-0d34-0410-b5e6-96231b3b80d8
* Added another optimization pass to make vectorizing possibleEmmett Neyman2018-08-091-4/+16
| | | | | | | | | | | | | | Summary: I noticed that my code wasn't going deep into the loop vectorizer code so added another pass that makes it go further. Reviewers: morehouse, kcc Reviewed By: morehouse Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D50482 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339305 91177308-0d34-0410-b5e6-96231b3b80d8
* Changed how LLVM IR was generated to increase vectorizationEmmett Neyman2018-08-061-14/+13
| | | | | | | | | | | | | | Summary: Changed the structure of the generated IR to make it easier to vectorize Reviewers: morehouse, kcc Reviewed By: morehouse Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D50342 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339080 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-fuzzer] Remove unused typedef.Matt Morehouse2018-08-041-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338946 91177308-0d34-0410-b5e6-96231b3b80d8
* LLVM Proto Fuzzer - Run Functions on Suite of InputsEmmett Neyman2018-08-043-15/+149
| | | | | | | | | | | | | | | | Summary: Added corpus of arrays to use as inputs for the functions. Check that the two functions modify the inputted arrays in the same way. Reviewers: kcc, morehouse Reviewed By: morehouse Subscribers: mgorny, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D50194 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338943 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Silence warning about ptr-to-func to ptr-to-obj cast in ↵Andrei Elovikov2018-08-011-1/+17
| | | | | | | | | | | | | | | | | | | | | clang-fuzzer/handle-llvm/handle_llvm.cpp. Summary: I don't have the whole list of GCC binaries available so I determined the exact version where the warning disappeared via: https://github.com/gcc-mirror/gcc/blob/gcc-4_9_0-release/gcc/cp/typeck.c#L6863 https://github.com/gcc-mirror/gcc/blob/gcc-4_8_5-release/gcc/cp/typeck.c#L6652 Reviewers: emmettneyman, erichkeane Reviewed By: emmettneyman, erichkeane Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50056 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338551 91177308-0d34-0410-b5e6-96231b3b80d8
* added shared library to fix buildbotEmmett Neyman2018-07-271-0/+2
| | | | | | | | | | Summary: added shared library to fix buildbot Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D49895 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338091 91177308-0d34-0410-b5e6-96231b3b80d8
* Updated llvm-proto-fuzzer to execute the compiled codeEmmett Neyman2018-07-263-58/+148
| | | | | | | | | | | | | | | | | | Summary: Made changes to the llvm-proto-fuzzer - Added loop vectorizer optimization pass in order to have two IR versions - Updated old fuzz target to handle two different IR versions - Wrote code to execute both versions in memory Reviewers: morehouse, kcc, alexshap Reviewed By: morehouse Subscribers: pcc, mgorny, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D49526 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@338077 91177308-0d34-0410-b5e6-96231b3b80d8
* Attempt to fix latent tablegen dependency issueReid Kleckner2018-06-231-1/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335419 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix BUILD_SHARED_LIBS=1 build of libclangHandleLLVMSam Clegg2018-06-221-1/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D48503 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335380 91177308-0d34-0410-b5e6-96231b3b80d8
* Implemented proto to LLVM conversion and LLVM fuzz targetEmmett Neyman2018-06-2214-36/+430
| | | | | | Differential Revision: https://reviews.llvm.org/D48106 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335374 91177308-0d34-0410-b5e6-96231b3b80d8
* Test commit, made a minor change to a commentEmmett Neyman2018-06-211-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335299 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-fuzzer] Modified protobuf and converter to add new signature, remove ↵Matt Morehouse2018-06-112-12/+29
| | | | | | | | | | | | conditionals. Changed the function signature and removed conditionals from loop body. Patch By: emmettneyman Differential Revision: https://reviews.llvm.org/D47964 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334421 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-fuzzer] Made loop_proto more "vectorizable".Matt Morehouse2018-06-082-45/+13
| | | | | | | | | | | | | Edited loop_proto and its converter to make more "vectorizable" code according to kcc's comment in D47666 - Removed all while loops - Can only index into array with induction variable Patch By: emmettneyman Differential Revision: https://reviews.llvm.org/D47920 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334252 91177308-0d34-0410-b5e6-96231b3b80d8
* Introducing single for loop into clang_proto_fuzzerVitaly Buka2018-06-077-5/+351
| | | | | | | | | | | | | | | | | | | | Summary: Created a new protobuf and protobuf-to-C++ "converter" that wraps the entire C++ code in a single for loop. - Slightly changed cxx_proto.proto -> cxx_loop_proto.proto - Made some changes to proto_to_cxx files to handle the new kind of protobuf - Created ExampleClangLoopProtoFuzzer to test new protobuf and "converter" Patch by Emmett Neyman Reviewers: kcc, vitalybuka, morehouse Reviewed By: vitalybuka, morehouse Subscribers: mgorny, llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D47843 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334216 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-proto-fuzzer] Refactored LLVMFuzzerInitialize into its own file.Matt Morehouse2018-06-055-18/+71
| | | | | | | | | | Copied and renamed some files in preparation for new loop-proto-fuzzer. Patch By: emmettneyman Differential Revision: https://reviews.llvm.org/D47666 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333969 91177308-0d34-0410-b5e6-96231b3b80d8
* update two comments as suggested on https://reviews.llvm.org/D46843Nico Weber2018-05-152-4/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332370 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-093-3/+3
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331834 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-proto-to-cxx] Accept protobufs with missing fields.Matt Morehouse2018-02-021-1/+1
| | | | | | | | libprotobuf-mutator accepts protobufs with missing fields, which means clang-proto-fuzzer does as well. clang-proto-to-cxx should match this behavior. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@324132 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] Use PRIVATE in target_link_libraries for fuzzers.Matt Morehouse2017-12-062-1/+2
| | | | | | Several fuzzers were missed by r319840. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319948 91177308-0d34-0410-b5e6-96231b3b80d8
* [CMake] Use PRIVATE in target_link_libraries for executablesShoaib Meenai2017-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently use target_link_libraries without an explicit scope specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables. Dependencies added in this way apply to both the target and its dependencies, i.e. they become part of the executable's link interface and are transitive. Transitive dependencies generally don't make sense for executables, since you wouldn't normally be linking against an executable. This also causes issues for generating install export files when using LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM library dependencies, which are currently added as interface dependencies. If clang is in the distribution components but the LLVM libraries it depends on aren't (which is a perfectly legitimate use case if the LLVM libraries are being built static and there are therefore no run-time dependencies on them), CMake will complain about the LLVM libraries not being in export set when attempting to generate the install export file for clang. This is reasonable behavior on CMake's part, and the right thing is for LLVM's build system to explicitly use PRIVATE dependencies for executables. Unfortunately, CMake doesn't allow you to mix and match the keyword and non-keyword target_link_libraries signatures for a single target; i.e., if a single call to target_link_libraries for a particular target uses one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must also be updated to use those keywords. This means we must do this change in a single shot. I also fully expect to have missed some instances; I tested by enabling all the projects in the monorepo (except dragonegg), and configuring both with and without shared libraries, on both Darwin and Linux, but I'm planning to rely on the buildbots for other configurations (since it should be pretty easy to fix those). Even after this change, we still have a lot of target_link_libraries calls that don't specify a scope keyword, mostly for shared libraries. I'm thinking about addressing those in a follow-up, but that's a separate change IMO. Differential Revision: https://reviews.llvm.org/D40823 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319840 91177308-0d34-0410-b5e6-96231b3b80d8
* [cmake] Rename LIB_FUZZING_ENGINE to LLVM_LIB_FUZZING_ENGINE.Matt Morehouse2017-10-121-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315630 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-fuzzer] Allow linking with any fuzzing engine.Matt Morehouse2017-10-111-1/+5
| | | | | | | | | | | | | | | | | Summary: Makes clang-[proto-]fuzzer compatible with flags specified by OSS-Fuzz. https://llvm.org/pr34314 Reviewers: vitalybuka, kcc Reviewed By: kcc Subscribers: cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D38812 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315486 91177308-0d34-0410-b5e6-96231b3b80d8
* Reland "[clang-fuzzer] Allow building without coverage instrumentation."Matt Morehouse2017-10-113-54/+83
| | | | | | This relands r315336 after fixing bot breakage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315465 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-fuzzer] Fix shared library dependencies.Matt Morehouse2017-10-113-3/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315463 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[clang-fuzzer] Allow building without coverage instrumentation."Matt Morehouse2017-10-103-82/+53
| | | | | | | This reverts r315336 due to build breakage with gcc. http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror/builds/2173 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315355 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-fuzzer] Build proto-to-cxx with fuzzer-no-link.Matt Morehouse2017-10-101-0/+1
| | | | | | Makes it possible to build with any sanitizer or none at all. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315339 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-fuzzer] Allow building without coverage instrumentation.Matt Morehouse2017-10-103-53/+81
| | | | | | | | | | | | | | | | | | Summary: Compile with DummyClangFuzzer.cpp as entry point rather than libFuzzer's main when coverage instrumentation is missing. https://llvm.org/pr34314 Reviewers: kcc, bogner, vitalybuka Reviewed By: vitalybuka Subscribers: cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D38642 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315336 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-proto-fuzzer] Fix clang-proto-to-cxx build.Matt Morehouse2017-08-232-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311592 91177308-0d34-0410-b5e6-96231b3b80d8
* Update Clang fuzzers to use libFuzzer bundled with the toolchain.George Karpenkov2017-08-231-2/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D37043 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311516 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-proto-fuzzer] Update README.Matt Morehouse2017-08-211-8/+15
| | | | | | Add instructions on how to modify the compiler invocation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311345 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-proto-fuzzer] Allow user-specified compiler arguments.Matt Morehouse2017-08-181-1/+17
| | | | | | | | | | | | | | | | | | | Summary: Arguments can be specified after -ignore_remaining_args=1 to modify the compiler invocation. For example, the following command-line will fuzz LLVM with a custom optimization level and target triple: clang-proto-fuzzer CORPUS/ -ignore_remaining_args -O3 \ -triple arm64-apple-ios9 Reviewers: vitalybuka, kcc Reviewed By: vitalybuka Subscribers: aemerson, cfe-commits, kristof.beyls Differential Revision: https://reviews.llvm.org/D36882 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311185 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a Dockerfile for clang-proto-fuzzerKostya Serebryany2017-08-122-0/+39
| | | | | | | | | | | | | | Summary: Add a Dockerfile for clang-proto-fuzzer Reviewers: morehouse, vitalybuka Reviewed By: morehouse Subscribers: hintonda, cfe-commits Differential Revision: https://reviews.llvm.org/D36635 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310774 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-fuzzer] Resolve proto dependenciesVitaly Buka2017-08-091-1/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310441 91177308-0d34-0410-b5e6-96231b3b80d8
* Integrate Kostya's clang-proto-fuzzer with LLVM.Matt Morehouse2017-08-0812-43/+503
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310408 91177308-0d34-0410-b5e6-96231b3b80d8
* do more processing in clang-fuzzer (use EmitAssemblyAction)Kostya Serebryany2017-07-142-3/+11
| | | | | | | | | | | | | | Summary: use EmitAssemblyAction in clang-fuzzer Reviewers: klimek, rsmith Reviewed By: klimek Subscribers: cfe-commits, mgorny Differential Revision: https://reviews.llvm.org/D34267 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308045 91177308-0d34-0410-b5e6-96231b3b80d8
* Unbreak the clang-fuzzer build after r291184.Benjamin Kramer2017-01-111-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291681 91177308-0d34-0410-b5e6-96231b3b80d8
* Add missing header in ClangFuzzer (after r275882 cleanup)Mehdi Amini2016-07-181-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@275906 91177308-0d34-0410-b5e6-96231b3b80d8
* [libFuzzer] make LLVMFuzzerTestOneInput (the fuzzer target function) return ↵Kostya Serebryany2015-10-021-1/+2
| | | | | | int instead of void. (following llvm r249214) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@249215 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix clang-fuzzer build after r242499.Adrian Prantl2015-07-171-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242505 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-fuzzer] Update clang-fuzzer to API change in r240225.Alexey Samsonov2015-06-251-1/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240685 91177308-0d34-0410-b5e6-96231b3b80d8
* revert r237081 -- bad idea (-lcrypt may not be present)Kostya Serebryany2015-05-121-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237086 91177308-0d34-0410-b5e6-96231b3b80d8
* add -lcrypto to clang and clang-format fuzzers (lib/Fuzzer will soon require it)Kostya Serebryany2015-05-121-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237081 91177308-0d34-0410-b5e6-96231b3b80d8
* fix clang-fuzzer and clang-format-fuzzer Kostya Serebryany2015-05-071-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236691 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-fuzzer] make clang-fuzzer slightly faster by removing one redundant ↵Kostya Serebryany2015-05-041-2/+2
| | | | | | directory scan git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236459 91177308-0d34-0410-b5e6-96231b3b80d8
* Gating clang-fuzzer on the same conditions required to build the LLVMFuzzer ↵Aaron Ballman2015-04-061-16/+18
| | | | | | library. Otherwise, we can run into a situation where clang-fuzzer attempts to build, but its dependency was never built. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234170 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the clang-fuzzer use the CompilerInstance directly.Manuel Klimek2015-03-281-5/+16
| | | | | | Going through the driver is too slow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233459 91177308-0d34-0410-b5e6-96231b3b80d8