Repository: google/clusterfuzz

Issue:
Use local corpora dir when NFS_ROOT is not set.



Discussion:
/gcbrun

Resolving patch:
diff --git a/src/python/bot/fuzzers/libFuzzer/constants.py b/src/python/bot/fuzzers/libFuzzer/constants.py
--- a/src/python/bot/fuzzers/libFuzzer/constants.py
+++ b/src/python/bot/fuzzers/libFuzzer/constants.py
@@ -47,8 +47,6 @@
 
 CLEANSE_CRASH_ARGUMENT = '-cleanse_crash=1'
 
-ENTROPIC_ARGUMENT = '-entropic=1'
-
 MERGE_ARGUMENT = '-merge=1'
 
 MERGE_CONTROL_FILE_ARGUMENT = '-merge_control_file='
diff --git a/src/python/bot/fuzzers/libfuzzer.py b/src/python/bot/fuzzers/libfuzzer.py
--- a/src/python/bot/fuzzers/libfuzzer.py
+++ b/src/python/bot/fuzzers/libfuzzer.py
@@ -1526,7 +1526,6 @@ def remove_fuzzing_arguments(arguments, is_merge=False):
       # Remove the following flags/arguments that are only used for fuzzing.
       constants.DATA_FLOW_TRACE_FLAG,
       constants.DICT_FLAG,
-      constants.ENTROPIC_ARGUMENT,
       constants.FOCUS_FUNCTION_FLAG,
   ]:
     fuzzer_utils.extract_argument(arguments, argument)
@@ -1740,16 +1739,10 @@ def pick_strategies(strategy_pool,
   is_mutations_run = (not environment.is_ephemeral() and
                       candidate_generator != engine_common.Generator.NONE)
 
-  if strategy_pool.do_strategy(strategy.ENTROPIC_STRATEGY):
-    arguments.append(constants.ENTROPIC_ARGUMENT)
-    fuzzing_strategies.append(strategy.ENTROPIC_STRATEGY.name)
-
   # Depends on the presense of DFSan instrumented build.
   dataflow_build_dir = environment.get_value('DATAFLOW_BUILD_DIR')
   use_dataflow_tracing = (
       dataflow_build_dir and
-      # Focus function is not compatible with entropic mode.
-      strategy.ENTROPIC_STRATEGY.name not in fuzzing_strategies and
       strategy_pool.do_strategy(strategy.DATAFLOW_TRACING_STRATEGY))
   if use_dataflow_tracing:
     dataflow_binary_path = os.path.join(
diff --git a/src/python/fuzzing/strategy.py b/src/python/fuzzing/strategy.py
--- a/src/python/fuzzing/strategy.py
+++ b/src/python/fuzzing/strategy.py
@@ -34,8 +34,6 @@
     name='corpus_mutations_ml_rnn', probability=0.50, manually_enable=False)
 DATAFLOW_TRACING_STRATEGY = Strategy(
     name='dataflow_tracing', probability=0.50, manually_enable=True)
-ENTROPIC_STRATEGY = Strategy(
-    name='entropic', probability=0.50, manually_enable=False)
 CORPUS_SUBSET_STRATEGY = Strategy(
     name='corpus_subset', probability=0.50, manually_enable=True)
 FORK_STRATEGY = Strategy(name='fork', probability=0.50, manually_enable=False)
@@ -49,7 +47,6 @@
     name='recommended_dict', probability=0.10, manually_enable=False)
 VALUE_PROFILE_STRATEGY = Strategy(
     name='value_profile', probability=0.33, manually_enable=False)
-# TODO(mpherman): Increase the probability of peach mutation strategy.
 PEACH_GRAMMAR_MUTATION_STRATEGY = Strategy(
     name='peach_grammar_mutation', probability=0.90, manually_enable=True)
 
@@ -67,7 +64,6 @@
     MUTATOR_PLUGIN_STRATEGY,
     MUTATOR_PLUGIN_RADAMSA_STRATEGY,
     PEACH_GRAMMAR_MUTATION_STRATEGY,
