[PATCH] D42414: [llvm-opt-fuzzer] Avoid adding incorrect inputs to the fuzzer corpus

Justin Bogner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 11:19:03 PST 2018


bogner added a comment.

I have mixed feelings about this, but I guess it's probably better than the status quo. My two main concerns are the time cost and whether we'll stop noticing the issues instead of fixing them.



================
Comment at: tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp:68-73
   if (verifyModule(*M, &errs())) {
     errs() << "mutation result doesn't pass verification\n";
     M->dump();
-    abort();
+    // Avoid adding incorrect test cases to the corpus.
+    return 0;
+  }
----------------
Can we drop this part and only verify after the reload?


================
Comment at: tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp:89-95
+  auto NewM = parseModule(
+      reinterpret_cast<const uint8_t*>(Buf.data()), Buf.size(), Context);
+  if (!NewM || verifyModule(*NewM, &errs())) {
+    errs() << "mutator failed to re-read the module\n";
+    M->dump();
+    return 0;
   }
----------------
Worth breaking out the parseAndVerify bit into its own function? We do it a lot now.


================
Comment at: tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp:92-93
+  if (!NewM || verifyModule(*NewM, &errs())) {
+    errs() << "mutator failed to re-read the module\n";
+    M->dump();
+    return 0;
----------------
Where does this output go when running the fuzzer? Will we see / be able to act on this information?


https://reviews.llvm.org/D42414





More information about the llvm-commits mailing list