| Aaron Ballman | ef11698 | 2015-01-29 16:58:29 +0000 | [diff] [blame] | 1 | //===- FuzzerFlags.def - Run-time flags -------------------------*- C++ -* ===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| Kostya Serebryany | 52a788e | 2015-03-31 20:13:20 +0000 | [diff] [blame] | 9 | // Flags. FUZZER_FLAG_INT/FUZZER_FLAG_STRING macros should be defined at the |
| 10 | // point of inclusion. We are not using any flag parsing library for better |
| 11 | // portability and independence. |
| Aaron Ballman | ef11698 | 2015-01-29 16:58:29 +0000 | [diff] [blame] | 12 | //===----------------------------------------------------------------------===// |
| Kostya Serebryany | 52a788e | 2015-03-31 20:13:20 +0000 | [diff] [blame] | 13 | FUZZER_FLAG_INT(verbosity, 1, "Verbosity level.") |
| Mike Aizatsky | a1a5c69 | 2015-12-10 20:41:53 +0000 | [diff] [blame] | 14 | FUZZER_FLAG_UNSIGNED(seed, 0, "Random seed. If 0, seed is generated.") |
| Kostya Serebryany | 52a788e | 2015-03-31 20:13:20 +0000 | [diff] [blame] | 15 | FUZZER_FLAG_INT(runs, -1, |
| Kostya Serebryany | 33f8669 | 2015-02-04 22:20:09 +0000 | [diff] [blame] | 16 | "Number of individual test runs (-1 for infinite runs).") |
| Kostya Serebryany | 64d2457 | 2016-03-12 01:57:04 +0000 | [diff] [blame] | 17 | FUZZER_FLAG_INT(max_len, 0, "Maximum length of the test input. " |
| 18 | "If 0, libFuzzer tries to guess a good value based on the corpus " |
| 19 | "and reports it. ") |
| Kostya Serebryany | 52a788e | 2015-03-31 20:13:20 +0000 | [diff] [blame] | 20 | FUZZER_FLAG_INT(cross_over, 1, "If 1, cross over inputs.") |
| 21 | FUZZER_FLAG_INT(mutate_depth, 5, |
| Aaron Ballman | ef11698 | 2015-01-29 16:58:29 +0000 | [diff] [blame] | 22 | "Apply this number of consecutive mutations to each input.") |
| Kostya Serebryany | fed509e | 2015-10-17 04:38:26 +0000 | [diff] [blame] | 23 | FUZZER_FLAG_INT(shuffle, 1, "Shuffle inputs at startup") |
| Kostya Serebryany | 945761b | 2016-03-18 00:23:29 +0000 | [diff] [blame] | 24 | FUZZER_FLAG_INT(prefer_small, 1, |
| 25 | "If 1, always prefer smaller inputs during the corpus shuffle.") |
| Kostya Serebryany | 490bbd6 | 2015-05-19 22:12:57 +0000 | [diff] [blame] | 26 | FUZZER_FLAG_INT( |
| Kostya Serebryany | 316b571 | 2015-05-26 20:57:47 +0000 | [diff] [blame] | 27 | timeout, 1200, |
| Kostya Serebryany | 490bbd6 | 2015-05-19 22:12:57 +0000 | [diff] [blame] | 28 | "Timeout in seconds (if positive). " |
| 29 | "If one unit runs more than this number of seconds the process will abort.") |
| Kostya Serebryany | 54a6363 | 2016-01-29 23:30:07 +0000 | [diff] [blame] | 30 | FUZZER_FLAG_INT(timeout_exitcode, 77, |
| 31 | "Unless abort_on_timeout is set, use this exitcode on timeout.") |
| Kostya Serebryany | 228d5b1 | 2016-03-01 22:19:21 +0000 | [diff] [blame] | 32 | FUZZER_FLAG_INT(error_exit_code, 77, "When libFuzzer's signal handlers are in " |
| 33 | "use exit with this exitcode after catching a deadly signal.") |
| Kostya Serebryany | b85db17 | 2015-10-02 20:47:55 +0000 | [diff] [blame] | 34 | FUZZER_FLAG_INT(max_total_time, 0, "If positive, indicates the maximal total " |
| 35 | "time in seconds to run the fuzzer.") |
| Kostya Serebryany | 52a788e | 2015-03-31 20:13:20 +0000 | [diff] [blame] | 36 | FUZZER_FLAG_INT(help, 0, "Print help.") |
| Kostya Serebryany | 9cc3b0d | 2015-10-24 01:16:40 +0000 | [diff] [blame] | 37 | FUZZER_FLAG_INT(merge, 0, "If 1, the 2-nd, 3-rd, etc corpora will be " |
| Kostya Serebryany | 61b07ac | 2016-05-09 19:11:36 +0000 | [diff] [blame] | 38 | "merged into the 1-st corpus. Only interesting units will be taken. " |
| 39 | "This flag can be used to minimize a corpus.") |
| Kostya Serebryany | e2d0f63 | 2016-09-01 01:22:27 +0000 | [diff] [blame] | 40 | FUZZER_FLAG_INT(minimize_crash, 0, "If 1, minimizes the provided" |
| 41 | " crash input. Use with -runs=N or -max_total_time=N to limit " |
| 42 | "the number attempts") |
| 43 | FUZZER_FLAG_INT(minimize_crash_internal_step, 0, "internal flag") |
| Kostya Serebryany | 1ce4ebf | 2015-05-13 18:31:46 +0000 | [diff] [blame] | 44 | FUZZER_FLAG_INT(use_counters, 1, "Use coverage counters") |
| Kostya Serebryany | 2e9fca9 | 2015-10-22 23:55:39 +0000 | [diff] [blame] | 45 | FUZZER_FLAG_INT(use_indir_calls, 1, "Use indirect caller-callee counters") |
| Kostya Serebryany | ae5b956 | 2016-01-15 06:24:05 +0000 | [diff] [blame] | 46 | FUZZER_FLAG_INT(use_memcmp, 1, |
| 47 | "Use hints from intercepting memcmp, strcmp, etc") |
| Kostya Serebryany | c135b55 | 2016-07-15 23:27:19 +0000 | [diff] [blame] | 48 | FUZZER_FLAG_INT(use_memmem, 1, |
| 49 | "Use hints from intercepting memmem, strstr, etc") |
| Kostya Serebryany | d46a59f | 2016-08-16 19:33:51 +0000 | [diff] [blame] | 50 | FUZZER_FLAG_INT(use_value_profile, 0, |
| 51 | "Experimental. Use value profile to guide fuzzing.") |
| Kostya Serebryany | d216922 | 2016-10-01 01:04:29 +0000 | [diff] [blame] | 52 | FUZZER_FLAG_INT(shrink, 0, "Experimental. Try to shrink corpus elements.") |
| Kostya Serebryany | 52a788e | 2015-03-31 20:13:20 +0000 | [diff] [blame] | 53 | FUZZER_FLAG_INT(jobs, 0, "Number of jobs to run. If jobs >= 1 we spawn" |
| Kostya Serebryany | e8cee11 | 2015-01-31 01:14:40 +0000 | [diff] [blame] | 54 | " this number of jobs in separate worker processes" |
| 55 | " with stdout/stderr redirected to fuzz-JOB.log.") |
| Kostya Serebryany | 52a788e | 2015-03-31 20:13:20 +0000 | [diff] [blame] | 56 | FUZZER_FLAG_INT(workers, 0, |
| Kostya Serebryany | 9690fcf | 2015-05-12 18:51:57 +0000 | [diff] [blame] | 57 | "Number of simultaneous worker processes to run the jobs." |
| 58 | " If zero, \"min(jobs,NumberOfCpuCores()/2)\" is used.") |
| Kostya Serebryany | c5325ed | 2016-10-08 23:24:45 +0000 | [diff] [blame^] | 59 | FUZZER_FLAG_INT(reload, 1, |
| Kostya Serebryany | 9adc7c8 | 2016-10-08 22:12:14 +0000 | [diff] [blame] | 60 | "Reload the main corpus every <N> seconds to get new units" |
| 61 | " discovered by other processes. If 0, disabled") |
| Kostya Serebryany | 70926ae | 2015-08-05 21:43:48 +0000 | [diff] [blame] | 62 | FUZZER_FLAG_INT(report_slow_units, 10, |
| 63 | "Report slowest units if they run for more than this number of seconds.") |
| Kostya Serebryany | bc7c0ad | 2015-08-11 01:44:42 +0000 | [diff] [blame] | 64 | FUZZER_FLAG_INT(only_ascii, 0, |
| 65 | "If 1, generate only ASCII (isprint+isspace) inputs.") |
| Kostya Serebryany | 9838b2b | 2015-09-03 20:23:46 +0000 | [diff] [blame] | 66 | FUZZER_FLAG_STRING(dict, "Experimental. Use the dictionary file.") |
| Kostya Serebryany | bd5d1cd | 2015-10-09 03:57:59 +0000 | [diff] [blame] | 67 | FUZZER_FLAG_STRING(artifact_prefix, "Write fuzzing artifacts (crash, " |
| 68 | "timeout, or slow inputs) as " |
| 69 | "$(artifact_prefix)file") |
| Kostya Serebryany | 2d0ef14 | 2015-11-25 21:40:46 +0000 | [diff] [blame] | 70 | FUZZER_FLAG_STRING(exact_artifact_path, |
| 71 | "Write the single artifact on failure (crash, timeout) " |
| 72 | "as $(exact_artifact_path). This overrides -artifact_prefix " |
| 73 | "and will not use checksum in the file name. Do not " |
| 74 | "use the same path for several parallel processes.") |
| Mike Aizatsky | a9c2387 | 2015-11-12 04:38:40 +0000 | [diff] [blame] | 75 | FUZZER_FLAG_INT(output_csv, 0, "Enable pulse output in CSV format.") |
| Kostya Serebryany | 0f0fa4f | 2016-08-25 22:35:08 +0000 | [diff] [blame] | 76 | FUZZER_FLAG_INT(print_pcs, 0, "If 1, print out newly covered PCs.") |
| Kostya Serebryany | 66ff075 | 2016-02-26 22:42:23 +0000 | [diff] [blame] | 77 | FUZZER_FLAG_INT(print_final_stats, 0, "If 1, print statistics at exit.") |
| Kostya Serebryany | 29bb664 | 2016-09-21 22:42:17 +0000 | [diff] [blame] | 78 | FUZZER_FLAG_INT(print_corpus_stats, 0, |
| 79 | "If 1, print statistics on corpus elements at exit.") |
| Kostya Serebryany | b706b48 | 2016-09-18 21:47:08 +0000 | [diff] [blame] | 80 | FUZZER_FLAG_INT(print_coverage, 0, "If 1, print coverage information at exit." |
| 81 | " Experimental, only with trace-pc-guard") |
| Kostya Serebryany | 228d5b1 | 2016-03-01 22:19:21 +0000 | [diff] [blame] | 82 | FUZZER_FLAG_INT(handle_segv, 1, "If 1, try to intercept SIGSEGV.") |
| 83 | FUZZER_FLAG_INT(handle_bus, 1, "If 1, try to intercept SIGSEGV.") |
| 84 | FUZZER_FLAG_INT(handle_abrt, 1, "If 1, try to intercept SIGABRT.") |
| 85 | FUZZER_FLAG_INT(handle_ill, 1, "If 1, try to intercept SIGILL.") |
| 86 | FUZZER_FLAG_INT(handle_fpe, 1, "If 1, try to intercept SIGFPE.") |
| 87 | FUZZER_FLAG_INT(handle_int, 1, "If 1, try to intercept SIGINT.") |
| Kostya Serebryany | f389ae1 | 2016-03-24 21:03:58 +0000 | [diff] [blame] | 88 | FUZZER_FLAG_INT(handle_term, 1, "If 1, try to intercept SIGTERM.") |
| Kostya Serebryany | 49e4090 | 2016-03-18 20:58:29 +0000 | [diff] [blame] | 89 | FUZZER_FLAG_INT(close_fd_mask, 0, "If 1, close stdout at startup; " |
| Kostya Serebryany | 9e1a238 | 2016-03-29 23:07:36 +0000 | [diff] [blame] | 90 | "if 2, close stderr; if 3, close both. " |
| 91 | "Be careful, this will also close e.g. asan's stderr/stdout.") |
| Kostya Serebryany | 2fe9304 | 2016-04-29 18:49:55 +0000 | [diff] [blame] | 92 | FUZZER_FLAG_INT(detect_leaks, 1, "If 1, and if LeakSanitizer is enabled " |
| Kostya Serebryany | 1bfd583 | 2016-04-20 00:24:21 +0000 | [diff] [blame] | 93 | "try to detect memory leaks during fuzzing (i.e. not only at shut down).") |
| Kostya Serebryany | 8b8f7a3 | 2016-05-06 23:38:07 +0000 | [diff] [blame] | 94 | FUZZER_FLAG_INT(rss_limit_mb, 2048, "If non-zero, the fuzzer will exit upon" |
| Kostya Serebryany | 52b394e | 2016-05-06 21:58:35 +0000 | [diff] [blame] | 95 | "reaching this limit of RSS memory usage.") |
| Kostya Serebryany | 5ff481f | 2016-09-27 00:10:20 +0000 | [diff] [blame] | 96 | FUZZER_FLAG_STRING(exit_on_src_pos, "Exit if a newly found PC originates" |
| 97 | " from the given source location. Example: -exit_on_src_pos=foo.cc:123. " |
| 98 | "Used primarily for testing libFuzzer itself.") |
| Kostya Serebryany | d216922 | 2016-10-01 01:04:29 +0000 | [diff] [blame] | 99 | FUZZER_FLAG_STRING(exit_on_item, "Exit if an item with a given sha1 sum" |
| 100 | " was added to the corpus. " |
| 101 | "Used primarily for testing libFuzzer itself.") |
| Kostya Serebryany | c5575aa | 2016-03-17 19:59:39 +0000 | [diff] [blame] | 102 | |
| Kostya Serebryany | 3d95dd9 | 2016-03-01 22:33:14 +0000 | [diff] [blame] | 103 | FUZZER_DEPRECATED_FLAG(exit_on_first) |
| 104 | FUZZER_DEPRECATED_FLAG(save_minimized_corpus) |
| Kostya Serebryany | c5575aa | 2016-03-17 19:59:39 +0000 | [diff] [blame] | 105 | FUZZER_DEPRECATED_FLAG(sync_command) |
| 106 | FUZZER_DEPRECATED_FLAG(sync_timeout) |
| 107 | FUZZER_DEPRECATED_FLAG(test_single_input) |
| Kostya Serebryany | 09aa01a | 2016-09-21 01:04:43 +0000 | [diff] [blame] | 108 | FUZZER_DEPRECATED_FLAG(drill) |
| 109 | FUZZER_DEPRECATED_FLAG(truncate_units) |