diff options
author | Kostya Serebryany <kcc@google.com> | 2016-04-27 19:52:34 +0000 |
---|---|---|
committer | Kostya Serebryany <kcc@google.com> | 2016-04-27 19:52:34 +0000 |
commit | 7018a1aaa49ea109b30a5440daac45e9dbbd4e0d (patch) | |
tree | bf399ab2d68b726744af6cac168654e2ae79440f /llvm/lib/Fuzzer/FuzzerLoop.cpp | |
parent | 289bd5f6843ba3e7a7a1831ce59d25aedae75aae (diff) | |
download | bcm5719-llvm-7018a1aaa49ea109b30a5440daac45e9dbbd4e0d.tar.gz bcm5719-llvm-7018a1aaa49ea109b30a5440daac45e9dbbd4e0d.zip |
[libFuzzer] disable leak detection if we have tried it for 1000 times w/o finding a leak
llvm-svn: 267770
Diffstat (limited to 'llvm/lib/Fuzzer/FuzzerLoop.cpp')
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerLoop.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerLoop.cpp b/llvm/lib/Fuzzer/FuzzerLoop.cpp index cb3a789634e..3b0b339bf9c 100644 --- a/llvm/lib/Fuzzer/FuzzerLoop.cpp +++ b/llvm/lib/Fuzzer/FuzzerLoop.cpp @@ -557,6 +557,15 @@ void Fuzzer::TryDetectingAMemoryLeak(uint8_t *Data, size_t Size) { RunOneAndUpdateCorpus(Data, Size); __lsan_enable(); if (!HasMoreMallocsThanFrees) return; // a leak is unlikely. + if (NumberOfLeakDetectionAttempts++ > 1000) { + Options.DetectLeaks = false; + Printf("INFO: libFuzzer disabled leak detection after every mutation.\n" + " Most likely the target function accumulates allocated\n" + " memory in a global state w/o actually leaking it.\n" + " If LeakSanitizer is enabled in this process it will still\n" + " run on the process shutdown.\n"); + return; + } // Now perform the actual lsan pass. This is expensive and we must ensure // we don't call it too often. if (__lsan_do_recoverable_leak_check()) { // Leak is found, report it. |