llvm-project/compiler-rt/lib/fuzzer
Aaron Green 5de8c7f138 [fuzzer][fuchsia] Close exception channel before exiting.
On Fuchsia, killing or exiting a process that has a thread listening to its own process's debugger exception channel can hang. Zircon may kill all the threads, send a synthetic exceptions to debugger, and wait for the debugger to have received them. This means the thread listening to the debug exception channel may be killed even as Zircon is waiting for that thread to drain the exception channel, and the process can become stuck in a half-dead state.

This situation is "weird" as it only arises when a process is trying to debug itself. Unfortunately, this is exactly the scenario for libFuzzer on Fuchsia: FuzzerUtilFuchsia spawns a crash-handling thread that acts like a debugger in order to be able to rewrite the crashed threads stack and resume them into libFuzzer's usual POSIX signal handlers. In practice, approximately 25% of fuzzers appear to hang on exit, after generating output and artifacts. These processes hang around until the platform is torn done, which is typically a ClusterFuzz VM. Thus, real-world impact has been somewhat mitigated. The issue should still be resolved for local users, though.

This change improves the behavior of exit() in libFuzzer by adding an atexit handler which closes an event shared with the crash handling thread. This signals to the crash handler that it should close the exception channel and be joined before the process actually exits.

Reviewed By: charco

Differential Revision: https://reviews.llvm.org/D109258
2021-09-16 11:57:12 -07:00
..
afl [Sanitizers] Remove OpenBSD support (new attempt) 2020-10-20 11:16:09 +01:00
dataflow [libfuzzer] Disable failing DFSan-related tests 2021-06-19 01:09:19 +00:00
scripts [libFuzzer] remove the data-flow-trace (DFT) python scripts; their functionality is now part of libFuzzer proper; also write functions.txt to the disk only if this file doesn't exist yet 2019-05-23 01:03:42 +00:00
standalone
tests [compiler-rt][fuzzer] Do not link in libc++ in tests and disable exceptions 2021-09-08 11:45:52 -07:00
CMakeLists.txt [compiler-rt] NFC: Fix trivial typo 2021-09-04 14:12:58 +05:30
FuzzerBuiltins.h [crt][fuzzer] Fix up various numeric conversions 2021-03-11 16:01:28 -08:00
FuzzerBuiltinsMsvc.h [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerCommand.h [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerCorpus.h [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerCrossOver.cpp Revert "Refactor mutation strategies into a standalone library" 2021-07-02 09:45:11 -07:00
FuzzerDataFlowTrace.cpp [compiler-rt] NFC: Fix trivial typo 2021-09-04 14:12:58 +05:30
FuzzerDataFlowTrace.h [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerDefs.h [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerDictionary.h [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerDriver.cpp Redistribute energy for Corpus 2021-09-08 09:22:45 -07:00
FuzzerExtFunctions.def [libFuzzer] Always print DSO map on Fuchsia libFuzzer launch 2019-09-17 00:34:41 +00:00
FuzzerExtFunctions.h
FuzzerExtFunctionsDlsym.cpp [libFuzzer] Separate platform related macros out from FuzzerDefs.h into FuzzerPlatform.h, and adjust includes in other files. 2020-07-14 21:31:56 +00:00
FuzzerExtFunctionsWeak.cpp [Sanitizers] Remove OpenBSD support (new attempt) 2020-10-20 11:16:09 +01:00
FuzzerExtFunctionsWindows.cpp [libFuzzer] Separate platform related macros out from FuzzerDefs.h into FuzzerPlatform.h, and adjust includes in other files. 2020-07-14 21:31:56 +00:00
FuzzerExtraCounters.cpp Enable extra coverage counters on Windows 2021-08-05 11:40:15 -07:00
FuzzerExtraCountersDarwin.cpp [libFuzzer] Add missing include on Darwin. 2021-08-05 12:27:13 -07:00
FuzzerExtraCountersWindows.cpp [fuzzer] Fix building on case sensitive mingw platforms 2021-08-06 08:53:13 +03:00
FuzzerFlags.def Redistribute energy for Corpus 2021-09-08 09:22:45 -07:00
FuzzerFork.cpp [libFuzzer] Add missing argument to CrashResistantMerge. 2021-09-08 11:48:33 -07:00
FuzzerFork.h [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerIO.cpp [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerIO.h [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerIOPosix.cpp [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerIOWindows.cpp [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerInterceptors.cpp [fuzzer] Fix build on musl 2021-06-13 12:32:07 -07:00
FuzzerInterface.h
FuzzerInternal.h Greedy set cover implementation of `Merger::Merge` 2021-09-07 09:42:38 -07:00
FuzzerLoop.cpp [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerMain.cpp [libFuzzer] Separate platform related macros out from FuzzerDefs.h into FuzzerPlatform.h, and adjust includes in other files. 2020-07-14 21:31:56 +00:00
FuzzerMerge.cpp Greedy set cover implementation of `Merger::Merge` 2021-09-07 09:42:38 -07:00
FuzzerMerge.h Greedy set cover implementation of `Merger::Merge` 2021-09-07 09:42:38 -07:00
FuzzerMutate.cpp [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerMutate.h [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerOptions.h Redistribute energy for Corpus 2021-09-08 09:22:45 -07:00
FuzzerPlatform.h [Sanitizers] Remove OpenBSD support (new attempt) 2020-10-20 11:16:09 +01:00
FuzzerRandom.h Revert "Refactor mutation strategies into a standalone library" 2021-07-02 09:45:11 -07:00
FuzzerSHA1.cpp [crt][fuzzer] Fix up various numeric conversions 2021-03-11 16:01:28 -08:00
FuzzerSHA1.h
FuzzerTracePC.cpp [compiler-rt] NFC: Fix trivial typo 2021-09-04 14:12:58 +05:30
FuzzerTracePC.h [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerUtil.cpp [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerUtil.h [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerUtilDarwin.cpp [libFuzzer] Separate platform related macros out from FuzzerDefs.h into FuzzerPlatform.h, and adjust includes in other files. 2020-07-14 21:31:56 +00:00
FuzzerUtilFuchsia.cpp [fuzzer][fuchsia] Close exception channel before exiting. 2021-09-16 11:57:12 -07:00
FuzzerUtilLinux.cpp [Sanitizers] Remove OpenBSD support (new attempt) 2020-10-20 11:16:09 +01:00
FuzzerUtilPosix.cpp Revert "Refactor mutation strategies into a standalone library" 2021-07-02 09:45:11 -07:00
FuzzerUtilWindows.cpp [libFuzzer] replace Vector/Set with std::vector/std::set. The custom names are not required any more since we now build with a private version of libc++. Fix some of the 81+ character lines. Mechanical change, NFC expected. 2021-08-03 11:31:04 -07:00
FuzzerValueBitMap.h [libFuzzer] Separate platform related macros out from FuzzerDefs.h into FuzzerPlatform.h, and adjust includes in other files. 2020-07-14 21:31:56 +00:00
README.txt
build.sh Revert "Refactor mutation strategies into a standalone library" 2021-07-02 09:45:11 -07:00

README.txt

See http://llvm.org/docs/LibFuzzer.html