45 #define FUZZER_DEPRECATED_FLAG(Name)
46 #define FUZZER_FLAG_INT(Name, Default, Description) int Name;
47 #define FUZZER_FLAG_UNSIGNED(Name, Default, Description) unsigned int Name;
48 #define FUZZER_FLAG_STRING(Name, Description) const char *Name;
49 #include "FuzzerFlags.def"
50 #undef FUZZER_DEPRECATED_FLAG
51 #undef FUZZER_FLAG_INT
52 #undef FUZZER_FLAG_UNSIGNED
53 #undef FUZZER_FLAG_STRING
56 static const FlagDescription FlagDescriptions [] {
57 #define FUZZER_DEPRECATED_FLAG(Name) \
58 {#Name, "Deprecated; don't use", 0, nullptr, nullptr, nullptr},
59 #define FUZZER_FLAG_INT(Name, Default, Description) \
60 {#Name, Description, Default, &Flags.Name, nullptr, nullptr},
61 #define FUZZER_FLAG_UNSIGNED(Name, Default, Description) \
62 {#Name, Description, static_cast<int>(Default), \
63 nullptr, nullptr, &Flags.Name},
64 #define FUZZER_FLAG_STRING(Name, Description) \
65 {#Name, Description, 0, nullptr, &Flags.Name, nullptr},
66 #include "FuzzerFlags.def"
67 #undef FUZZER_DEPRECATED_FLAG
68 #undef FUZZER_FLAG_INT
69 #undef FUZZER_FLAG_UNSIGNED
70 #undef FUZZER_FLAG_STRING
73 static const size_t kNumFlags =
74 sizeof(FlagDescriptions) /
sizeof(FlagDescriptions[0]);
76 static std::vector<std::string> *Inputs;
77 static std::string *ProgName;
79 static void PrintHelp() {
81 auto Prog = ProgName->c_str();
82 Printf(
"\nTo run fuzzing pass 0 or more directories.\n");
83 Printf(
"%s [-flag1=val1 [-flag2=val2 ...] ] [dir1 [dir2 ...] ]\n", Prog);
85 Printf(
"\nTo run individual tests without fuzzing pass 1 or more files:\n");
86 Printf(
"%s [-flag1=val1 [-flag2=val2 ...] ] file1 [file2 ...]\n", Prog);
88 Printf(
"\nFlags: (strictly in form -flag=value)\n");
89 size_t MaxFlagLen = 0;
90 for (
size_t F = 0;
F < kNumFlags;
F++)
91 MaxFlagLen =
std::max(strlen(FlagDescriptions[
F].
Name), MaxFlagLen);
93 for (
size_t F = 0;
F < kNumFlags;
F++) {
94 const auto &
D = FlagDescriptions[
F];
95 if (strstr(
D.Description,
"internal flag") ==
D.Description)
continue;
97 for (
size_t i = 0, n = MaxFlagLen - strlen(
D.Name); i < n; i++)
100 Printf(
"%d\t%s\n",
D.Default,
D.Description);
102 Printf(
"\nFlags starting with '--' will be ignored and "
103 "will be passed verbatim to subprocesses.\n");
106 static const char *FlagValue(
const char *Param,
const char *
Name) {
107 size_t Len = strlen(Name);
108 if (Param[0] ==
'-' && strstr(Param + 1, Name) == Param + 1 &&
109 Param[Len + 1] ==
'=')
110 return &Param[Len + 2];
115 static long MyStol(
const char *Str) {
122 for (
size_t i = 0; Str[i]; i++) {
124 if (Ch < '0' || Ch >
'9')
126 Res = Res * 10 + (Ch -
'0');
131 static bool ParseOneFlag(
const char *Param) {
132 if (Param[0] !=
'-')
return false;
133 if (Param[1] ==
'-') {
134 static bool PrintedWarning =
false;
135 if (!PrintedWarning) {
136 PrintedWarning =
true;
137 Printf(
"INFO: libFuzzer ignores flags that start with '--'\n");
139 for (
size_t F = 0;
F < kNumFlags;
F++)
140 if (FlagValue(Param + 1, FlagDescriptions[
F].Name))
141 Printf(
"WARNING: did you mean '%s' (single dash)?\n", Param + 1);
144 for (
size_t F = 0;
F < kNumFlags;
F++) {
145 const char *Name = FlagDescriptions[
F].Name;
146 const char *Str = FlagValue(Param, Name);
148 if (FlagDescriptions[
F].IntFlag) {
149 int Val = MyStol(Str);
150 *FlagDescriptions[
F].IntFlag = Val;
151 if (
Flags.verbosity >= 2)
152 Printf(
"Flag: %s %d\n", Name, Val);
154 }
else if (FlagDescriptions[
F].UIntFlag) {
155 unsigned int Val = std::stoul(Str);
156 *FlagDescriptions[
F].UIntFlag = Val;
157 if (
Flags.verbosity >= 2)
158 Printf(
"Flag: %s %u\n", Name, Val);
160 }
else if (FlagDescriptions[
F].StrFlag) {
161 *FlagDescriptions[
F].StrFlag = Str;
162 if (
Flags.verbosity >= 2)
163 Printf(
"Flag: %s %s\n", Name, Str);
166 Printf(
"Flag: %s: deprecated, don't use\n", Name);
171 Printf(
"\n\nWARNING: unrecognized flag '%s'; "
172 "use -help=1 to list all flags\n\n", Param);
177 static void ParseFlags(
const std::vector<std::string> &
Args) {
178 for (
size_t F = 0;
F < kNumFlags;
F++) {
179 if (FlagDescriptions[
F].IntFlag)
180 *FlagDescriptions[
F].IntFlag = FlagDescriptions[
F].Default;
181 if (FlagDescriptions[
F].UIntFlag)
182 *FlagDescriptions[
F].UIntFlag =
183 static_cast<unsigned int>(FlagDescriptions[
F].Default);
184 if (FlagDescriptions[
F].StrFlag)
185 *FlagDescriptions[
F].StrFlag =
nullptr;
187 Inputs =
new std::vector<std::string>;
188 for (
size_t A = 1;
A < Args.size();
A++) {
189 if (ParseOneFlag(Args[
A].
c_str())) {
190 if (
Flags.ignore_remaining_args)
194 Inputs->push_back(Args[
A]);
198 static std::mutex Mu;
200 static void PulseThread() {
203 std::lock_guard<std::mutex>
Lock(Mu);
208 static void WorkerThread(
const std::string &Cmd, std::atomic<unsigned> *
Counter,
209 unsigned NumJobs, std::atomic<bool> *HasErrors) {
211 unsigned C = (*Counter)++;
212 if (C >= NumJobs)
break;
214 std::string ToRun = Cmd +
" > " + Log +
" 2>&1\n";
216 Printf(
"%s", ToRun.c_str());
220 std::lock_guard<std::mutex>
Lock(Mu);
221 Printf(
"================== Job %u exited with exit code %d ============\n",
228 const char *X1,
const char *X2) {
230 for (
auto &S : Args) {
231 if (FlagValue(S.c_str(), X1) || FlagValue(S.c_str(), X2))
238 static int RunInMultipleProcesses(
const std::vector<std::string> &Args,
239 unsigned NumWorkers,
unsigned NumJobs) {
240 std::atomic<unsigned>
Counter(0);
241 std::atomic<bool> HasErrors(
false);
243 std::vector<std::thread> V;
246 for (
unsigned i = 0; i < NumWorkers; i++)
247 V.push_back(
std::thread(WorkerThread, Cmd, &Counter, NumJobs, &HasErrors));
250 return HasErrors ? 1 : 0;
253 static void RssThread(Fuzzer *
F,
size_t RssLimitMb) {
257 if (Peak > RssLimitMb)
258 F->RssLimitCallback();
262 static void StartRssThread(Fuzzer *
F,
size_t RssLimitMb) {
263 if (!RssLimitMb)
return;
268 int RunOneTest(Fuzzer *F,
const char *InputFilePath,
size_t MaxLen) {
270 if (MaxLen && MaxLen < U.size())
272 F->ExecuteCallback(U.data(), U.size());
273 F->TryDetectingAMemoryLeak(U.data(), U.size(),
true);
277 static bool AllInputsAreFiles() {
278 if (Inputs->empty())
return false;
279 for (
auto &Path : *Inputs)
285 static std::string GetDedupTokenFromFile(
const std::string &Path) {
287 auto Beg = S.find(
"DEDUP_TOKEN:");
288 if (Beg == std::string::npos)
290 auto End = S.find(
'\n', Beg);
291 if (
End == std::string::npos)
293 return S.substr(Beg,
End - Beg);
296 int CleanseCrashInput(
const std::vector<std::string> &Args,
297 const FuzzingOptions &Options) {
298 if (Inputs->size() != 1 || !
Flags.exact_artifact_path) {
299 Printf(
"ERROR: -cleanse_crash should be given one input file and"
300 " -exact_artifact_path\n");
303 std::string InputFilePath = Inputs->at(0);
304 std::string OutputFilePath =
Flags.exact_artifact_path;
305 std::string BaseCmd =
308 auto InputPos = BaseCmd.find(
" " + InputFilePath +
" ");
309 assert(InputPos != std::string::npos);
310 BaseCmd.erase(InputPos, InputFilePath.size() + 1);
316 auto LogFileRedirect =
" > " + LogFilePath +
" 2>&1 ";
318 auto Cmd = BaseCmd +
" " + TmpFilePath + LogFileRedirect;
320 std::string CurrentFilePath = InputFilePath;
322 size_t Size = U.size();
324 const std::vector<uint8_t> ReplacementBytes = {
' ', 0xff};
325 for (
int NumAttempts = 0; NumAttempts < 5; NumAttempts++) {
326 bool Changed =
false;
327 for (
size_t Idx = 0; Idx <
Size; Idx++) {
328 Printf(
"CLEANSE[%d]: Trying to replace byte %zd of %zd\n", NumAttempts,
330 uint8_t OriginalByte = U[Idx];
331 if (ReplacementBytes.end() !=
std::find(ReplacementBytes.begin(),
332 ReplacementBytes.end(),
335 for (
auto NewByte : ReplacementBytes) {
341 U[Idx] = OriginalByte;
344 Printf(
"CLEANSE: Replaced byte %zd with 0x%x\n", Idx, NewByte);
356 int MinimizeCrashInput(
const std::vector<std::string> &Args,
357 const FuzzingOptions &Options) {
358 if (Inputs->size() != 1) {
359 Printf(
"ERROR: -minimize_crash should be given one input file\n");
362 std::string InputFilePath = Inputs->at(0);
364 "-ignore_remaining_args=1",
366 auto InputPos = BaseCmd.first.find(
" " + InputFilePath +
" ");
367 assert(InputPos != std::string::npos);
368 BaseCmd.first.erase(InputPos, InputFilePath.size() + 1);
369 if (
Flags.runs <= 0 &&
Flags.max_total_time == 0) {
370 Printf(
"INFO: you need to specify -runs=N or "
371 "-max_total_time=N with -minimize_crash=1\n"
372 "INFO: defaulting to -max_total_time=600\n");
373 BaseCmd.first +=
" -max_total_time=600";
378 auto LogFileRedirect =
" > " + LogFilePath +
" 2>&1 ";
380 std::string CurrentFilePath = InputFilePath;
383 Printf(
"CRASH_MIN: minimizing crash input: '%s' (%zd bytes)\n",
384 CurrentFilePath.c_str(), U.size());
386 auto Cmd = BaseCmd.first +
" " + CurrentFilePath + LogFileRedirect +
" " +
389 Printf(
"CRASH_MIN: executing: %s\n", Cmd.c_str());
392 Printf(
"ERROR: the input %s did not crash\n", CurrentFilePath.c_str());
395 Printf(
"CRASH_MIN: '%s' (%zd bytes) caused a crash. Will try to minimize "
397 CurrentFilePath.c_str(), U.size());
398 auto DedupToken1 = GetDedupTokenFromFile(LogFilePath);
399 if (!DedupToken1.empty())
400 Printf(
"CRASH_MIN: DedupToken1: %s\n", DedupToken1.c_str());
402 std::string ArtifactPath =
403 Flags.exact_artifact_path
404 ?
Flags.exact_artifact_path
405 : Options.ArtifactPrefix +
"minimized-from-" +
Hash(U);
406 Cmd +=
" -minimize_crash_internal_step=1 -exact_artifact_path=" +
408 Printf(
"CRASH_MIN: executing: %s\n", Cmd.c_str());
412 if (
Flags.exact_artifact_path) {
413 CurrentFilePath =
Flags.exact_artifact_path;
416 Printf(
"CRASH_MIN: failed to minimize beyond %s (%d bytes), exiting\n",
417 CurrentFilePath.c_str(), U.size());
420 auto DedupToken2 = GetDedupTokenFromFile(LogFilePath);
421 if (!DedupToken2.empty())
422 Printf(
"CRASH_MIN: DedupToken2: %s\n", DedupToken2.c_str());
424 if (DedupToken1 != DedupToken2) {
425 if (
Flags.exact_artifact_path) {
426 CurrentFilePath =
Flags.exact_artifact_path;
429 Printf(
"CRASH_MIN: mismatch in dedup tokens"
430 " (looks like a different bug). Won't minimize further\n");
434 CurrentFilePath = ArtifactPath;
435 Printf(
"*********************************\n");
441 int MinimizeCrashInputInternalStep(Fuzzer *F, InputCorpus *Corpus) {
442 assert(Inputs->size() == 1);
443 std::string InputFilePath = Inputs->at(0);
445 Printf(
"INFO: Starting MinimizeCrashInputInternalStep: %zd\n", U.size());
447 Printf(
"INFO: The input is small enough, exiting\n");
450 F->SetMaxInputLen(U.size());
451 F->SetMaxMutationLen(U.size() - 1);
452 F->MinimizeCrashLoop(U);
453 Printf(
"INFO: Done MinimizeCrashInputInternalStep, no crashes found\n");
458 int AnalyzeDictionary(Fuzzer *F,
const std::vector<Unit>& Dict,
460 Printf(
"Started dictionary minimization (up to %d tests)\n",
461 Dict.size() * Corpus.size() * 2);
464 std::vector<int> Scores(Dict.size());
465 std::vector<int> Usages(Dict.size());
467 std::vector<size_t> InitialFeatures;
468 std::vector<size_t> ModifiedFeatures;
469 for (
auto &C : Corpus) {
471 F->ExecuteCallback(C.data(), C.size());
472 InitialFeatures.clear();
474 InitialFeatures.push_back(Feature);
478 for (
size_t i = 0; i < Dict.size(); ++i) {
480 auto StartPos = std::search(
Data.begin(),
Data.end(),
481 Dict[i].begin(), Dict[i].end());
483 if (StartPos ==
Data.end())
487 while (StartPos !=
Data.end()) {
489 auto EndPos = StartPos + Dict[i].size();
490 for (
auto It = StartPos; It != EndPos; ++It)
493 StartPos = std::search(EndPos,
Data.end(),
494 Dict[i].begin(), Dict[i].end());
498 F->ExecuteCallback(
Data.data(),
Data.size());
499 ModifiedFeatures.clear();
501 ModifiedFeatures.push_back(Feature);
505 if (InitialFeatures == ModifiedFeatures)
512 Printf(
"###### Useless dictionary elements. ######\n");
513 for (
size_t i = 0; i < Dict.size(); ++i) {
519 PrintASCII(Dict[i].data(), Dict[i].size(),
"\"");
520 Printf(
" # Score: %d, Used: %d\n", Scores[i], Usages[i]);
522 Printf(
"###### End of useless dictionary elements. ######\n");
527 using namespace fuzzer;
528 assert(argc && argv &&
"Argument pointers cannot be nullptr");
529 std::string Argv0((*argv)[0]);
531 if (
EF->LLVMFuzzerInitialize)
532 EF->LLVMFuzzerInitialize(argc, argv);
533 const std::vector<std::string>
Args(*argv, *argv + *argc);
535 ProgName =
new std::string(Args[0]);
536 if (Argv0 != *ProgName) {
537 Printf(
"ERROR: argv[0] has been modified in LLVMFuzzerInitialize\n");
546 if (
Flags.close_fd_mask & 2)
548 if (
Flags.close_fd_mask & 1)
553 if (
Flags.workers > 1)
558 return RunInMultipleProcesses(Args,
Flags.workers,
Flags.jobs);
560 const size_t kMaxSaneLen = 1 << 20;
561 const size_t kMinDefaultLen = 4096;
562 FuzzingOptions Options;
563 Options.Verbosity =
Flags.verbosity;
564 Options.MaxLen =
Flags.max_len;
565 Options.ExperimentalLenControl =
Flags.experimental_len_control;
566 if (
Flags.experimental_len_control &&
Flags.max_len == kMinDefaultLen)
567 Options.MaxLen = 1 << 20;
568 Options.UnitTimeoutSec =
Flags.timeout;
569 Options.ErrorExitCode =
Flags.error_exitcode;
570 Options.TimeoutExitCode =
Flags.timeout_exitcode;
571 Options.MaxTotalTimeSec =
Flags.max_total_time;
572 Options.DoCrossOver =
Flags.cross_over;
573 Options.MutateDepth =
Flags.mutate_depth;
574 Options.UseCounters =
Flags.use_counters;
575 Options.UseIndirCalls =
Flags.use_indir_calls;
576 Options.UseMemmem =
Flags.use_memmem;
577 Options.UseCmp =
Flags.use_cmp;
578 Options.UseValueProfile =
Flags.use_value_profile;
579 Options.Shrink =
Flags.shrink;
580 Options.ReduceInputs =
Flags.reduce_inputs;
581 Options.ShuffleAtStartUp =
Flags.shuffle;
582 Options.PreferSmall =
Flags.prefer_small;
583 Options.ReloadIntervalSec =
Flags.reload;
584 Options.OnlyASCII =
Flags.only_ascii;
585 Options.DetectLeaks =
Flags.detect_leaks;
586 Options.TraceMalloc =
Flags.trace_malloc;
587 Options.RssLimitMb =
Flags.rss_limit_mb;
589 Options.MaxNumberOfRuns =
Flags.runs;
590 if (!Inputs->empty() && !
Flags.minimize_crash_internal_step)
591 Options.OutputCorpus = (*Inputs)[0];
592 Options.ReportSlowUnits =
Flags.report_slow_units;
593 if (
Flags.artifact_prefix)
594 Options.ArtifactPrefix =
Flags.artifact_prefix;
595 if (
Flags.exact_artifact_path)
596 Options.ExactArtifactPath =
Flags.exact_artifact_path;
603 bool DoPlainRun = AllInputsAreFiles();
604 Options.SaveArtifacts =
605 !DoPlainRun ||
Flags.minimize_crash_internal_step;
606 Options.PrintNewCovPcs =
Flags.print_pcs;
607 Options.PrintFinalStats =
Flags.print_final_stats;
608 Options.PrintCorpusStats =
Flags.print_corpus_stats;
609 Options.PrintCoverage =
Flags.print_coverage;
610 Options.DumpCoverage =
Flags.dump_coverage;
611 if (
Flags.exit_on_src_pos)
612 Options.ExitOnSrcPos =
Flags.exit_on_src_pos;
613 if (
Flags.exit_on_item)
614 Options.ExitOnItem =
Flags.exit_on_item;
626 auto *Corpus =
new InputCorpus(Options.OutputCorpus);
627 auto *F =
new Fuzzer(Callback, *Corpus, *MD, Options);
631 MD->AddWordToManualDictionary(
Word(U.data(), U.size()));
633 StartRssThread(F,
Flags.rss_limit_mb);
635 Options.HandleAbrt =
Flags.handle_abrt;
636 Options.HandleBus =
Flags.handle_bus;
637 Options.HandleFpe =
Flags.handle_fpe;
638 Options.HandleIll =
Flags.handle_ill;
639 Options.HandleInt =
Flags.handle_int;
640 Options.HandleSegv =
Flags.handle_segv;
641 Options.HandleTerm =
Flags.handle_term;
642 Options.HandleXfsz =
Flags.handle_xfsz;
645 if (
Flags.minimize_crash)
646 return MinimizeCrashInput(Args, Options);
648 if (
Flags.minimize_crash_internal_step)
649 return MinimizeCrashInputInternalStep(F, Corpus);
651 if (
Flags.cleanse_crash)
652 return CleanseCrashInput(Args, Options);
654 if (
auto Name =
Flags.run_equivalence_server) {
657 Printf(
"ERROR: can't create shared memory region\n");
660 Printf(
"INFO: EQUIVALENCE SERVER UP\n");
666 F->ExecuteCallback(tmp.data(), tmp.size());
672 if (
auto Name =
Flags.use_equivalence_server) {
674 Printf(
"ERROR: can't open shared memory region\n");
677 Printf(
"INFO: EQUIVALENCE CLIENT UP\n");
681 Options.SaveArtifacts =
false;
683 Printf(
"%s: Running %zd inputs %d time(s) each.\n", ProgName->c_str(),
684 Inputs->size(), Runs);
685 for (
auto &Path : *Inputs) {
687 Printf(
"Running: %s\n", Path.c_str());
688 for (
int Iter = 0; Iter < Runs; Iter++)
689 RunOneTest(F, Path.c_str(), Options.MaxLen);
691 auto MS = duration_cast<milliseconds>(StopTime - StartTime).
count();
692 Printf(
"Executed %s in %zd ms\n", Path.c_str(), (long)MS);
695 "*** NOTE: fuzzing was not performed, you have only\n"
696 "*** executed the target code on a fixed set of inputs.\n"
698 F->PrintFinalStats();
703 if (Options.MaxLen == 0)
704 F->SetMaxInputLen(kMaxSaneLen);
705 if (
Flags.merge_control_file)
706 F->CrashResistantMergeInternalStep(
Flags.merge_control_file);
708 F->CrashResistantMerge(Args, *Inputs,
709 Flags.load_coverage_summary,
710 Flags.save_coverage_summary);
714 size_t TemporaryMaxLen = Options.MaxLen ? Options.MaxLen : kMaxSaneLen;
717 for (
auto &Inp : *Inputs) {
718 Printf(
"Loading corpus dir: %s\n", Inp.c_str());
720 TemporaryMaxLen,
false);
723 if (
Flags.analyze_dict) {
724 if (Dictionary.empty() || Inputs->empty()) {
725 Printf(
"ERROR: can't analyze dict without dict and corpus provided\n");
728 if (AnalyzeDictionary(F, Dictionary, InitialCorpus)) {
729 Printf(
"Dictionary analysis failed\n");
732 Printf(
"Dictionary analysis suceeded\n");
736 if (Options.MaxLen == 0) {
738 for (
auto &U : InitialCorpus)
739 MaxLen =
std::max(U.size(), MaxLen);
743 if (InitialCorpus.empty()) {
744 InitialCorpus.push_back(
Unit({
'\n'}));
745 if (Options.Verbosity)
746 Printf(
"INFO: A corpus is not provided, starting from an empty corpus\n");
748 F->ShuffleAndMinimize(&InitialCorpus);
749 InitialCorpus.clear();
753 Printf(
"Done %zd runs in %zd second(s)\n", F->getTotalNumberOfRuns(),
754 F->secondsSinceProcessStartUp());
755 F->PrintFinalStats();
bool Create(const char *Name)
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
static cl::opt< unsigned long long > Seed("rng-seed", cl::value_desc("seed"), cl::desc("Seed for the random number generator"), cl::init(0))
size_t WriteByteArray(const uint8_t *Bytes, size_t N)
int(* UserCallback)(const uint8_t *Data, size_t Size)
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with tries to cleanse the provided crash input to make it contain fewer original bytes Use with exact_artifact_path to specify the output Experimental Use value profile to guide fuzzing Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
bool Open(const char *Name)
std::pair< std::string, std::string > SplitBefore(std::string X, std::string S)
void SleepSeconds(int Seconds)
struct fuzzer::@301 Flags
bool IsFile(const std::string &Path)
std::string FileToString(const std::string &Path)
void ReadDirToVectorOfUnits(const char *Path, std::vector< Unit > *V, long *Epoch, size_t MaxSize, bool ExitOnError)
__attribute__((used)) void __libfuzzer_is_present()
int FuzzerDriver(int *argc, char ***argv, UserCallback Callback)
auto count(R &&Range, const E &Element) -> typename std::iterator_traits< decltype(std::begin(Range))>::difference_type
Wrapper function around std::count to count the number of times an element Element occurs in the give...
size_t ReadByteArraySize()
PrintASCII(Dict[i].data(), Dict[i].size(),"\"")
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
bool ParseDictionaryFile(const std::string &Text, std::vector< Unit > *Units)
static sys::TimePoint< std::chrono::seconds > now(bool Deterministic)
std::string DirPlusFile(const std::string &DirPath, const std::string &FileName)
static const unsigned End
void SetSignalHandler(const FuzzingOptions &Options)
void CollectFeatures(Callback CB) const
void CopyFileToErr(const std::string &Path)
SmallVectorImpl< T >::const_pointer c_str(SmallVectorImpl< T > &str)
auto find(R &&Range, const T &Val) -> decltype(std::begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
bool Destroy(const char *Name)
void WriteToFile(const Unit &U, const std::string &Path)
Unit FileToVector(const std::string &Path, size_t MaxSize, bool ExitOnError)
void RemoveFile(const std::string &Path)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
std::vector< Unit > UnitVector
const std::string to_string(const T &Value)
std::vector< uint8_t > Unit
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::string Hash(const Unit &U)
unsigned NumberOfCpuCores()
Printf(" # Score: %d, Used: %d\n", Scores[i], Usages[i])
int ExecuteCommand(const std::string &Command)
std::string CloneArgsWithoutX(const std::vector< std::string > &Args, const char *X1, const char *X2)
static size_t GetMaxSize()