<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi Kostya,</div><div class=""><br class=""></div><div class="">Thanks for getting back to me.</div><div class=""><br class=""></div><div class="">My work is somewhat similar to dfsan from high level but is specifically designed only to identify read regions of an input file. It uses the foundmental sanitizer infrastructure, so if dfsan can be integrated with libfuzzer, I think my work can as well.</div><div class=""><br class=""></div><div class="">Regarding dfsan with libfuzzer, can you refresh me why it was removed?</div><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-position: 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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class="Apple-interchange-newline">_________________________</div><div class="">Shuyang Wang</div><div class=""><div style="margin: 0px;" class="">Security Engineering & Architecture</div></div><div style="margin: 0px;" class=""><br class=""></div><div class=""><br class=""></div></div><br class="Apple-interchange-newline" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-position: 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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class="Apple-interchange-newline"></div></div></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Jul 13, 2017, at 2:04 PM, Kostya Serebryany <<a href="mailto:kcc@google.com" class="">kcc@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">This topic pops up regularly when discussing fuzzers, and not only for sparse input formats. <div class="">I hope to eventually have a reasonable solution in libFuzzer itself. </div><div class="">One way is to couple libFuzzer with dfsan (I even had some code for this, but removed it later). </div><div class=""><br class=""></div><div class="">In the mean time, contribution is very welcome in various forms: </div><div class="">* add micro fuzzing tests (puzzles) to <a href="https://github.com/llvm-mirror/llvm/tree/master/lib/Fuzzer/test" class="">https://github.com/llvm-mirror/llvm/tree/master/lib/Fuzzer/test</a></div><div class="">* add real-life examples to <a href="https://github.com/google/fuzzer-test-suite/" class="">https://github.com/google/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 class=""><br class=""></div><div class=""><br class=""></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Jul 12, 2017 at 1:54 PM, Shuyang Wang <span dir="ltr" class=""><<a href="mailto:swang2@apple.com" target="_blank" class="">swang2@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div dir="auto" style="word-wrap:break-word" class=""><div dir="auto" style="word-wrap:break-word" class=""><div dir="auto" style="word-wrap:break-word" class=""><div class=""><div class="">Hi everyone,</div><div class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class="">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 class=""><br class=""></div><div class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><div style="letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; word-wrap: break-word;" class=""><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;" class=""><div class="">_________________________</div><span class="HOEnZb"><font color="#888888" class=""><div class="">Shuyang Wang</div><div class=""><div style="margin:0px" class="">Apple</div></div><div style="margin:0px" class=""><br class=""></div><div class=""><br class=""></div></font></span></div><br class="m_-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_-8659859129620214144Apple-interchange-newline"></div></div></div>
</div>
<br class=""></div></div></div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></body></html>