[llvm] r227252 - Add a Fuzzer library

Pasi Parviainen pasi.parviainen at iki.fi
Wed Jan 28 15:45:32 PST 2015


On 29.1.2015 0:34, Sean Silva wrote:
> On Wed, Jan 28, 2015 at 10:23 PM, Kostya Serebryany <kcc at google.com> wrote:
>
>>
>>
>> On Wed, Jan 28, 2015 at 1:54 PM, Pasi Parviainen <pasi.parviainen at iki.fi>
>> wrote:
>>
>>> On 28.1.2015 0:08, Kostya Serebryany wrote:
>>>
>>>> Author: kcc
>>>> Date: Tue Jan 27 16:08:41 2015
>>>> New Revision: 227252
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=227252&view=rev
>>>> Log:
>>>> Add a Fuzzer library
>>>>
>>>> Summary:
>>>> A simple genetic in-process coverage-guided fuzz testing library.
>>>>
>>>> I've used this fuzzer to test clang-format
>>>> (it found 12+ bugs, thanks djasper@ for the fixes!)
>>>> and it may also help us test other parts of LLVM.
>>>> So why not keep it in the LLVM repository?
>>>>
>>>> I plan to add the cmake build rules later (in a separate patch, if
>>>> that's ok)
>>>> and also add a clang-format-fuzzer target.
>>>>
>>>> See README.txt for details.
>>>>
>>>> Test Plan: Tests will follow separately.
>>>>
>>>> Reviewers: djasper, chandlerc, rnk
>>>>
>>>> Reviewed By: rnk
>>>>
>>>> Subscribers: majnemer, ygribov, dblaikie, llvm-commits
>>>>
>>>> Differential Revision: http://reviews.llvm.org/D7184
>>>>
>>>> Added:
>>>>       llvm/trunk/lib/Fuzzer/
>>>>       llvm/trunk/lib/Fuzzer/CMakeLists.txt
>>>>       llvm/trunk/lib/Fuzzer/FuzzerCrossOver.cpp
>>>>       llvm/trunk/lib/Fuzzer/FuzzerFlags.def
>>>>       llvm/trunk/lib/Fuzzer/FuzzerIO.cpp
>>>>       llvm/trunk/lib/Fuzzer/FuzzerInternal.h
>>>>       llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
>>>>       llvm/trunk/lib/Fuzzer/FuzzerMain.cpp
>>>>       llvm/trunk/lib/Fuzzer/FuzzerMutate.cpp
>>>>       llvm/trunk/lib/Fuzzer/FuzzerUtil.cpp
>>>>       llvm/trunk/lib/Fuzzer/README.txt
>>>>       llvm/trunk/lib/Fuzzer/test/
>>>>       llvm/trunk/lib/Fuzzer/test/ExactTest.cpp
>>>>       llvm/trunk/lib/Fuzzer/test/InfiniteTest.cpp
>>>>       llvm/trunk/lib/Fuzzer/test/NullDerefTest.cpp
>>>>       llvm/trunk/lib/Fuzzer/test/SimpleTest.cpp
>>>>       llvm/trunk/lib/Fuzzer/test/TestFuzzerCrossOver.cpp
>>>>       llvm/trunk/lib/Fuzzer/test/TimeoutTest.cpp
>>>> Modified:
>>>>       llvm/trunk/lib/CMakeLists.txt
>>>>
>>>
>>> Putting this library directly under lib/ tree feels a little bit out of
>>> place. Perhaps utils/ or even tools/ trees would be more appropriate
>>> locations for this library, since most of its value is in testing (on
>>> limited environments, see below).
>>
>>
>> I don't have any strong opinion here. But none of the reviewers objected.
>>
>
> I somewhat agree with Pasi, but we already have precedent for having stuff
> that is sort of out of place in lib so I'm not too worried. E.g.
> lib/TableGen (builds a compile-time tool), clang/lib/Headers (contains
> builtin headers for user code).
>
> -- Sean Silva
>

Yeah, lib/TableGen is an anomaly, but at least it's required by llvm 
itself and clang. Fuzzer seems to be more of an optional library with a 
limited host toolchain support, and mostly useful for testing. It's not 
directly relevant working with llvm itself.

Pasi.

>
>>
>>
>>>
>>>
>>>   Modified: llvm/trunk/lib/CMakeLists.txt
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/
>>>> CMakeLists.txt?rev=227252&r1=227251&r2=227252&view=diff
>>>> ============================================================
>>>> ==================
>>>> --- llvm/trunk/lib/CMakeLists.txt (original)
>>>> +++ llvm/trunk/lib/CMakeLists.txt Tue Jan 27 16:08:41 2015
>>>> @@ -17,3 +17,4 @@ add_subdirectory(Target)
>>>>    add_subdirectory(AsmParser)
>>>>    add_subdirectory(LineEditor)
>>>>    add_subdirectory(ProfileData)
>>>> +add_subdirectory(Fuzzer)
>>>>
>>>> Added: llvm/trunk/lib/Fuzzer/CMakeLists.txt
>>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/
>>>> CMakeLists.txt?rev=227252&view=auto
>>>> ============================================================
>>>> ==================
>>>> --- llvm/trunk/lib/Fuzzer/CMakeLists.txt (added)
>>>> +++ llvm/trunk/lib/Fuzzer/CMakeLists.txt Tue Jan 27 16:08:41 2015
>>>> @@ -0,0 +1,9 @@
>>>> +add_library(LLVMFuzzer STATIC
>>>> +  EXCLUDE_FROM_ALL  # Do not build if you are not building fuzzers.
>>>> +  FuzzerCrossOver.cpp
>>>> +  FuzzerIO.cpp
>>>> +  FuzzerLoop.cpp
>>>> +  FuzzerMain.cpp
>>>> +  FuzzerMutate.cpp
>>>> +  FuzzerUtil.cpp
>>>> +  )
>>>>
>>>>
>>> This target should only be added when build environment can satisfy its
>>> requirements (sufficient posix interfaces + asan support), otherwise there
>>> will be a build target which is known to fail. Fuzzers depending on this
>>> library can then simply enable themselves by existence of this target.
>>
>>
>> That's what EXCLUDE_FROM_ALL is for, right?
>>
>>
>>
>>>
>>>
>>> Pasi.
>>>
>>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
>




More information about the llvm-commits mailing list