summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/fuzzer/FuzzerLoop.cpp
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2019-01-31 01:40:14 +0000
committerKostya Serebryany <kcc@google.com>2019-01-31 01:40:14 +0000
commit23482e1d071ec6d05ddbae8eaffda3221260a35f (patch)
tree635e144de5fbfe5b79ffa1add2864578675bd823 /compiler-rt/lib/fuzzer/FuzzerLoop.cpp
parent2a64598ef2ec4841dd48483dc368da034d80d933 (diff)
downloadbcm5719-llvm-23482e1d071ec6d05ddbae8eaffda3221260a35f.tar.gz
bcm5719-llvm-23482e1d071ec6d05ddbae8eaffda3221260a35f.zip
[libFuzzer] set libFuzzer's own SEGV handler even one is already present, but call that handler from ours (unless we are unprotecting lazy counters). Call ProtectLazyCounters later, so that it runs after the initialization code in the target.
llvm-svn: 352713
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerLoop.cpp')
-rw-r--r--compiler-rt/lib/fuzzer/FuzzerLoop.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerLoop.cpp b/compiler-rt/lib/fuzzer/FuzzerLoop.cpp
index bf600169c4c..fb5aa1f11c1 100644
--- a/compiler-rt/lib/fuzzer/FuzzerLoop.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerLoop.cpp
@@ -205,11 +205,6 @@ void Fuzzer::StaticCrashSignalCallback() {
F->CrashCallback();
}
-void Fuzzer::StaticSegvSignalCallback(void *Addr) {
- if (TPC.UnprotectLazyCounters(Addr)) return;
- StaticCrashSignalCallback();
-}
-
void Fuzzer::StaticExitCallback() {
assert(F);
F->ExitCallback();
@@ -720,6 +715,10 @@ void Fuzzer::ReadAndExecuteSeedCorpora(const Vector<std::string> &CorpusDirs) {
uint8_t dummy = 0;
ExecuteCallback(&dummy, 0);
+ // Protect lazy counters here, after the once-init code has been executed.
+ if (Options.LazyCounters)
+ TPC.ProtectLazyCounters();
+
if (SizedFiles.empty()) {
Printf("INFO: A corpus is not provided, starting from an empty corpus\n");
Unit U({'\n'}); // Valid ASCII input.
OpenPOWER on IntegriCloud