[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
Loading
Please register or sign in to comment