[PATCH] D20943: [LibFuzzer] [WIP] Declare and use sanitizer functions in ``fuzzer::ExternalFunctions``

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 3 17:59:21 PDT 2016


kcc added inline comments.

================
Comment at: lib/Fuzzer/FuzzerExtFunctions.def:24
@@ +23,3 @@
+// Sanitizer functions
+EXT_FUNC(__sanitizer_print_stack_trace, void, (), true);
+EXT_FUNC(__sanitizer_reset_coverage, void, (), true);
----------------
This last boolean argument is hard to reason about.
BTW, I don't know why you need it at all. 
We must be able to link w./o any of those symbols (see test/UninstrumentedTest.cpp)

================
Comment at: lib/Fuzzer/FuzzerIO.cpp:126
@@ -128,3 +125,3 @@
       OutputFile = NewOutputFile;
-      if (__sanitizer_set_report_fd)
-        __sanitizer_set_report_fd(reinterpret_cast<void*>(OutputFd));
+      fuzzer::ExternalFunctions EF;
+      if (EF.__sanitizer_set_report_fd)
----------------
Ouch. That's becoming too annoying. 
Let's just have a singleton global object "fuzzer::ExternalFunctions *EF" that we initialized at startup
and delete all private instances. 


================
Comment at: lib/Fuzzer/FuzzerLoop.cpp:49
@@ -72,2 +48,3 @@
   do {                                                                         \
-    if (!fn)                                                                   \
+    /* FIXME: What a hack!*/                                                   \
+    if (!EF.fn)                                                                \
----------------
what do you want to fix here? 


http://reviews.llvm.org/D20943





More information about the llvm-commits mailing list