[PATCH] D69082: [libFuzzer] Add fuchsia specific FuzzerIO.

Marco Vanotti via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 22:57:00 PDT 2019


charco created this revision.
charco added reviewers: jakehehrlich, aarongreen, phosek, mcgrathr.
Herald added subscribers: llvm-commits, Sanitizers, mgorny.
Herald added projects: Sanitizers, LLVM.

This commit copies over the FuzzerIOPosix into a version specific for
Fuchsia. Right now they are the same just to make the transition easier.
In future commits we will be adding some patches to fix some issues
where fuchsia behavior differs from a normal unix environment.

The motivation for this change is that in fuchsia, using the flag
`-close_fd_mask` is broken in two different ways:

- Fuchsia components do not support (yet) adding access to specific

devices (ej `/dev/null`), so it's not possible to "mute" stdout by
redirecting it to `/dev/null`.

- Fuchsia does not implement a way to change the fd for ASAN reports,

making it crash if `-close_fd_mask` is set to 2 or 3.

TEST=compiled and checked that libfuzzer still works in fuchsia.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69082

Files:
  compiler-rt/lib/fuzzer/CMakeLists.txt
  compiler-rt/lib/fuzzer/FuzzerIOFuchsia.cpp
  compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp


Index: compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp
===================================================================
--- compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp
+++ compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp
@@ -8,7 +8,7 @@
 // IO functions implementation using Posix API.
 //===----------------------------------------------------------------------===//
 #include "FuzzerDefs.h"
-#if LIBFUZZER_POSIX || LIBFUZZER_FUCHSIA
+#if LIBFUZZER_POSIX
 
 #include "FuzzerExtFunctions.h"
 #include "FuzzerIO.h"
Index: compiler-rt/lib/fuzzer/FuzzerIOFuchsia.cpp
===================================================================
--- compiler-rt/lib/fuzzer/FuzzerIOFuchsia.cpp
+++ compiler-rt/lib/fuzzer/FuzzerIOFuchsia.cpp
@@ -5,10 +5,10 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-// IO functions implementation using Posix API.
+// IO functions implementation using Fuchsia API.
 //===----------------------------------------------------------------------===//
 #include "FuzzerDefs.h"
-#if LIBFUZZER_POSIX || LIBFUZZER_FUCHSIA
+#if LIBFUZZER_FUCHSIA
 
 #include "FuzzerExtFunctions.h"
 #include "FuzzerIO.h"
Index: compiler-rt/lib/fuzzer/CMakeLists.txt
===================================================================
--- compiler-rt/lib/fuzzer/CMakeLists.txt
+++ compiler-rt/lib/fuzzer/CMakeLists.txt
@@ -8,6 +8,7 @@
   FuzzerExtraCounters.cpp
   FuzzerFork.cpp
   FuzzerIO.cpp
+  FuzzerIOFuchsia.cpp
   FuzzerIOPosix.cpp
   FuzzerIOWindows.cpp
   FuzzerLoop.cpp


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69082.225353.patch
Type: text/x-patch
Size: 1564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191017/286154fd/attachment.bin>


More information about the llvm-commits mailing list