[all-commits] [llvm/llvm-project] 44aaca: [libFuzzer] Allow discarding output in ExecuteComm...
Marco Vanotti via All-commits
all-commits at lists.llvm.org
Fri Jan 17 12:15:58 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 44aaca3de4f4918b6178a28d855b153ab335e6a3
https://github.com/llvm/llvm-project/commit/44aaca3de4f4918b6178a28d855b153ab335e6a3
Author: Marco Vanotti <mvanotti at google.com>
Date: 2020-01-17 (Fri, 17 Jan 2020)
Changed paths:
M compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
Log Message:
-----------
[libFuzzer] Allow discarding output in ExecuteCommand in Fuchsia.
Summary:
This commit modifies the way `ExecuteCommand` works in fuchsia by adding
special logic to handle `/dev/null`.
The FuzzerCommand interface does not have a way to "discard" the output,
so other parts of the code just set the output file to `getDevNull()`.
The problem is that fuchsia does not have a named file that is
equivalent to `/dev/null`, so opening that file just fails.
This commit detects whether the specified output file is `getDevNull`,
and if that's the case, it will not copy the file descriptor for stdout
in the spawned process.
NOTE that modifying `FuzzerCommand` to add a "discardOutput" function
involves a significant refactor of all the other platforms, as they all
rely on the `toString()` method of `FuzzerCommand`.
This allows libfuzzer in fuchsia to run with `fork=1`, as the merge
process (`FuzzerMerge.cpp`) invoked `ExecuteCommand` with `/dev/null` as the
output.
Reviewers: aarongreen, phosek
Reviewed By: aarongreen
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D72894
More information about the All-commits
mailing list