<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 3, 2015 at 6:55 AM, mats petersson via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=llvm-dev@lists.llvm.org&cc=&bcc=&su=&body=','_blank');return false;">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>I'm fairly sure your compiler (or rather linker) errors are coming from the fact that you are not linking to the C++ runtime library. Use `clang++ -std=c++11 *.o`, and I'm reasonably sure it will do what you want.<br></div></div></blockquote><div><br></div><div>Correct. </div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><br>--<br></div>Mats<br></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 3 September 2015 at 12:26, Greg Stark via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=llvm-dev@lists.llvm.org&cc=&bcc=&su=&body=','_blank');return false;">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>On Sun, Aug 30, 2015 at 3:30 PM, Greg Stark <<a href="mailto:stark@mit.edu" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=stark@mit.edu&cc=&bcc=&su=&body=','_blank');return false;">stark@mit.edu</a>> wrote:<br>
> To do this effectively I think it would be best to invoke the fuzzer<br>
> from inside Postgres. Essentially provide bindings for Libfuzzer so<br>
> you can I can have Libfuzzer provide all the test cases to repeatedly<br>
> call the internal functions on.<br>
><br>
> Is there any example of doing something like this already? Am I taking<br>
> a crazy approach?<br>
<br>
<br>
</span>So on further inspection it seems the API I want, at least for the<br>
in-process plan is mostly there in LLVMFuzzerNoMain. It would be nice<br>
if I could call the driver with a function pointer and void* and it<br>
would call my callback passing that closure along with the fuzzed<br>
input. But I can probably work around that with a global variable.<br></blockquote></div></div></div></div></blockquote><div><br></div><div>Not sure I understood this correctly. </div><div>Example? </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
I'm actually kind of frustrated by a more basic problem. The build<br>
system. It seems LibFuzzer is meant to be compiled as part of LLVM but<br>
it didn't get compiled when I built LLVM because I didn't build it<br>
with sanitize-coverage enabled. Now I can't get it to build because I<br>
get errors like:<br>
<br>
$ for i in *.cpp ; do clang -c -std=c++11 $i ; done<br>
$ clang -std=c++11 *.o<br>
FuzzerDriver.o: In function `fuzzer::ReadTokensFile(char const*)':<br>
FuzzerDriver.cpp:(.text+0x56): undefined reference to<br>
`std::allocator<char>::allocator()'<br>
FuzzerDriver.cpp:(.text+0x6d): undefined reference to<br>
`std::__cxx11::basic_string<char, std::char_traits<char>,<br>
std::allocator<char> >::basic_string(char const*, std::allocator<char><br>
const&)'<br>
FuzzerDriver.cpp:(.text+0x8d): undefined reference to<br>
`std::__cxx11::basic_string<char, std::char_traits<char>,<br>
std::allocator<char> >::~basic_string()'<br>
FuzzerDriver.cpp:(.text+0x96): undefined reference to<br>
`std::allocator<char>::~allocator()'<br>
FuzzerDriver.cpp:(.text+0xab): undefined reference to<br>
`std::__cxx11::basic_istringstream<char, std::char_traits<char>,<br>
std::allocator<char><br>
>::basic_istringstream(std::__cxx11::basic_string<char,<br>
std::char_traits<char>, std::allocator<char> > const&,<br>
std::_Ios_Openmode)'<br>
FuzzerDriver.cpp:(.text+0x14c): undefined reference to<br>
`std::allocator<char>::allocator()'<br>
FuzzerDriver.cpp:(.text+0x166): undefined reference to<br>
`std::__cxx11::basic_string<char, std::char_traits<char>,<br>
std::allocator<char> >::basic_string(char const*, std::allocator<char><br>
const&)'<br>
FuzzerDriver.cpp:(.text+0x18f): undefined reference to<br>
`std::__cxx11::basic_string<char, std::char_traits<char>,<br>
std::allocator<char> >::~basic_string()'<br>
<br>
And I get similar errors if I try to build it using the LLVM CMake<br>
generated makefiles (after running "cmake<br>
-DLLVM_USE_SANITIZE_COVERAGE=1" in the LibFuzzer directory), in fact I<br>
get errors that I need -std=c++11. Do I need to recompile *all* of<br>
llvm as if I was going to fuzz LLVM just to get libfuzzer built?<br>
<div><div><br>
--<br>
greg<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=llvm-dev@lists.llvm.org&cc=&bcc=&su=&body=','_blank');return false;">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=llvm-dev@lists.llvm.org&cc=&bcc=&su=&body=','_blank');return false;">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div></div>