[PATCH] D28438: [libFuzzer] Update implementation of sanitizer coverage to work when guards are initialized to 0xffffffff.

Marcos Pividori via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 20:44:22 PST 2017


mpividori created this revision.
mpividori added reviewers: kcc, aizatsky, rnk, zturner.
mpividori added a subscriber: llvm-commits.
mpividori set the repository for this revision to rL LLVM.

Update sanitizer coverage implementation according to the changes mentioned in: https://reviews.llvm.org/D28436


Repository:
  rL LLVM

https://reviews.llvm.org/D28438

Files:
  lib/Fuzzer/FuzzerTracePC.cpp


Index: lib/Fuzzer/FuzzerTracePC.cpp
===================================================================
--- lib/Fuzzer/FuzzerTracePC.cpp
+++ lib/Fuzzer/FuzzerTracePC.cpp
@@ -44,10 +44,15 @@
 }
 
 void TracePC::HandleInit(uint32_t *Start, uint32_t *Stop) {
-  if (Start == Stop || *Start) return;
+  if (Start == Stop) return;
   assert(NumModules < sizeof(Modules) / sizeof(Modules[0]));
   for (uint32_t *P = Start; P < Stop; P++)
-    *P = ++NumGuards;
+    // Ignore zero padding.
+    if (*P) {
+      if (*P != 0xffffffff) // This module was initialized before.
+        return;
+      *P = ++NumGuards;
+    }
   Modules[NumModules].Start = Start;
   Modules[NumModules].Stop = Stop;
   NumModules++;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28438.83500.patch
Type: text/x-patch
Size: 707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170107/fb81c002/attachment.bin>


More information about the llvm-commits mailing list