diff --git a/fuzzers/libafl_fuzzbench_composition/builder.Dockerfile b/fuzzers/libafl_fuzzbench_composition/builder.Dockerfile index 645404e79..3789c6d22 100644 --- a/fuzzers/libafl_fuzzbench_composition/builder.Dockerfile +++ b/fuzzers/libafl_fuzzbench_composition/builder.Dockerfile @@ -40,11 +40,13 @@ RUN git clone https://github.com/tokatoka/libafl_fuzzbench /libafl_fuzzbench && git checkout 44ecead5c08f27d9db54a93a98c5d5f31d4645cc && \ git submodule update --init -# Compile libafl +# We'll build the fuzzer in fuzzer.py +''' RUN cd /libafl_fuzzbench/ && unset CFLAGS && unset CXXFLAGS && \ export CC=clang && export CXX=clang++ && \ export LIBAFL_EDGES_MAP_SIZE=2621440 && \ PATH="/root/.cargo/bin/:$PATH" cargo build --release --features no_link_main +''' # Auxiliary weak references. RUN cd /libafl_fuzzbench && \ diff --git a/fuzzers/libafl_fuzzbench_composition/fuzzer.py b/fuzzers/libafl_fuzzbench_composition/fuzzer.py index 725bd45e3..6675a0e19 100755 --- a/fuzzers/libafl_fuzzbench_composition/fuzzer.py +++ b/fuzzers/libafl_fuzzbench_composition/fuzzer.py @@ -37,11 +37,43 @@ def prepare_fuzz_environment(input_corpus): # Create at least one non-empty seed to start. utils.create_seed_file_for_empty_corpus(input_corpus) +def build_libafl(): + os.environ['CC'] = 'clang' + os.environ['CXX'] = 'clang++' + os.environ['LIBAFL_EDGES_MAP_SIZE'] = 2621440 + os.environ['PATH'] = "/root/.cargo/bin/:$PATH" + + benchmark_name = os.environ['BENCHMARK'] + if benchmark_name == "assimp_assimp_fuzzer": + feature_flags = ["fast", "naive_feedback", "grimoire"] + elif benchmark_name == "brotli_decode_fuzzer": + feature_flags = ["fast", "value_profile", "mopt"] + elif benchmark_name == "draco_draco_pc_decoder_fuzzer": + feature_flags = ["fast", "naive_feedback", "grimoire"] + elif benchmark_name == "guetzli_guetzli_fuzzer": + feature_flags = ["fast", "value_profile", "grimoire"] + elif benchmark_name == "libaom_av1_dec_fuzzer": + feature_flags = ["explore", "value_profile", "grimoire"] + elif benchmark_name == "libcoap_pdu_parse_fuzzer": + feature_flags = ["fast", "value_profile", "grimoire"] + else: + print("Unavailable benchmark") + exit(1) + + command = ["cargo", "build", "--release", "--package", "composition", "--features"] + command += ["no_link_main"] + command += feature_flags + + subprocess.check_call(command, cwd='/libafl_fuzzbench') + def build(): # pylint: disable=too-many-branches,too-many-statements """Build benchmark.""" - os.environ['CC'] = '/libafl_fuzzbench/target/release/composition_cc' - os.environ['CXX'] = '/libafl_fuzzbench/target/release/composition_cxx' + + build_libafl() + + os.environ['CC'] = '/libafl_fuzzbench/target/release/cov_accounting_cc' + os.environ['CXX'] = '/libafl_fuzzbench/target/release/cov_accounting_cxx' os.environ['ASAN_OPTIONS'] = 'abort_on_error=0:allocator_may_return_null=1' os.environ['UBSAN_OPTIONS'] = 'abort_on_error=0' diff --git a/fuzzers/libafl_fuzzbench_cov_accounting/builder.Dockerfile b/fuzzers/libafl_fuzzbench_cov_accounting/builder.Dockerfile index 8cb5a6d4c..0d8282ecc 100644 --- a/fuzzers/libafl_fuzzbench_cov_accounting/builder.Dockerfile +++ b/fuzzers/libafl_fuzzbench_cov_accounting/builder.Dockerfile @@ -40,14 +40,11 @@ RUN git clone https://github.com/AFLplusplus/libafl_fuzzbench /libafl_fuzzbench git checkout 310fe4048bb90def1619f65714ab285a4e7d2e75 && \ git submodule update --init -# We'll build the fuzzer in fuzzer.py -''' # Compile libafl RUN cd /libafl_fuzzbench/ && unset CFLAGS && unset CXXFLAGS && \ export CC=clang && export CXX=clang++ && \ export LIBAFL_EDGES_MAP_SIZE=2621440 && \ PATH="/root/.cargo/bin/:$PATH" cargo build --release --features no_link_main -''' # Auxiliary weak references. RUN cd /libafl_fuzzbench && \ diff --git a/fuzzers/libafl_fuzzbench_cov_accounting/fuzzer.py b/fuzzers/libafl_fuzzbench_cov_accounting/fuzzer.py index 6e4b65ff3..925854dc8 100755 --- a/fuzzers/libafl_fuzzbench_cov_accounting/fuzzer.py +++ b/fuzzers/libafl_fuzzbench_cov_accounting/fuzzer.py @@ -37,41 +37,9 @@ def prepare_fuzz_environment(input_corpus): # Create at least one non-empty seed to start. utils.create_seed_file_for_empty_corpus(input_corpus) -def build_libafl(): - os.environ['CC'] = 'clang' - os.environ['CXX'] = 'clang++' - os.environ['LIBAFL_EDGES_MAP_SIZE'] = 2621440 - os.environ['PATH'] = "/root/.cargo/bin/:$PATH" - - benchmark_name = os.environ['BENCHMARK'] - if benchmark_name == "assimp_assimp_fuzzer": - feature_flags = ["fast", "naive_feedback", "grimoire"] - elif benchmark_name == "brotli_decode_fuzzer": - feature_flags = ["fast", "value_profile", "mopt"] - elif benchmark_name == "draco_draco_pc_decoder_fuzzer": - feature_flags = ["fast", "naive_feedback", "grimoire"] - elif benchmark_name == "guetzli_guetzli_fuzzer": - feature_flags = ["fast", "value_profile", "grimoire"] - elif benchmark_name == "libaom_av1_dec_fuzzer": - feature_flags = ["explore", "value_profile", "grimoire"] - elif benchmark_name == "libcoap_pdu_parse_fuzzer": - feature_flags = ["fast", "value_profile", "grimoire"] - else: - print("Unavailable benchmark") - exit(1) - - command = ["cargo", "build", "--release", "--features"] - command += ["no_link_main"] - command += feature_flags - - subprocess.check_call(command, cwd='/libafl_fuzzbench') - def build(): # pylint: disable=too-many-branches,too-many-statements """Build benchmark.""" - - build_libafl() - os.environ['CC'] = '/libafl_fuzzbench/target/release/cov_accounting_cc' os.environ['CXX'] = '/libafl_fuzzbench/target/release/cov_accounting_cxx'