[PATCH] D69085: [libFuzzer] don't change sanitizer_report_fd for fuchsia.

Marco Vanotti via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 23:53:27 PDT 2019


charco created this revision.
charco added a reviewer: aarongreen.
Herald added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers.

This commit modifies the `DupAndCloseStderr` function in FuzzerIO.cpp,
adding an if-macro to exclude calling sanitizer_set_report in fuchsia.

Fuchsia does not have support for that function and if it is called, the
program will crash because it is unimplemented.

Discarding the sanitizer reports from stderr is not an issue because
they are also being logged to the console and are available via `fx
syslog`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69085

Files:
  compiler-rt/lib/fuzzer/FuzzerIO.cpp


Index: compiler-rt/lib/fuzzer/FuzzerIO.cpp
===================================================================
--- compiler-rt/lib/fuzzer/FuzzerIO.cpp
+++ compiler-rt/lib/fuzzer/FuzzerIO.cpp
@@ -115,9 +115,14 @@
     FILE *NewOutputFile = OpenFile(OutputFd, "w");
     if (NewOutputFile) {
       OutputFile = NewOutputFile;
+#if !LIBFUZZER_FUCHSIA
+// Fuchsia does not support redirecting clang's reports to a file descriptor.
+// These reports are also logged to the console and show up via fx syslog so
+// it's not important if they are not in the fuzzer output.
       if (EF->__sanitizer_set_report_fd)
         EF->__sanitizer_set_report_fd(
             reinterpret_cast<void *>(GetHandleFromFd(OutputFd)));
+#endif
       DiscardOutput(2);
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69085.225358.patch
Type: text/x-patch
Size: 761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191017/c9c2a4ce/attachment.bin>


More information about the llvm-commits mailing list