[libFuzzer] in dfsan mode, set labels every time we start recording traces as opposed...
authorKostya Serebryany <kcc@google.com>
Wed, 5 Aug 2015 23:02:57 +0000 (23:02 +0000)
committerKostya Serebryany <kcc@google.com>
Wed, 5 Aug 2015 23:02:57 +0000 (23:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244165 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Fuzzer/FuzzerTraceState.cpp

index 13635a7..c6f7c9e 100644 (file)
@@ -394,6 +394,9 @@ static TraceState *TS;
 
 void Fuzzer::StartTraceRecording() {
   if (!TS) return;
+  if (ReallyHaveDFSan())
+    for (size_t i = 0; i < static_cast<size_t>(Options.MaxLen); i++)
+      dfsan_set_label(i + 1, &CurrentUnit[i], 1);
   TS->StartTraceRecording();
 }
 
@@ -417,7 +420,6 @@ void Fuzzer::InitializeTraceState() {
     dfsan_label L = dfsan_create_label("input", (void*)(i + 1));
     // We assume that no one else has called dfsan_create_label before.
     assert(L == i + 1);
-    dfsan_set_label(L, &CurrentUnit[i], 1);
   }
 }