summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
diff options
context:
space:
mode:
authorMax Moroz <mmoroz@chromium.org>2018-07-24 21:02:44 +0000
committerMax Moroz <mmoroz@chromium.org>2018-07-24 21:02:44 +0000
commit8db0befc6d34c6db33ce8210faccdb5da6c2f670 (patch)
tree31bd8a4349b696ee33784e19d71f7171b1410b20 /compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
parent86d6320b94be365a2fbc2a0756aa568587ac4d71 (diff)
downloadbcm5719-llvm-8db0befc6d34c6db33ce8210faccdb5da6c2f670.tar.gz
bcm5719-llvm-8db0befc6d34c6db33ce8210faccdb5da6c2f670.zip
[libFuzzer] Handle unstable edges by disregarding unstable edges
Summary: Added a new mode within flag -handle_unstable for new unstable handling algorithm that does the following: When an edge is shown as unstable, copy to UnstableCounters the value 0. During ApplyUnstableCounters we copy back the value 0 to ModuleInline8bitCounters if the edge was unstable. This way we would be ignoring completely features that were collected through non-determinism. Unstable hits would be counted as if it never hit. Reviewers: metzman, Dor1s, kcc, morehouse Reviewed By: metzman, morehouse Subscribers: delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D49684 llvm-svn: 337853
Diffstat (limited to 'compiler-rt/lib/fuzzer/FuzzerTracePC.cpp')
-rw-r--r--compiler-rt/lib/fuzzer/FuzzerTracePC.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
index 859ff633373..29ffc8e34fc 100644
--- a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
@@ -83,11 +83,14 @@ void TracePC::InitializeUnstableCounters() {
// and records differences as unstable edges.
void TracePC::UpdateUnstableCounters(int UnstableMode) {
IterateInline8bitCounters([&](int i, int j, int UnstableIdx) {
- if (ModuleCounters[i].Start[j] != UnstableCounters[UnstableIdx].Counter)
+ if (ModuleCounters[i].Start[j] != UnstableCounters[UnstableIdx].Counter) {
UnstableCounters[UnstableIdx].IsUnstable = true;
- if (UnstableMode &&
- ModuleCounters[i].Start[j] < UnstableCounters[UnstableIdx].Counter)
- UnstableCounters[UnstableIdx].Counter = ModuleCounters[i].Start[j];
+ if (UnstableMode == ZeroUnstable)
+ UnstableCounters[UnstableIdx].Counter = 0;
+ else if (UnstableMode == MinUnstable)
+ UnstableCounters[UnstableIdx].Counter = std::min(
+ ModuleCounters[i].Start[j], UnstableCounters[UnstableIdx].Counter);
+ }
});
}
OpenPOWER on IntegriCloud