<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 5, 2015 at 11:50 AM, Greg Stark <span dir="ltr"><<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>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sat, Sep 5, 2015 at 6:38 PM, Kostya Serebryany <<a href="mailto:kcc@google.com" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=kcc@google.com&cc=&bcc=&su=&body=','_blank');return false;">kcc@google.com</a>> wrote:<br>
><br>
> This is more like a limitation of asan, not libFuzzer.<br>
> By design, asan does not recover from the first crash.<br>
> This feature has been criticized quite a lot, but I am still convinced this<br>
> is a feature, not a bug.<br>
> IMHO, recovery mode will be misused/abused too often to be useful, besides<br>
> it adds complexity to the code.<br>
> (There is a patch under review right now to implement recovery mode for<br>
> asan,<br>
> but I am not sure if or when this patch will be committed)<br>
<br>
</span>Arguably a fuzzer changes the game somewhat. It's one thing to have a<br>
crash during interactive testing but fuzzing is most useful if left to<br>
run on a server unattended.<br>
<br>
However I think this isn't the whole story here. There are many<br>
different kinds of errors and not all are unrecoverable memory<br>
failures. I may just get an internal error from my own code that I<br>
know should never happen but doesn't represent major corruption. I<br>
would like a way for the callback to return an error condition to the<br>
fuzzer driver to have the test case set aside as a crash or perhaps as<br>
a separate category (or perhaps to allow it to specify the name of the<br>
category).<br></blockquote><div><br></div><div>For that you don't need libFuzzer support, right? </div><div>You can intercept your specific type of bug in the target function. </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
>> Also, one more thing, currently Libfuzzer does not catch SIGABRT and<br>
>> treat it as a fatal event. I've added a SIGABRT handler to my own code<br>
>> and moved StaticDeathCallback to public so I can call it from there.<br>
>><br>
> Again, this is asan, not libFuzzer.<br>
> You need ASAN_OPTIONS=handle_abort=1<br>
> I hope to make it the default soon-ish.<br>
<br>
</span>Ah, that would have made this work a bit simpler. Thanks.<br>
<br>
I have yet to really experiment with the sanitizers so I don't know if<br>
asan is really doing anything for me given Postgres's internal memory<br>
management. </blockquote><div><br></div><div>That might be an interesting separate topic to discuss. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I couldn't get msan running but it sounds more promising<br>
to me. </blockquote><div><br></div><div>If you have custom memory management, msan will be as tricky to use as asan. </div><div>Also, try ubsan for other kinds of bugs. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'll have to try again.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
greg<br>
</font></span></blockquote></div><br></div></div>