[compiler-rt] r334146 - [libFuzzer] remove an experimental flag -use_feature_frequency
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 6 16:24:42 PDT 2018
Author: kcc
Date: Wed Jun 6 16:24:41 2018
New Revision: 334146
URL: http://llvm.org/viewvc/llvm-project?rev=334146&view=rev
Log:
[libFuzzer] remove an experimental flag -use_feature_frequency
Modified:
compiler-rt/trunk/lib/fuzzer/FuzzerCorpus.h
compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp
compiler-rt/trunk/lib/fuzzer/FuzzerFlags.def
compiler-rt/trunk/lib/fuzzer/FuzzerLoop.cpp
compiler-rt/trunk/lib/fuzzer/FuzzerOptions.h
Modified: compiler-rt/trunk/lib/fuzzer/FuzzerCorpus.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerCorpus.h?rev=334146&r1=334145&r2=334146&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerCorpus.h (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerCorpus.h Wed Jun 6 16:24:41 2018
@@ -37,7 +37,6 @@ struct InputInfo {
bool Reduced = false;
bool HasFocusFunction = false;
Vector<uint32_t> UniqFeatureSet;
- float FeatureFrequencyScore = 1.0;
};
class InputCorpus {
@@ -46,7 +45,6 @@ class InputCorpus {
InputCorpus(const std::string &OutputCorpus) : OutputCorpus(OutputCorpus) {
memset(InputSizesPerFeature, 0, sizeof(InputSizesPerFeature));
memset(SmallestElementPerFeature, 0, sizeof(SmallestElementPerFeature));
- memset(FeatureFrequency, 0, sizeof(FeatureFrequency));
}
~InputCorpus() {
for (auto II : Inputs)
@@ -222,20 +220,6 @@ class InputCorpus {
return false;
}
- void UpdateFeatureFrequency(size_t Idx) {
- FeatureFrequency[Idx % kFeatureSetSize]++;
- }
- float GetFeatureFrequency(size_t Idx) const {
- return FeatureFrequency[Idx % kFeatureSetSize];
- }
- void UpdateFeatureFrequencyScore(InputInfo *II) {
- const float kMin = 0.01, kMax = 100.;
- II->FeatureFrequencyScore = kMin;
- for (auto Idx : II->UniqFeatureSet)
- II->FeatureFrequencyScore += 1. / (GetFeatureFrequency(Idx) + 1.);
- II->FeatureFrequencyScore = Min(II->FeatureFrequencyScore, kMax);
- }
-
size_t NumFeatures() const { return NumAddedFeatures; }
size_t NumFeatureUpdates() const { return NumUpdatedFeatures; }
@@ -273,15 +257,11 @@ private:
std::iota(Intervals.begin(), Intervals.end(), 0);
for (size_t i = 0; i < N; i++)
Weights[i] = Inputs[i]->NumFeatures
- ? (i + 1) * Inputs[i]->FeatureFrequencyScore
- * (Inputs[i]->HasFocusFunction ? 1000 : 1)
+ ? (i + 1) * (Inputs[i]->HasFocusFunction ? 1000 : 1)
: 0.;
if (FeatureDebug) {
for (size_t i = 0; i < N; i++)
Printf("%zd ", Inputs[i]->NumFeatures);
- Printf("NUM\n");
- for (size_t i = 0; i < N; i++)
- Printf("%f ", Inputs[i]->FeatureFrequencyScore);
Printf("SCORE\n");
for (size_t i = 0; i < N; i++)
Printf("%f ", Weights[i]);
@@ -302,7 +282,6 @@ private:
size_t NumUpdatedFeatures = 0;
uint32_t InputSizesPerFeature[kFeatureSetSize];
uint32_t SmallestElementPerFeature[kFeatureSetSize];
- float FeatureFrequency[kFeatureSetSize];
std::string OutputCorpus;
};
Modified: compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp?rev=334146&r1=334145&r2=334146&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerDriver.cpp Wed Jun 6 16:24:41 2018
@@ -616,7 +616,6 @@ int FuzzerDriver(int *argc, char ***argv
Options.PrintCorpusStats = Flags.print_corpus_stats;
Options.PrintCoverage = Flags.print_coverage;
Options.DumpCoverage = Flags.dump_coverage;
- Options.UseFeatureFrequency = Flags.use_feature_frequency;
if (Flags.exit_on_src_pos)
Options.ExitOnSrcPos = Flags.exit_on_src_pos;
if (Flags.exit_on_item)
Modified: compiler-rt/trunk/lib/fuzzer/FuzzerFlags.def
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerFlags.def?rev=334146&r1=334145&r2=334146&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerFlags.def (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerFlags.def Wed Jun 6 16:24:41 2018
@@ -152,6 +152,4 @@ FUZZER_DEPRECATED_FLAG(run_equivalence_s
FUZZER_DEPRECATED_FLAG(use_equivalence_server)
FUZZER_FLAG_INT(analyze_dict, 0, "Experimental")
FUZZER_DEPRECATED_FLAG(use_clang_coverage)
-FUZZER_FLAG_INT(use_feature_frequency, 0, "Experimental/internal")
-
FUZZER_FLAG_STRING(data_flow_trace, "Experimental: use the data flow trace")
Modified: compiler-rt/trunk/lib/fuzzer/FuzzerLoop.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerLoop.cpp?rev=334146&r1=334145&r2=334146&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerLoop.cpp (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerLoop.cpp Wed Jun 6 16:24:41 2018
@@ -454,8 +454,6 @@ bool Fuzzer::RunOne(const uint8_t *Data,
size_t FoundUniqFeaturesOfII = 0;
size_t NumUpdatesBefore = Corpus.NumFeatureUpdates();
TPC.CollectFeatures([&](size_t Feature) {
- if (Options.UseFeatureFrequency)
- Corpus.UpdateFeatureFrequency(Feature);
if (Corpus.AddFeature(Feature, Size, Options.Shrink))
UniqFeatureSetTmp.push_back(Feature);
if (Options.ReduceInputs && II)
@@ -630,8 +628,6 @@ void Fuzzer::MutateAndTestOne() {
MD.StartMutationSequence();
auto &II = Corpus.ChooseUnitToMutate(MD.GetRand());
- if (Options.UseFeatureFrequency)
- Corpus.UpdateFeatureFrequencyScore(&II);
const auto &U = II.U;
memcpy(BaseSha1, II.Sha1, sizeof(BaseSha1));
assert(CurrentUnitData);
Modified: compiler-rt/trunk/lib/fuzzer/FuzzerOptions.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerOptions.h?rev=334146&r1=334145&r2=334146&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerOptions.h (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerOptions.h Wed Jun 6 16:24:41 2018
@@ -57,7 +57,6 @@ struct FuzzingOptions {
bool DumpCoverage = false;
bool DetectLeaks = true;
int PurgeAllocatorIntervalSec = 1;
- int UseFeatureFrequency = false;
int TraceMalloc = 0;
bool HandleAbrt = false;
bool HandleBus = false;
More information about the llvm-commits
mailing list