<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 14, 2017 at 3:40 PM, Shuyang Wang <span dir="ltr"><<a href="mailto:swang2@apple.com" target="_blank">swang2@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>Hi Kostya,</div><div><br></div><div>Thanks for getting back to me.</div><div><br></div><div>My work is somewhat similar to dfsan from high level but is specifically designed only to identify read regions of an input file.</div></div></blockquote><div><br></div><div>.. which is probably good :) </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div> It uses the foundmental sanitizer infrastructure, so if dfsan can be integrated with libfuzzer, I think my work can as well.</div><div><br></div><div>Regarding dfsan with libfuzzer, can you refresh me why it was removed?</div></div></blockquote><div><br></div><div>it was not used anywhere and prevented me from doing large refactoring. </div><div>I do want to reinstate it, or something similar. </div><div><br></div><div>--kcc </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>
<div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div><br class="m_3072045955435965624Apple-interchange-newline">_________________________</div><span class="HOEnZb"><font color="#888888"><div>Shuyang Wang</div><div><div style="margin:0px">Security Engineering & Architecture</div></div><div style="margin:0px"><br></div><div><br></div></font></span></div><br class="m_3072045955435965624Apple-interchange-newline" style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br class="m_3072045955435965624Apple-interchange-newline"></div></div></div>
</div><div><div class="h5">
<br><div><blockquote type="cite"><div>On Jul 13, 2017, at 2:04 PM, Kostya Serebryany <<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>> wrote:</div><br class="m_3072045955435965624Apple-interchange-newline"><div><div dir="ltr">This topic pops up regularly when discussing fuzzers, and not only for sparse input formats. <div>I hope to eventually have a reasonable solution in libFuzzer itself. </div><div>One way is to couple libFuzzer with dfsan (I even had some code for this, but removed it later). </div><div><br></div><div>In the mean time, contribution is very welcome in various forms: </div><div>* add micro fuzzing tests (puzzles) to <a href="https://github.com/llvm-mirror/llvm/tree/master/lib/Fuzzer/test" target="_blank">https://github.com/llvm-<wbr>mirror/llvm/tree/master/lib/<wbr>Fuzzer/test</a></div><div>* add real-life examples to <a href="https://github.com/google/fuzzer-test-suite/" target="_blank">https://github.com/google/<wbr>fuzzer-test-suite/</a></div>* add standalone "custom mutator" (see LLVMFuzzerCustomMutator) that uses your tool to apply mutations only to the relevant parts of the input. <div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 12, 2017 at 1:54 PM, Shuyang Wang <span dir="ltr"><<a href="mailto:swang2@apple.com" target="_blank">swang2@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div dir="auto" style="word-wrap:break-word"><div dir="auto" style="word-wrap:break-word"><div dir="auto" style="word-wrap:break-word"><div><div>Hi everyone,</div><div><br></div><div>I wrote a prototype based on LLVM sanitizer infrastructure to improve fuzzing performance, especially over sparse file format. I’d like to upstream it if the anyone thinks it is useful.</div><div><br></div><div>Sparse file format are formats that only a small portion of the file data could have impact on the behavior of the program that parses it. Common examples are archive files or a file system image where only metadata would affect program behavior. When fuzzing those formats, a general fuzzer will randomly select ranges to mutate. Because of the sparse nature of the formats, random range selection has a high probability to hit the "wholes" where data have no influence on the parser. While applying trim over the input could sometimes improve the effective range hit rate, it would not always work. For instance, some program may pose a minimum file size requirement which turns to be fairly large for fuzzing, or the effective ranges are sparsely distributed over an entire file instead of being centralized in the beginning.</div><div><br></div><div>The tool I wrote leverages the observation that a piece of data would only have influence on its parser's behavior only if the data is at least read out by the parser, and the read regions of a sparse file is usually pretty small compared to the entire file. By generating an read map for each input and feeding the map to a modified fuzzer that prioritizes mutating those ranges, we noticed over 10X performance improvement in path discovery at bootstrap time in our test. The modified fuzzer was also able to find crashes in 0.5 hour where the original version couldn't find in 72 hours when we ended the test.</div><div><br></div><div>The high level idea about how the tool works is it uses an instrumentation pass to record any memory read in shadow memory, while a runtime tracks buffer propagation from a user specified buffer (the initial buffer a file is read into), and coalesces shadow memory for these buffers. A read map can be generated for each input file with the instrumented binary.</div><div><br></div><div>I hope this is interesting to some people and I can provide more details. The prototype is not ready to upstream yet, but I would like to work on it if the community is interested.</div></div><div><br></div><div><div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word"><div>_________________________</div><span class="m_3072045955435965624HOEnZb"><font color="#888888"><div>Shuyang Wang</div><div><div style="margin:0px">Apple</div></div><div style="margin:0px"><br></div><div><br></div></font></span></div><br class="m_3072045955435965624m_-8659859129620214144Apple-interchange-newline" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br class="m_3072045955435965624m_-8659859129620214144Apple-interchange-newline"></div></div></div>
</div>
<br></div></div></div></div></blockquote></div><br></div>
</div></blockquote></div><br></div></div></div></blockquote></div><br></div></div>