<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 5, 2017 at 2:47 AM, Michal Privoznik <span dir="ltr"><<a href="mailto:mprivozn@redhat.com" target="_blank">mprivozn@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 04.03.2017 07:23, Da L wrote:<br>
> Dear all,<br>
><br>
<br>
Hey,<br>
<span class="gmail-m_-6871709607787070843gmail-"><br>
> This is my first post in the list.<br>
<br>
</span>Very well. Welcome. It is always nice to see people interested in libvirt.<br>
<span class="gmail-m_-6871709607787070843gmail-"><br></span></blockquote><div>Hi Michal,</div><div><br></div><div>Thank you very much for the explanation and encouragement. </div><div>I am so glad to join the community. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-m_-6871709607787070843gmail-">
><br>
> I am currently a graduate student studying computer science, particularly<br>
> interested in visualization technologies and I have been using QEMU for a<br>
> variety of projects for a while. Two of the courses that I am taking this<br>
> semester really attracted me to the libvirt community  are Advanced<br>
> Operating Systems and Secure Software Development. I have been learning<br>
> kernel fuzzing as well as other general fuzzing tools.<br>
><br>
> Then I found the topic of "QEMU command line generator XML fuzzing" is<br>
> pretty interesting and totally in line with my interest and background.<br>
> Though I have read through the documentations on the website, just to make<br>
> sure I am doing it correctly, could anyone confirm this project is still<br>
> available? And what I need to do next in order to participate the project<br>
> this summer? Do I need to find a mentor by myself? Potentially, I could<br>
> find my OS or Security professor as my mentor, but I am not sure yet which<br>
> would be the best way.<br>
<br>
</span>Yes, the project is still on. It does not have a mentor assigned yet,<br>
but don't worry about that now - there is a lot of mentors around. For<br>
now, I can be your point of contact.<br>
<br>
So, just to explain you some details of the project: libvirt's format<br>
for storing domain configuration is XML. However, none of the<br>
hypervisors out there uses XML to describe domain configuration. For<br>
instance, in qemu it's all about the command line. You want this disk<br>
for you domain? You have to put it onto the command line. And so on.<br>
Therefore, in a very simplistic way, for qemu libvirt translates the XML<br>
into qemu command line language. Now, this process is very complex and<br>
sort of tricky. That's why we would like to generate "all" possible<br>
combinations of XML, let the command line generator crunch them and<br>
produce qemu command line. Well, that's not entirely true, because<br>
command line generator works over some internal representation of domain<br>
(not XML) that is produced by our XML parser:<br>
<br></blockquote><div>Please correct me if I am wrong about  my following understanding:</div><div>1. Regarding XML config file, one typical usage with libvirt could be:</div><div>    $ virsh define <<a href="http://your_xml_config_file.ml" target="_blank">domain_config_file.xml</a>></div><div>2. I noticed in the source code of libvirt, there exist several files in close relation </div><div>to xml, including src/util/virxml.{c,h}, which might be the target of this project?</div><div>3. And libvirt also is compiled with libxml2. </div><div>4. Then in virt-xml-validate, which is a bash script, </div><div>  (in build/bin directory after make install) calling xmllint.</div><div><br></div><div>I have not been able to get round to figure out the relations of the above pieces yet. </div><div>I spent some time to try to instrument and compile the executables with AFL, but so</div><div> far with no luck. (The idea is as simple as changing gcc in Makefile/configure to afl-gcc). </div><div>The attached figure is just a demo showing using AFL to fuzz virt-admin, which is </div><div>not instrumented, (so kinda of boring and not quite useful). But I think AFL could be</div><div> one of the candidate as a fuzzer for this project due its prevalence and </div><div>proved effectiveness. </div><div><br></div><div>Regarding fuzzing, I think we can try several fuzzing tools to run in parallel, as different</div><div> fuzzers tend to find different kinds of bugs. Thus, AFL (American Fuzz Lop) [1], </div><div>which is a coverage-guided mutation-based fuzzer with genetic algorithm, can </div><div>take hand-crafted xml seed to fuzz our libvert target. Alternatively, we could </div><div>develop generation-based grammar module in AFL (which is definitely non-trivial);</div><div>so far I have not seen active development in AFL community on xml format </div><div>grammar generation. Another option could be clang-libfuzzer [2].</div><div><br></div><div>Several related articles show examples of fuzzing are using AFL to generate </div><div>SQL [3], llvm-afl [4], and hexml fuzzing with AFL [5]. In combination with lcov, we</div><div> could compare different fuzzers and guide our fuzzing tuning.</div><div><br></div><div>NOTE  the [5] example is quite interesting; it is fuzzing a haskell-written xml paser.</div><div><br></div><div>I will probably not update more until next week; I am having three mid-terms this week.</div><div><br></div><div>[1] <a href="http://lcamtuf.coredump.cx/afl/" target="_blank">http://lcamtuf.coredump.<wbr>cx/afl/</a></div><div>[2] <a href="http://llvm.org/docs/LibFuzzer.html" target="_blank">http://llvm.org/docs/<wbr>LibFuzzer.html</a></div><div>[3] <a href="https://lcamtuf.blogspot.com/2015/01/afl-fuzz-making-up-grammar-with.html">https://lcamtuf.blogspot.com/2015/01/afl-fuzz-making-up-grammar-with.html</a></div><div>[4] <a href="http://lists.llvm.org/pipermail/llvm-dev/2014-December/079390.html">http://lists.llvm.org/pipermail/llvm-dev/2014-December/079390.html</a></div><div>[5] <a href="https://github.com/ndmitchell/hexml/issues/6">https://github.com/ndmitchell/hexml/issues/6</a></div><div><br></div><div>Again, thanks a lot. Any guidance, comments, or suggestions would be more than </div><div>welcome and highly appreciated.</div><div><br></div><div>Best,</div><div><br></div><div><br>Dan</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  XML document -> XML parser -> QEMU cmd line generator -> QEMU cmd line<br>
<br>
There is plenty of fuzzing libraries available on the market, so I guess<br>
one of the first steps would be to explore our options and pick one that<br>
suits our needs. Do you have experience with any of them? Frankly, I<br>
have very little.<br>
<br>
Regarding the GSoC process, each organization makes their own rules for<br>
accepting students. Here at libvirt the rules are described here:<br>
<br>
  <a href="http://wiki.libvirt.org/page/Google_Summer_of_Code_FAQ" rel="noreferrer" target="_blank">http://wiki.libvirt.org/page/G<wbr>oogle_Summer_of_Code_FAQ</a><br>
<br>
Please let me know what are your thoughts on all of this, and also don't<br>
hesitate to ask anything.<br>
<span class="gmail-m_-6871709607787070843gmail-HOEnZb"><font color="#888888"><br>
Michal<br>
<br>
</font></span></blockquote></div><br></div></div>