commit | e7bfce78636905d58300bea42861f2f35acdda77 | [log] [tgz] |
---|---|---|
author | Jake Ehrlich <[email protected]> | Wed Oct 09 21:01:50 2019 |
committer | Jake Ehrlich <[email protected]> | Wed Oct 09 21:01:50 2019 |
tree | f5b712d30fed37b536b8edafc69a1aa9042a8793 | |
parent | c0da1282fc036908cc721ee74f574fbb99d5e506 [diff] [blame] |
[libFuzzer] Fix Alarm callback in fuchsia. This patch adds an #if macro to skip the InFuzzingThread() comparison for fuchsia, similar to what it is done for Windows and NetBSD. In fuchsia, the alarm callback runs in a separate thread[0], making it fail the comparison InFuzzingThread(), breaking the -timeout flag. [0]: https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp#L323 Author: charco (aka Marco Vanotti) Differential Revision: https://reviews.llvm.org/D68166 llvm-svn: 374228
diff --git a/compiler-rt/lib/fuzzer/FuzzerLoop.cpp b/compiler-rt/lib/fuzzer/FuzzerLoop.cpp index df533e8..451a4c1 100644 --- a/compiler-rt/lib/fuzzer/FuzzerLoop.cpp +++ b/compiler-rt/lib/fuzzer/FuzzerLoop.cpp
@@ -273,9 +273,9 @@ NO_SANITIZE_MEMORY void Fuzzer::AlarmCallback() { assert(Options.UnitTimeoutSec > 0); - // In Windows Alarm callback is executed by a different thread. + // In Windows and Fuchsia, Alarm callback is executed by a different thread. // NetBSD's current behavior needs this change too. -#if !LIBFUZZER_WINDOWS && !LIBFUZZER_NETBSD +#if !LIBFUZZER_WINDOWS && !LIBFUZZER_NETBSD && !LIBFUZZER_FUCHSIA if (!InFuzzingThread()) return; #endif