summaryrefslogtreecommitdiff
path: root/lib/fuzzer/FuzzerTracePC.h
diff options
context:
space:
mode:
authorMax Moroz <mmoroz@chromium.org>2018-07-23 14:20:52 +0000
committerMax Moroz <mmoroz@chromium.org>2018-07-23 14:20:52 +0000
commitea5478cd34b2c48e5d75b468578744dd397a0f99 (patch)
treeab77c494fb875b77abb4913254964ef355450770 /lib/fuzzer/FuzzerTracePC.h
parent9e45fcd250e8f1acddba63f2d2bd90a353ad7d1c (diff)
[libFuzzer] Handle unstable edges by using minimum hit counts
Summary: Created unstable_handle flag that takes 1 or 2, depending on the handling type. Modified RunOne to accommodate the following heuristic: Use the first CollectFeatures to count how many features there are. If no new features, CollectFeatures like before. If there is new feature, we run CB 2 more times, Check which edges are unstable per input and we store the least amount of hit counts for each edge. Apply these hit counts back to inline8bitcounters so that CollectFeatures can work as intended. Modified UnstableCounters to 8int_t and created a bitset UnstableSet to tell which edges are unstable. Patch by Kyungtak Woo (@kevinwkt). Reviewers: Dor1s, metzman, morehouse Reviewed By: Dor1s, morehouse Subscribers: delcypher, #sanitizers, llvm-commits, kcc Differential Revision: https://reviews.llvm.org/D49525 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@337696 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/fuzzer/FuzzerTracePC.h')
-rw-r--r--lib/fuzzer/FuzzerTracePC.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/fuzzer/FuzzerTracePC.h b/lib/fuzzer/FuzzerTracePC.h
index b37989dbd..a051568c4 100644
--- a/lib/fuzzer/FuzzerTracePC.h
+++ b/lib/fuzzer/FuzzerTracePC.h
@@ -138,15 +138,16 @@ class TracePC {
bool ObservedFocusFunction();
void InitializeUnstableCounters();
- void UpdateUnstableCounters();
+ void UpdateUnstableCounters(int UnstableMode);
+ void ApplyUnstableCounters();
private:
- // Value used to represent unstable edge.
- static constexpr int16_t kUnstableCounter = -1;
+ struct UnstableEdge {
+ uint8_t Counter;
+ bool IsUnstable;
+ };
- // Uses 16-bit signed type to be able to accommodate any possible value from
- // uint8_t counter and -1 constant as well.
- int16_t UnstableCounters[kNumPCs];
+ UnstableEdge UnstableCounters[kNumPCs];
bool UseCounters = false;
uint32_t UseValueProfileMask = false;