-    ENTROPIC_STRATEGY,
 ]
 
 # TODO: Add more syzkaller strategies.
@@ -103,7 +99,6 @@
     RANDOM_MAX_LENGTH_STRATEGY,
     RECOMMENDED_DICTIONARY_STRATEGY,
     VALUE_PROFILE_STRATEGY,
-    ENTROPIC_STRATEGY,
 ]
 
 # To ensure that all strategies present in |strategy_list| are parsed for stats.


Test patch:
diff --git a/src/python/tests/core/bot/fuzzers/libFuzzer/engine_test.py b/src/python/tests/core/bot/fuzzers/libFuzzer/engine_test.py
--- a/src/python/tests/core/bot/fuzzers/libFuzzer/engine_test.py
+++ b/src/python/tests/core/bot/fuzzers/libFuzzer/engine_test.py
@@ -213,7 +213,6 @@ def test_fuzz(self):
         '-timeout=123',
         '-dict=blah.dict',
         '-max_len=9001',
-        '-entropic=1',
         '-use_value_profile=1',
     ], [], ['/corpus'], {}, False, False)
 
@@ -273,7 +272,6 @@ def mock_merge(*args, **kwargs):  # pylint: disable=unused-argument
             '-timeout=123',
             '-dict=blah.dict',
             '-max_len=9001',
-            '-entropic=1',
             '-use_value_profile=1',
         ],
         artifact_prefix='/fake',
@@ -352,7 +350,6 @@ def mock_merge(*args, **kwargs):  # pylint: disable=unused-argument
         'strategy_corpus_mutations_radamsa': 0,
         'strategy_corpus_subset': 0,
         'strategy_dataflow_tracing': 0,
-        'strategy_entropic': 0,
         'strategy_fork': 0,
         'strategy_mutator_plugin': 0,
         'strategy_mutator_plugin_radamsa': 0,
diff --git a/src/python/tests/core/bot/fuzzers/libFuzzer/libfuzzer_stats_test.py b/src/python/tests/core/bot/fuzzers/libFuzzer/libfuzzer_stats_test.py
--- a/src/python/tests/core/bot/fuzzers/libFuzzer/libfuzzer_stats_test.py
+++ b/src/python/tests/core/bot/fuzzers/libFuzzer/libfuzzer_stats_test.py
@@ -95,7 +95,6 @@ def test_parse_log(self):
         'slow_units_count': 0,
         'startup_crash_count': 0,
         'strategy_dataflow_tracing': 0,
-        'strategy_entropic': 1,
         'strategy_corpus_mutations_radamsa': 1,
         'strategy_corpus_mutations_ml_rnn': 0,
         'strategy_corpus_subset': 50,
diff --git a/src/python/tests/core/bot/fuzzers/libFuzzer/libfuzzer_test_data/no_crash_with_strategies.txt b/src/python/tests/core/bot/fuzzers/libFuzzer/libfuzzer_test_data/no_crash_with_strategies.txt
--- a/src/python/tests/core/bot/fuzzers/libFuzzer/libfuzzer_test_data/no_crash_with_strategies.txt
+++ b/src/python/tests/core/bot/fuzzers/libFuzzer/libfuzzer_test_data/no_crash_with_strategies.txt
@@ -76,4 +76,4 @@ stat::average_exec_per_sec:     97
 stat::new_units_added:          55
 stat::slowest_unit_time_sec:    0
 stat::peak_rss_mb:              103
-cf::fuzzing_strategies: corpus_mutations_radamsa,dummy_strategy_to_be_ignored,corpus_subset_50,random_max_len,fork_1,mutator_plugin,entropic
+cf::fuzzing_strategies: corpus_mutations_radamsa,dummy_strategy_to_be_ignored,corpus_subset_50,random_max_len,fork_1,mutator_plugin