[libFuzzer] Error and exit if user supplied fuzzer writeable directories don't exist
authorMatt Morehouse <mascasa@google.com>
Wed, 26 Aug 2020 16:06:12 +0000 (09:06 -0700)
committerMatt Morehouse <mascasa@google.com>
Wed, 26 Aug 2020 16:27:07 +0000 (09:27 -0700)
commit2392ff093af128d5e46ce31e2ffa0b3e17185e32
tree1633e0c31e18345a4ed14bad062fb740b44d7349
parent5b9c2b1bea78cdb62bad802b7d3d32dfeb1438a7
[libFuzzer] Error and exit if user supplied fuzzer writeable directories don't exist

Currently, libFuzzer will exit with an error message if a non-existent
corpus directory is provided. However, if a user provides a non-existent
directory for the `artifact_prefix`, `exact_artifact_path`, or
`features_dir`, libFuzzer will continue execution but silently fail to
write artifacts/features.

To improve the user experience, this PR adds validation for the existence of
all user supplied directories before executing the main fuzzing loop. If they
don't exist, libFuzzer will exit with an error message.

Patch By: dgg5503

Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D84808
compiler-rt/lib/fuzzer/FuzzerDriver.cpp
compiler-rt/lib/fuzzer/FuzzerIO.h
compiler-rt/lib/fuzzer/FuzzerIOPosix.cpp
compiler-rt/lib/fuzzer/FuzzerIOWindows.cpp
compiler-rt/test/fuzzer/fuzzer-dirs.test