diff options
author | Marco Vanotti <mvanotti@google.com> | 2020-01-16 17:20:20 -0800 |
---|---|---|
committer | Marco Vanotti <mvanotti@google.com> | 2020-01-17 12:15:46 -0800 |
commit | 44aaca3de4f4918b6178a28d855b153ab335e6a3 (patch) | |
tree | 106b5a3bbe18b86cc5f49d37535ef60a7b289503 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 447dcef79001ab5b842677bbada68624aa27e583 (diff) | |
download | llvm-44aaca3de4f4918b6178a28d855b153ab335e6a3.zip llvm-44aaca3de4f4918b6178a28d855b153ab335e6a3.tar.gz llvm-44aaca3de4f4918b6178a28d855b153ab335e6a3.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
0 files changed, 0 insertions, 0 deletions