Skip to content

Commit 4cc10d4

Browse files
committed
[libFuzzer] in dfsan mode, set labels every time we start recording traces as opposed to doing it at process startup. This ensures that the labels are fresh.
llvm-svn: 244165
1 parent aa365b2 commit 4cc10d4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Fuzzer/FuzzerTraceState.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,9 @@ static TraceState *TS;
394394

395395
void Fuzzer::StartTraceRecording() {
396396
if (!TS) return;
397+
if (ReallyHaveDFSan())
398+
for (size_t i = 0; i < static_cast<size_t>(Options.MaxLen); i++)
399+
dfsan_set_label(i + 1, &CurrentUnit[i], 1);
397400
TS->StartTraceRecording();
398401
}
399402

@@ -417,7 +420,6 @@ void Fuzzer::InitializeTraceState() {
417420
dfsan_label L = dfsan_create_label("input", (void*)(i + 1));
418421
// We assume that no one else has called dfsan_create_label before.
419422
assert(L == i + 1);
420-
dfsan_set_label(L, &CurrentUnit[i], 1);
421423
}
422424
}
423425

0 commit comments

Comments
 (0)