]> granicus.if.org Git - llvm/commitdiff
[libFuzzer] AlrmHandler is executed in a different thread for Windows.
authorMarcos Pividori <mpividori@google.com>
Sun, 22 Jan 2017 01:58:59 +0000 (01:58 +0000)
committerMarcos Pividori <mpividori@google.com>
Sun, 22 Jan 2017 01:58:59 +0000 (01:58 +0000)
Don't check for InFuzzingThread() on Windows, since the AlarmHandler() is
always executed by a different thread from a thread pool.
If we don't add these changes, the alarm handler will never execute.
Note that we decided to ignore possible problem in the synchronization.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292746 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Fuzzer/FuzzerLoop.cpp

index 63dd7315572759f82528648e13c940c91305cdcf..861ab13e686f3dde880d729d3f787c46a9909863 100644 (file)
@@ -296,7 +296,10 @@ void Fuzzer::InterruptCallback() {
 NO_SANITIZE_MEMORY
 void Fuzzer::AlarmCallback() {
   assert(Options.UnitTimeoutSec > 0);
+  // In Windows Alarm callback is executed by a different thread.
+#if !LIBFUZZER_WINDOWS
   if (!InFuzzingThread()) return;
+#endif
   if (!RunningCB)
     return; // We have not started running units yet.
   size_t Seconds =