[all-commits] [llvm/llvm-project] e5b603: [libFuzzer] don't use /dev/null for DiscardOuput i...

Marco Vanotti via All-commits all-commits at lists.llvm.org
Thu Nov 21 16:56:18 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e5b603a4c32044932c3a1d26ccbc7d43fec939d5
      https://github.com/llvm/llvm-project/commit/e5b603a4c32044932c3a1d26ccbc7d43fec939d5
  Author: Marco Vanotti <mvanotti at google.com>
  Date:   2019-11-21 (Thu, 21 Nov 2019)

  Changed paths:
    M compiler-rt/lib/fuzzer/FuzzerIO.h
    M compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp
    M compiler-rt/lib/fuzzer/FuzzerIOWindows.cpp
    M compiler-rt/lib/fuzzer/FuzzerUtil.h
    M compiler-rt/lib/fuzzer/FuzzerUtilDarwin.cpp
    M compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
    M compiler-rt/lib/fuzzer/FuzzerUtilLinux.cpp
    M compiler-rt/lib/fuzzer/FuzzerUtilWindows.cpp

  Log Message:
  -----------
  [libFuzzer] don't use /dev/null for DiscardOuput in Fuchsia.

Summary:

This commit moves the `DiscardOutput` function in FuzzerIO to
FuzzerUtil, so fuchsia can have its own specialized version.

In fuchsia, accessing `/dev/null` is not supported, and there's nothing
similar to a file that discards everything that is written to it. The
way of doing something similar in fuchsia is by using `fdio_null_create`
and binding that to a file descriptor with `fdio_bind_to_fd`.

This change should fix one of the issues with the `-close_fd_mask` flag
in libfuzzer, in which closing stdout was not working due to
`fopen("/dev/null", "w")` returning `NULL`.

Reviewers: kcc, aarongreen

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D69593




More information about the All-commits mailing list