[PATCH] D68724: [libFuzzer] Fix Alarm callback in fuchsia.

Marco Vanotti via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 13:19:35 PDT 2019


charco created this revision.
charco added reviewers: mcgrathr, jakehehrlich, phosek, kcc.
Herald added subscribers: llvm-commits, Sanitizers, kristof.beyls, krytarowski.
Herald added projects: Sanitizers, LLVM.
jakehehrlich accepted this revision.
jakehehrlich added a comment.
This revision is now accepted and ready to land.

LGTM except a nit



================
Comment at: compiler-rt/lib/fuzzer/FuzzerLoop.cpp:276-277
   assert(Options.UnitTimeoutSec > 0);
   // In Windows Alarm callback is executed by a different thread.
   // NetBSD's current behavior needs this change too.
+#if !LIBFUZZER_WINDOWS && !LIBFUZZER_NETBSD && !LIBFUZZER_FUCHSIA
----------------
Can you mention that Fuchsia does the same thing as windows here?


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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68724

Files:
  compiler-rt/lib/fuzzer/FuzzerLoop.cpp


Index: compiler-rt/lib/fuzzer/FuzzerLoop.cpp
===================================================================
--- compiler-rt/lib/fuzzer/FuzzerLoop.cpp
+++ compiler-rt/lib/fuzzer/FuzzerLoop.cpp
@@ -275,7 +275,7 @@
   assert(Options.UnitTimeoutSec > 0);
   // In Windows 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68724.224139.patch
Type: text/x-patch
Size: 538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191009/65b7c2c2/attachment.bin>


More information about the llvm-commits mailing list