diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index e5cb239f44..e3ec4a71d7 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -20,7 +20,6 @@ concurrency: jobs: common: strategy: - fail-fast: false matrix: os: [ ubuntu-24.04, windows-latest, macOS-latest ] runs-on: ${{ matrix.os }} @@ -238,7 +237,7 @@ jobs: needs: - fuzzers-preflight strategy: - fail-fast: true + fail-fast: false matrix: os: [ ubuntu-24.04 ] fuzzer: @@ -321,10 +320,6 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/workflows/fuzzer-tester-prepare - - name: Build and run example fuzzers (Linux) - if: runner.os == 'Linux' - shell: bash - run: RUN_ON_CI=1 LLVM_CONFIG=llvm-config-${{env.MAIN_LLVM_VERSION}} ./scripts/test_fuzzer.sh ${{ matrix.fuzzer }} changes: runs-on: ubuntu-24.04 diff --git a/.github/workflows/fuzzer-tester-prepare/action.yml b/.github/workflows/fuzzer-tester-prepare/action.yml index fc598ee75f..8c9565bbd6 100644 --- a/.github/workflows/fuzzer-tester-prepare/action.yml +++ b/.github/workflows/fuzzer-tester-prepare/action.yml @@ -26,6 +26,10 @@ runs: uses: baptiste0928/cargo-install@v3 with: crate: cargo-make + - name: install just + uses: extractions/setup-just@v2 + with: + just-version: 1.39.0 - name: install wasm-pack uses: baptiste0928/cargo-install@v3 with: diff --git a/.github/workflows/qemu-fuzzer-tester-prepare/action.yml b/.github/workflows/qemu-fuzzer-tester-prepare/action.yml index adbf97ad50..d8b7eb54da 100644 --- a/.github/workflows/qemu-fuzzer-tester-prepare/action.yml +++ b/.github/workflows/qemu-fuzzer-tester-prepare/action.yml @@ -14,6 +14,10 @@ runs: uses: baptiste0928/cargo-install@v3 with: crate: cargo-make + - name: install just + uses: extractions/setup-just@v2 + with: + just-version: 1.39.0 - uses: actions/checkout@v4 with: submodules: true diff --git a/.github/workflows/windows-tester-prepare/action.yml b/.github/workflows/windows-tester-prepare/action.yml index a76f1a89e6..f5a6b48371 100644 --- a/.github/workflows/windows-tester-prepare/action.yml +++ b/.github/workflows/windows-tester-prepare/action.yml @@ -18,3 +18,7 @@ runs: - name: install cargo-make shell: pwsh run: cargo install --force cargo-make + - name: install just + uses: extractions/setup-just@v2 + with: + just-version: 1.39.0 diff --git a/fuzzers/baby/baby_fuzzer_custom_executor/Justfile b/fuzzers/baby/baby_fuzzer_custom_executor/Justfile new file mode 100644 index 0000000000..e2cab35a0d --- /dev/null +++ b/fuzzers/baby/baby_fuzzer_custom_executor/Justfile @@ -0,0 +1,34 @@ +FUZZER_NAME := 'fuzzer_custom_executor' +PROJECT_DIR := invocation_directory_native() +PROFILE := 'release' +PROFILE_DIR := 'release' +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME + + +alias build := fuzzer + +fuzzer: + cargo build --profile={{PROFILE}} + +run: fuzzer + {{FUZZER}} + +[linux] +[macos] +test: fuzzer + #!/bin/bash + timeout 30s {{FUZZER}} | tee fuzz_stdout.log || true + if grep -qa "objectives: 1" fuzz_stdout.log; then + echo "Fuzzer is working" + else + echo "Fuzzer does not generate any testcases or any crashes" + exit 1 + fi + +[windows] +test: fuzzer + echo "Unsupported on this platform" + +clean: + cargo clean diff --git a/fuzzers/baby/baby_fuzzer_custom_executor/Makefile.toml b/fuzzers/baby/baby_fuzzer_custom_executor/Makefile.toml deleted file mode 100644 index 5b4eed6324..0000000000 --- a/fuzzers/baby/baby_fuzzer_custom_executor/Makefile.toml +++ /dev/null @@ -1,50 +0,0 @@ -# Variables -[env] -FUZZER_NAME = 'fuzzer_custom_executor' -PROJECT_DIR = { script = ["pwd"] } -CARGO_TARGET_DIR = { value = "target", condition = { env_not_set = [ - "CARGO_TARGET_DIR", -] } } -PROFILE = { value = "release" } -PROFILE_DIR = { value = "release" } -FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}' - -[tasks.build] -alias = "fuzzer" - -[tasks.fuzzer] -description = "Build the fuzzer" -script = "cargo build --profile=${PROFILE}" - -[tasks.run] -description = "Run the fuzzer" -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}" -dependencies = ["fuzzer"] - -[tasks.test] -description = "Run a short test" -linux_alias = "test_unix" -mac_alias = "test_unix" -windows_alias = "unsupported" - -[tasks.test_unix] -script_runner = "@shell" -script = ''' -timeout 30s ${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME} | tee fuzz_stdout.log || true -if grep -qa "objectives: 1" fuzz_stdout.log; then - echo "Fuzzer is working" -else - echo "Fuzzer does not generate any testcases or any crashes" - exit 1 -fi -''' -dependencies = ["fuzzer"] - -# Clean up -[tasks.clean] -# Disable default `clean` definition -clear = true -script_runner = "@shell" -script = ''' -cargo clean -''' diff --git a/fuzzers/baby/baby_fuzzer_swap_differential/Justfile b/fuzzers/baby/baby_fuzzer_swap_differential/Justfile new file mode 100644 index 0000000000..7b813ec67e --- /dev/null +++ b/fuzzers/baby/baby_fuzzer_swap_differential/Justfile @@ -0,0 +1,38 @@ +FUZZER_NAME := 'fuzzer_sd' +PROJECT_DIR := invocation_directory_native() +PROFILE := 'release' +PROFILE_DIR := 'release' +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME +LIBAFL_CC := CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc" + + +alias build := fuzzer + +cc: + cargo build --profile={{PROFILE}} --bin libafl_cc + +fuzzer: cc + cargo build --profile={{PROFILE}} + +run: fuzzer + {{FUZZER}} + +[linux] +[macos] +test: fuzzer + #!/bin/bash + timeout 30s {{FUZZER}} | tee fuzz_stdout.log || true + if grep -qa "objectives: 1" fuzz_stdout.log; then + echo "Fuzzer is working" + else + echo "Fuzzer does not generate any testcases or any crashes" + exit 1 + fi + +[windows] +test: fuzzer + echo "Unsupported on this platform" + +clean: + cargo clean diff --git a/fuzzers/baby/baby_fuzzer_swap_differential/Makefile.toml b/fuzzers/baby/baby_fuzzer_swap_differential/Makefile.toml deleted file mode 100644 index 96f6e1f907..0000000000 --- a/fuzzers/baby/baby_fuzzer_swap_differential/Makefile.toml +++ /dev/null @@ -1,58 +0,0 @@ -# Variables -[env] -FUZZER_NAME = 'fuzzer_sd' -PROJECT_DIR = { script = ["pwd"] } -CARGO_TARGET_DIR = { value = "target", condition = { env_not_set = [ - "CARGO_TARGET_DIR", -] } } -PROFILE = { value = "release" } -PROFILE_DIR = { value = "release" } -LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc' -FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}' - -# Compilers -[tasks.cc] -command = "cargo" -args = ["build", "--profile", "${PROFILE}", "--bin", "libafl_cc"] - -# Harness -[tasks.fuzzer] -command = "cargo" -args = ["build", "--profile", "${PROFILE}", "--bin", "${FUZZER_NAME}"] -dependencies = ["cc"] - -[tasks.build] -alias = "fuzzer" - -# Run the fuzzer -[tasks.run] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}" -dependencies = ["fuzzer"] - -# Test -[tasks.test] -linux_alias = "test_unix" -mac_alias = "test_unix" -windows_alias = "unsupported" - -[tasks.test_unix] -script_runner = "@shell" -script = ''' -timeout 30s ${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME} | tee fuzz_stdout.log || true -if grep -qa "objectives: 1" fuzz_stdout.log; then - echo "Fuzzer is working" -else - echo "Fuzzer does not generate any testcases or any crashes" - exit 1 -fi -''' -dependencies = ["fuzzer"] - -# Clean up -[tasks.clean] -# Disable default `clean` definition -clear = true -script_runner = "@shell" -script = ''' -cargo clean -''' diff --git a/fuzzers/fuzz_anything/baby_fuzzer_wasm/Justfile b/fuzzers/fuzz_anything/baby_fuzzer_wasm/Justfile new file mode 100644 index 0000000000..131bc20b51 --- /dev/null +++ b/fuzzers/fuzz_anything/baby_fuzzer_wasm/Justfile @@ -0,0 +1,22 @@ +FUZZER_NAME := 'fuzzer_wasm' +PROJECT_DIR := invocation_directory_native() +PROFILE := 'release' +PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" } +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME +LIBAFL_CC := CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc" + +build: + cargo build --target web + +[linux] +[macos] +test: + wasm-pack test --chrome --headless + +[windows] +test: + echo "Unsupported on this platform" + +clean: + cargo clean diff --git a/fuzzers/fuzz_anything/baby_fuzzer_wasm/Makefile.toml b/fuzzers/fuzz_anything/baby_fuzzer_wasm/Makefile.toml deleted file mode 100644 index d57074798b..0000000000 --- a/fuzzers/fuzz_anything/baby_fuzzer_wasm/Makefile.toml +++ /dev/null @@ -1,29 +0,0 @@ -[env] -FUZZER_NAME = "fuzzer" -PROJECT_DIR = { script = ["pwd"] } - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this" -''' - -# Fuzzer -[tasks.build] -command = "wasm-pack" -args = ["build", "--target", "web"] - -# Test -[tasks.test] -linux_alias = "test_unix" -mac_alias = "test_unix" -windows_alias = "unsupported" - -[tasks.test_unix] -command = "wasm-pack" -args = ["test", "--chrome", "--headless"] - -# Clean -[tasks.clean] -command = "cargo" -args = ["clean"] diff --git a/fuzzers/fuzz_anything/baby_no_std/Justfile b/fuzzers/fuzz_anything/baby_no_std/Justfile new file mode 100644 index 0000000000..ecdbb3d564 --- /dev/null +++ b/fuzzers/fuzz_anything/baby_no_std/Justfile @@ -0,0 +1,26 @@ +FUZZER_NAME := 'fuzzer_no_std' +PROJECT_DIR := invocation_directory_native() +PROFILE := 'release' +PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" } +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME +LIBAFL_CC := CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc" + +build: + cargo build --profile={{PROFILE}} -Zbuild-std=core,alloc --target x86_64-unknown-linux-gnu + +build_aarch: + cargo +nightly build -Zbuild-std=core,alloc --target aarch64-unknown-none -v --profile {{PROFILE}} + +[linux] +test: build + cargo run -Zbuild-std=core,alloc --target x86_64-unknown-linux-gnu || true + +[macos] +[windows] +test: build + echo "Unsupported on this platform" + + +clean: + cargo clean diff --git a/fuzzers/fuzz_anything/baby_no_std/Makefile.toml b/fuzzers/fuzz_anything/baby_no_std/Makefile.toml deleted file mode 100644 index 2c31821d18..0000000000 --- a/fuzzers/fuzz_anything/baby_no_std/Makefile.toml +++ /dev/null @@ -1,45 +0,0 @@ -[env] -FUZZER_NAME = "fuzzer" -PROJECT_DIR = { script = ["pwd"] } -PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } } -PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [ - "PROFILE_DIR", -] } } - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this" -''' - -# Fuzzer -[tasks.build] -command = "cargo" -args = [ - "build", - "--profile", - "${PROFILE}", - "-Zbuild-std=core,alloc", - "--target", - "x86_64-unknown-linux-gnu", -] - -# Test -[tasks.test] -linux_alias = "test_unix" -mac_alias = "unsupported" -windows_alias = "unsupported" - -[tasks.test_unix] -script = ''' -cargo run -Zbuild-std=core,alloc --target x86_64-unknown-linux-gnu || true -''' -dependencies = ["build"] - -[tasks.build_aarch] -script = "cargo +nightly build -Zbuild-std=core,alloc --target aarch64-unknown-none -v --profile ${PROFILE}" - -# Clean -[tasks.clean] -command = "cargo" -args = ["clean"] diff --git a/fuzzers/fuzz_anything/cargo_fuzz/Justfile b/fuzzers/fuzz_anything/cargo_fuzz/Justfile new file mode 100644 index 0000000000..2cfe5cddb6 --- /dev/null +++ b/fuzzers/fuzz_anything/cargo_fuzz/Justfile @@ -0,0 +1,27 @@ +install_llvm_tools: + rustup toolchain install nightly --component llvm-tools-preview + +install_cargo_fuzz: + cargo install cargo-fuzz + +build: install_cargo_fuzz install_llvm_tools + cargo +nightly fuzz build fuzz_target_1 + +[linux] +test: build + #!/bin/bash + timeout 30s cargo +nightly fuzz run fuzz_target_1 2>&1 | tee fuzz_stdout.log || true + if grep -qa "objectives: 1" fuzz_stdout.log; then + echo "Fuzzer is working" + else + echo "Fuzzer does not generate any testcases or any crashes" + exit 1 + fi + +[macos] +[windows] +test: build + echo "Unsupported on this platform" + +clean: + rm -rf fuzz/target \ No newline at end of file diff --git a/fuzzers/fuzz_anything/cargo_fuzz/Makefile.toml b/fuzzers/fuzz_anything/cargo_fuzz/Makefile.toml deleted file mode 100644 index 31bf5e7221..0000000000 --- a/fuzzers/fuzz_anything/cargo_fuzz/Makefile.toml +++ /dev/null @@ -1,44 +0,0 @@ -[env] - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this" -''' - -[tasks.install_llvm_tools] -command = "rustup" -args = ["toolchain", "install", "nightly", "--component", "llvm-tools-preview"] - - -[tasks.install_cargo_fuzz] -command = "cargo" -args = ["install", "cargo-fuzz"] - -# Fuzzer -[tasks.build] -command = "cargo" -args = ["+nightly", "fuzz", "build", "fuzz_target_1"] -dependencies = ["install_cargo_fuzz", "install_llvm_tools"] - -[tasks.test] -linux_alias = "test_unix" -mac_alias = "unsupported" -windows_alias = "unsupported" - -[tasks.test_unix] -script = ''' -timeout 30s cargo +nightly fuzz run fuzz_target_1 2>&1 | tee fuzz_stdout.log || true -if grep -qa "objectives: 1" fuzz_stdout.log; then - echo "Fuzzer is working" -else - echo "Fuzzer does not generate any testcases or any crashes" - exit 1 -fi -''' -dependencies = ["build"] - -# Clean -[tasks.clean] -command = "rm " -args = ["-rf", "fuzz/target"] diff --git a/fuzzers/inprocess/fuzzbench/Justfile b/fuzzers/inprocess/fuzzbench/Justfile new file mode 100644 index 0000000000..f4150cd4ea --- /dev/null +++ b/fuzzers/inprocess/fuzzbench/Justfile @@ -0,0 +1,77 @@ +FUZZER_NAME := 'fuzzbench' +PROJECT_DIR := invocation_directory_native() +PROFILE := env("PROFILE", "release") +PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" } +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME + + +alias build := fuzzer + +alias cc := cxx + +[linux] +[macos] +cxx: + cargo build --profile={{PROFILE}} + +[windows] +cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +fuzz_o: cxx + {{CARGO_TARGET_DIR}}/{{PROFILE_DIR}}/libafl_cc --libafl-no-link -O3 -c fuzz.c -o fuzz.o + +[windows] +fuzz_o: + echo "Unsupported on this platform" + +[linux] +[macos] +fuzzer: cxx fuzz_o + {{CARGO_TARGET_DIR}}/{{PROFILE_DIR}}/libafl_cxx --libafl fuzz.o -o {{FUZZER_NAME}} -lm -lz + +[windows] +fuzzer: + echo "Unsupported on this platform" + + +[linux] +[macos] +run: cxx fuzz_o + #!/bin/bash + rm -rf libafl_unix_shmem_server || true + mkdir in || true + echo a > in/a + ./{{FUZZER_NAME}} -o out -i in + +[windows] +run: + echo "Unsupported on this platform" + +[linux] +[macos] +test: fuzzer + #!/bin/bash + rm -rf libafl_unix_shmem_server || true + mkdir in || true + echo a > in/a + # Allow sigterm as exit code + timeout 31s ./{{FUZZER_NAME}} -o out -i in | tee fuzz_stdout.log || true + if grep -qa "objectives: 1" fuzz_stdout.log; then + echo "Fuzzer is working" + else + echo "Fuzzer does not generate any testcases or any crashes" + exit 1 + fi + rm -rf out || true + rm -rf in || true + +[windows] +test: fuzzer + echo "Unsupported on this platform" + +clean: + cargo clean diff --git a/fuzzers/inprocess/fuzzbench/Makefile.toml b/fuzzers/inprocess/fuzzbench/Makefile.toml deleted file mode 100644 index 47b59c49b0..0000000000 --- a/fuzzers/inprocess/fuzzbench/Makefile.toml +++ /dev/null @@ -1,112 +0,0 @@ -[env] -PROJECT_DIR = { script = ["pwd"] } -CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [ - "CARGO_TARGET_DIR", -] } } -FUZZER_NAME = "fuzzer" -PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } } -PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [ - "PROFILE_DIR", -] } } - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this" -''' - -# Compilers -[tasks.cxx] -linux_alias = "cxx_unix" -mac_alias = "cxx_unix" -windows_alias = "unsupported" - -[tasks.cxx_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.cc] -linux_alias = "cc_unix" -mac_alias = "cc_unix" -windows_alias = "unsupported" - -[tasks.cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -# fuzz.o File -[tasks.fuzz_o] -linux_alias = "fuzz_o_unix" -mac_alias = "fuzz_o_unix" -windows_alias = "unsupported" - -[tasks.fuzz_o_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" -args = ["--libafl-no-link", "-O3", "-c", "fuzz.c", "-o", "fuzz.o"] -dependencies = ["cc", "cxx"] - -# Fuzzer -[tasks.fuzzer] -linux_alias = "fuzzer_unix" -mac_alias = "fuzzer_unix" -windows_alias = "unsupported" - -[tasks.fuzzer_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = ["--libafl", "fuzz.o", "-o", "${FUZZER_NAME}", "-lm", "-lz"] -dependencies = ["cc", "cxx", "fuzz_o"] - -# Run -[tasks.run] -linux_alias = "run_unix" -mac_alias = "run_unix" -windows_alias = "unsupported" - -[tasks.run_unix] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -mkdir in || true -echo a > in/a -./${FUZZER_NAME} -o out -i in -''' -dependencies = ["fuzzer"] - - -# Test -[tasks.test] -linux_alias = "test_unix" -mac_alias = "test_unix" -windows_alias = "unsupported" - -[tasks.test_unix] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -mkdir in || true -echo a > in/a -# Allow sigterm as exit code -timeout 31s ./${FUZZER_NAME} -o out -i in | tee fuzz_stdout.log || true -if grep -qa "objectives: 1" fuzz_stdout.log; then - echo "Fuzzer is working" -else - echo "Fuzzer does not generate any testcases or any crashes" - exit 1 -fi -rm -rf out || true -rm -rf in || true -''' -dependencies = ["fuzzer"] - -# Clean -[tasks.clean] -linux_alias = "clean_unix" -mac_alias = "clean_unix" -windows_alias = "unsupported" - -[tasks.clean_unix] -script_runner = "@shell" -script = ''' -rm ./${FUZZER_NAME} || true -rm fuzz.o || true -''' diff --git a/fuzzers/inprocess/fuzzbench_ctx/Justfile b/fuzzers/inprocess/fuzzbench_ctx/Justfile new file mode 100644 index 0000000000..88a209fdf5 --- /dev/null +++ b/fuzzers/inprocess/fuzzbench_ctx/Justfile @@ -0,0 +1,77 @@ +FUZZER_NAME := 'fuzzbench_ctx' +PROJECT_DIR := invocation_directory_native() +PROFILE := env("PROFILE", "release") +PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" } +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME + + +alias build := fuzzer + +alias cc := cxx + +[linux] +[macos] +cxx: + cargo build --profile={{PROFILE}} + +[windows] +cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +fuzz_o: cxx + {{CARGO_TARGET_DIR}}/{{PROFILE_DIR}}/libafl_cc --libafl-no-link -O3 -c fuzz.c -o fuzz.o + +[windows] +fuzz_o: + echo "Unsupported on this platform" + +[linux] +[macos] +fuzzer: cxx fuzz_o + {{CARGO_TARGET_DIR}}/{{PROFILE_DIR}}/libafl_cxx --libafl fuzz.o -o {{FUZZER_NAME}} -lm -lz + +[windows] +fuzzer: + echo "Unsupported on this platform" + + +[linux] +[macos] +run: cxx fuzz_o + #!/bin/bash + rm -rf libafl_unix_shmem_server || true + mkdir in || true + echo a > in/a + ./{{FUZZER_NAME}} -o out -i in + +[windows] +run: + echo "Unsupported on this platform" + +[linux] +[macos] +test: fuzzer + #!/bin/bash + rm -rf libafl_unix_shmem_server || true + mkdir in || true + echo a > in/a + # Allow sigterm as exit code + timeout 31s ./{{FUZZER_NAME}} -o out -i in | tee fuzz_stdout.log || true + if grep -qa "objectives: 1" fuzz_stdout.log; then + echo "Fuzzer is working" + else + echo "Fuzzer does not generate any testcases or any crashes" + exit 1 + fi + rm -rf out || true + rm -rf in || true + +[windows] +test: fuzzer + echo "Unsupported on this platform" + +clean: + cargo clean diff --git a/fuzzers/inprocess/fuzzbench_ctx/Makefile.toml b/fuzzers/inprocess/fuzzbench_ctx/Makefile.toml deleted file mode 100644 index 47b59c49b0..0000000000 --- a/fuzzers/inprocess/fuzzbench_ctx/Makefile.toml +++ /dev/null @@ -1,112 +0,0 @@ -[env] -PROJECT_DIR = { script = ["pwd"] } -CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [ - "CARGO_TARGET_DIR", -] } } -FUZZER_NAME = "fuzzer" -PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } } -PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [ - "PROFILE_DIR", -] } } - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this" -''' - -# Compilers -[tasks.cxx] -linux_alias = "cxx_unix" -mac_alias = "cxx_unix" -windows_alias = "unsupported" - -[tasks.cxx_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.cc] -linux_alias = "cc_unix" -mac_alias = "cc_unix" -windows_alias = "unsupported" - -[tasks.cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -# fuzz.o File -[tasks.fuzz_o] -linux_alias = "fuzz_o_unix" -mac_alias = "fuzz_o_unix" -windows_alias = "unsupported" - -[tasks.fuzz_o_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" -args = ["--libafl-no-link", "-O3", "-c", "fuzz.c", "-o", "fuzz.o"] -dependencies = ["cc", "cxx"] - -# Fuzzer -[tasks.fuzzer] -linux_alias = "fuzzer_unix" -mac_alias = "fuzzer_unix" -windows_alias = "unsupported" - -[tasks.fuzzer_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = ["--libafl", "fuzz.o", "-o", "${FUZZER_NAME}", "-lm", "-lz"] -dependencies = ["cc", "cxx", "fuzz_o"] - -# Run -[tasks.run] -linux_alias = "run_unix" -mac_alias = "run_unix" -windows_alias = "unsupported" - -[tasks.run_unix] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -mkdir in || true -echo a > in/a -./${FUZZER_NAME} -o out -i in -''' -dependencies = ["fuzzer"] - - -# Test -[tasks.test] -linux_alias = "test_unix" -mac_alias = "test_unix" -windows_alias = "unsupported" - -[tasks.test_unix] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -mkdir in || true -echo a > in/a -# Allow sigterm as exit code -timeout 31s ./${FUZZER_NAME} -o out -i in | tee fuzz_stdout.log || true -if grep -qa "objectives: 1" fuzz_stdout.log; then - echo "Fuzzer is working" -else - echo "Fuzzer does not generate any testcases or any crashes" - exit 1 -fi -rm -rf out || true -rm -rf in || true -''' -dependencies = ["fuzzer"] - -# Clean -[tasks.clean] -linux_alias = "clean_unix" -mac_alias = "clean_unix" -windows_alias = "unsupported" - -[tasks.clean_unix] -script_runner = "@shell" -script = ''' -rm ./${FUZZER_NAME} || true -rm fuzz.o || true -''' diff --git a/fuzzers/inprocess/fuzzbench_text/Justfile b/fuzzers/inprocess/fuzzbench_text/Justfile new file mode 100644 index 0000000000..f4150cd4ea --- /dev/null +++ b/fuzzers/inprocess/fuzzbench_text/Justfile @@ -0,0 +1,77 @@ +FUZZER_NAME := 'fuzzbench' +PROJECT_DIR := invocation_directory_native() +PROFILE := env("PROFILE", "release") +PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" } +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME + + +alias build := fuzzer + +alias cc := cxx + +[linux] +[macos] +cxx: + cargo build --profile={{PROFILE}} + +[windows] +cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +fuzz_o: cxx + {{CARGO_TARGET_DIR}}/{{PROFILE_DIR}}/libafl_cc --libafl-no-link -O3 -c fuzz.c -o fuzz.o + +[windows] +fuzz_o: + echo "Unsupported on this platform" + +[linux] +[macos] +fuzzer: cxx fuzz_o + {{CARGO_TARGET_DIR}}/{{PROFILE_DIR}}/libafl_cxx --libafl fuzz.o -o {{FUZZER_NAME}} -lm -lz + +[windows] +fuzzer: + echo "Unsupported on this platform" + + +[linux] +[macos] +run: cxx fuzz_o + #!/bin/bash + rm -rf libafl_unix_shmem_server || true + mkdir in || true + echo a > in/a + ./{{FUZZER_NAME}} -o out -i in + +[windows] +run: + echo "Unsupported on this platform" + +[linux] +[macos] +test: fuzzer + #!/bin/bash + rm -rf libafl_unix_shmem_server || true + mkdir in || true + echo a > in/a + # Allow sigterm as exit code + timeout 31s ./{{FUZZER_NAME}} -o out -i in | tee fuzz_stdout.log || true + if grep -qa "objectives: 1" fuzz_stdout.log; then + echo "Fuzzer is working" + else + echo "Fuzzer does not generate any testcases or any crashes" + exit 1 + fi + rm -rf out || true + rm -rf in || true + +[windows] +test: fuzzer + echo "Unsupported on this platform" + +clean: + cargo clean diff --git a/fuzzers/inprocess/fuzzbench_text/Makefile.toml b/fuzzers/inprocess/fuzzbench_text/Makefile.toml deleted file mode 100644 index aa9757af28..0000000000 --- a/fuzzers/inprocess/fuzzbench_text/Makefile.toml +++ /dev/null @@ -1,114 +0,0 @@ -[env] -PROJECT_DIR = { script = ["pwd"] } -CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [ - "CARGO_TARGET_DIR", -] } } -FUZZER_NAME = "fuzzer" -PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } } -PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [ - "PROFILE_DIR", -] } } - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this" -''' - -# Compilers -[tasks.cxx] -linux_alias = "cxx_unix" -mac_alias = "cxx_unix" -windows_alias = "unsupported" - -[tasks.cxx_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.cc] -linux_alias = "cc_unix" -mac_alias = "cc_unix" -windows_alias = "unsupported" - -[tasks.cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -# fuzz.o File -[tasks.fuzz_o] -linux_alias = "fuzz_o_unix" -mac_alias = "fuzz_o_unix" -windows_alias = "unsupported" - -[tasks.fuzz_o_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" -args = ["--libafl-no-link", "-O3", "-c", "fuzz.c", "-o", "fuzz.o"] -dependencies = ["cc", "cxx"] - -# Fuzzer -[tasks.fuzzer] -linux_alias = "fuzzer_unix" -mac_alias = "fuzzer_unix" -windows_alias = "unsupported" - -[tasks.fuzzer_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = ["--libafl", "fuzz.o", "-o", "${FUZZER_NAME}", "-lm", "-lz"] -dependencies = ["cc", "cxx", "fuzz_o"] - -# Run -[tasks.run] -linux_alias = "run_unix" -mac_alias = "run_unix" -windows_alias = "unsupported" - -[tasks.run_unix] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -mkdir in || true -echo a > in/a -# Allow sigterm as exit code -./${FUZZER_NAME} -o out -i in -''' -dependencies = ["fuzzer"] - - -# Test -[tasks.test] -linux_alias = "test_unix" -mac_alias = "test_unix" -windows_alias = "unsupported" - -[tasks.test_unix] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -mkdir in || true -echo a > in/a -# Allow sigterm as exit code -timeout 31s ./${FUZZER_NAME} -o out -i in | tee fuzz_stdout.log || true -cat fuzz_stdout.log -if grep -qa "objectives: 1" fuzz_stdout.log; then - echo "Fuzzer is working" -else - echo "Fuzzer does not generate any testcases or any crashes" - exit 1 -fi -rm -rf out || true -rm -rf in || true -''' -dependencies = ["fuzzer"] - -# Clean -[tasks.clean] -linux_alias = "clean_unix" -mac_alias = "clean_unix" -windows_alias = "unsupported" - -[tasks.clean_unix] -script_runner = "@shell" -script = ''' -rm ./${FUZZER_NAME} || true -rm fuzz.o || true -''' diff --git a/fuzzers/inprocess/libfuzzer_libpng/Justfile b/fuzzers/inprocess/libfuzzer_libpng/Justfile new file mode 100644 index 0000000000..26fa379370 --- /dev/null +++ b/fuzzers/inprocess/libfuzzer_libpng/Justfile @@ -0,0 +1,136 @@ +FUZZER_NAME := 'fuzzer_libpng' +PROJECT_DIR := invocation_directory_native() +PROFILE := env("PROFILE", "release") +PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" } +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME +LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc" +LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx" + + +alias cc := cxx + +[linux] +[macos] +libpng: + #!/bin/bash + if [ ! -f v1.6.37.tar.gz ]; then + wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz + fi + tar -xvf v1.6.37.tar.gz + +[windows] +libpng: + echo "Unsupported on this platform" + +[linux] +[macos] +cxx: + cargo build --profile {{PROFILE}} + +[windows] +cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +crash_cxx: + cargo build --profile {{PROFILE}} --features=crash + +[windows] +crash_cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +lib: libpng cxx + #!/bin/bash + cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes + cd {{PROJECT_DIR}} + make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}" + +[windows] +lib: + echo "Unsupported on this platform" + +[linux] +[macos] +crash_lib: libpng crash_cxx + #!/bin/bash + cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes + cd {{PROJECT_DIR}} + make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}" + +[windows] +crash_lib: + echo "Unsupported on this platform" + +[linux] +[macos] +fuzzer: lib cxx + pwd + {{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz + +[windows] +fuzzer: + echo "Unsupported on this platform" + +[linux] +[macos] +crash_fuzzer: crash_lib crash_cxx + {{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz + +[windows] +crash_fuzzer: + echo "Unsupported on this platform" + + +[linux] +[macos] +run: fuzzer + #!/bin/bash + ./{{FUZZER_NAME}} & + sleep 0.2 + ./{{FUZZER_NAME}} 2>/dev/null + +[windows] +run: fuzzer + echo "Unsupported on this platform" + +[linux] +[macos] +crash: crash_fuzzer + #!/bin/bash + ./{{FUZZER_NAME}} & + sleep 0.2 + ./{{FUZZER_NAME}} 2>/dev/null + +[windows] +crash: fuzzer + echo "Unsupported on this platform" + + +[linux] +[macos] +test: fuzzer + #!/bin/bash + rm -rf libafl_unix_shmem_server || true + (timeout 31s ./{{FUZZER_NAME}} 2>/dev/null | tee fuzz_stdout.log || true) & + sleep 0.2 + timeout 30s ./{{FUZZER_NAME}} >/dev/null 2>/dev/null || true + if grep -qa "corpus: 30" fuzz_stdout.log; then + echo "Fuzzer is working" + else + echo "Fuzzer does not generate any testcases or any crashes" + exit 1 + fi + +[windows] +test: fuzzer + echo "Unsupported on this platform" + +clean: + rm -rf {{FUZZER_NAME}} + make -C libpng-1.6.37 clean || true + cargo clean + diff --git a/fuzzers/inprocess/libfuzzer_libpng/Makefile.toml b/fuzzers/inprocess/libfuzzer_libpng/Makefile.toml deleted file mode 100644 index 7b0c8d0213..0000000000 --- a/fuzzers/inprocess/libfuzzer_libpng/Makefile.toml +++ /dev/null @@ -1,221 +0,0 @@ -# Variables -[env] -FUZZER_NAME = 'fuzzer_libpng' -PROJECT_DIR = { script = ["pwd"] } -CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [ - "CARGO_TARGET_DIR", -] } } -PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } } -PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [ - "PROFILE_DIR", -] } } -LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc' -LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/libafl_cxx' -FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}' - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this" -''' - -# libpng -[tasks.libpng] -linux_alias = "libpng_unix" -mac_alias = "libpng_unix" -windows_alias = "unsupported" - -[tasks.libpng_unix] -condition = { files_not_exist = ["./libpng-1.6.37"] } -script_runner = "@shell" -script = ''' -wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz -tar -xvf v1.6.37.tar.gz -''' - -# Compilers -[tasks.cxx] -linux_alias = "cxx_unix" -mac_alias = "cxx_unix" -windows_alias = "unsupported" - -[tasks.cxx_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.cc] -linux_alias = "cc_unix" -mac_alias = "cc_unix" -windows_alias = "unsupported" - -[tasks.cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.crash_cxx] -linux_alias = "crash_cxx_unix" -mac_alias = "crash_cxx_unix" -windows_alias = "unsupported" - -[tasks.crash_cxx_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}", "--features=crash"] - -[tasks.crash_cc] -linux_alias = "crash_cc_unix" -mac_alias = "crash_cc_unix" -windows_alias = "unsupported" - -[tasks.crash_cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}", "--features=crash"] - -# Library -[tasks.lib] -linux_alias = "lib_unix" -mac_alias = "lib_unix" -windows_alias = "unsupported" - -[tasks.lib_unix] -script_runner = "@shell" -script = ''' -cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes -cd "${PROJECT_DIR}" -make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -''' -dependencies = ["libpng", "cxx", "cc"] - -# Library -[tasks.crash_lib] -linux_alias = "crash_lib_unix" -mac_alias = "crash_lib_unix" -windows_alias = "unsupported" - -[tasks.crash_lib_unix] -script_runner = "@shell" -script = ''' -cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes -cd "${PROJECT_DIR}" -make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -''' -dependencies = ["libpng", "crash_cxx", "crash_cc"] - -# Harness -[tasks.fuzzer] -linux_alias = "fuzzer_unix" -mac_alias = "fuzzer_unix" -windows_alias = "unsupported" - -[tasks.fuzzer_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = [ - "${PROJECT_DIR}/harness.cc", - "${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a", - "-I", - "${PROJECT_DIR}/libpng-1.6.37/", - "-o", - "${FUZZER_NAME}", - "-lm", - "-lz", -] -dependencies = ["lib", "cxx", "cc"] - -# Crashing Harness -[tasks.fuzzer_crash] -linux_alias = "fuzzer_crash_unix" -mac_alias = "fuzzer_crash_unix" -windows_alias = "unsupported" - -[tasks.fuzzer_crash_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = [ - "${PROJECT_DIR}/harness.cc", - "${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a", - "-I", - "${PROJECT_DIR}/libpng-1.6.37/", - "-o", - "${FUZZER_NAME}_crash", - "-lm", - "-lz", -] -dependencies = ["crash_lib", "crash_cxx", "crash_cc"] - -# Run the fuzzer -[tasks.run] -linux_alias = "run_unix" -mac_alias = "run_unix" -windows_alias = "unsupported" - -[tasks.run_unix] -script_runner = "@shell" -script = ''' -./${FUZZER_NAME} & -sleep 0.2 -./${FUZZER_NAME} 2>/dev/null -''' -dependencies = ["fuzzer"] - - -# Run the fuzzer with a crash -[tasks.crash] -linux_alias = "crash_unix" -mac_alias = "crash_unix" -windows_alias = "unsupported" - -[tasks.crash_unix] -script_runner = "@shell" -script = ''' -./${FUZZER_NAME}_crash & -sleep 0.2 -./${FUZZER_NAME}_crash 2>/dev/null -''' -dependencies = ["fuzzer_crash"] - - -# Test -[tasks.test] -linux_alias = "test_unix" -mac_alias = "test_mac" -windows_alias = "unsupported" - -[tasks.test_unix] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -(timeout 31s ./${FUZZER_NAME} | tee fuzz_stdout.log 2>/dev/null || true) & -sleep 0.2 -timeout 30s ./${FUZZER_NAME} >/dev/null 2>/dev/null || true -if grep -qa "corpus: 30" fuzz_stdout.log; then - echo "Fuzzer is working" -else - echo "Fuzzer does not generate any testcases or any crashes" - exit 1 -fi -''' -dependencies = ["fuzzer"] - -[tasks.test_mac] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -(timeout 31s ./${FUZZER_NAME} | tee fuzz_stdout.log 2>/dev/null || true) & -sleep 0.2 -timeout 30s ./${FUZZER_NAME} >/dev/null 2>/dev/null || true -''' -dependencies = ["fuzzer"] - -# Clean up -[tasks.clean] -linux_alias = "clean_unix" -mac_alias = "clean_unix" -windows_alias = "unsupported" - -[tasks.clean_unix] -# Disable default `clean` definition -clear = true -script_runner = "@shell" -script = ''' -rm -f ./${FUZZER_NAME} -make -C libpng-1.6.37 clean -cargo clean -''' diff --git a/fuzzers/inprocess/libfuzzer_libpng_accounting/Justfile b/fuzzers/inprocess/libfuzzer_libpng_accounting/Justfile new file mode 100644 index 0000000000..7020bcdddd --- /dev/null +++ b/fuzzers/inprocess/libfuzzer_libpng_accounting/Justfile @@ -0,0 +1,87 @@ +FUZZER_NAME := 'fuzzer_libpng_accounting' +PROJECT_DIR := invocation_directory_native() +PROFILE := env("PROFILE", "release") +PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" } +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME +LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc" +LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx" + + +alias cc := cxx + +[linux] +[macos] +libpng: + #!/bin/bash + if [ ! -f v1.6.37.tar.gz ]; then + wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz + fi + tar -xvf v1.6.37.tar.gz + +[windows] +libpng: + echo "Unsupported on this platform" + +[linux] +[macos] +cxx: + cargo build --profile {{PROFILE}} + +[windows] +cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +lib: libpng cxx + #!/bin/bash + cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes + cd {{PROJECT_DIR}} + make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}" + +[windows] +lib: + echo "Unsupported on this platform" + +[linux] +[macos] +fuzzer: lib cxx + pwd + {{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz + +[windows] +fuzzer: + echo "Unsupported on this platform" + +[linux] +[macos] +run: fuzzer + ./{{FUZZER_NAME}} --cores 0 --input ./corpus + +[windows] +run: fuzzer + echo "Unsupported on this platform" + +[linux] +[macos] +test: fuzzer + #!/bin/bash + rm -rf libafl_unix_shmem_server || true + timeout 31s ./{{FUZZER_NAME}} --cores 0 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true + if grep -qa "corpus: 30" fuzz_stdout.log; then + echo "Fuzzer is working" + else + echo "Fuzzer does not generate any testcases or any crashes" + exit 1 + fi + +[windows] +test: fuzzer + echo "Unsupported on this platform" + +clean: + rm -rf {{FUZZER_NAME}} + make -C libpng-1.6.37 clean || true + cargo clean + diff --git a/fuzzers/inprocess/libfuzzer_libpng_accounting/Makefile.toml b/fuzzers/inprocess/libfuzzer_libpng_accounting/Makefile.toml deleted file mode 100644 index d928de5bbc..0000000000 --- a/fuzzers/inprocess/libfuzzer_libpng_accounting/Makefile.toml +++ /dev/null @@ -1,146 +0,0 @@ -# Variables -[env] -CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [ - "CARGO_TARGET_DIR", -] } } -PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } } -PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [ - "PROFILE_DIR", -] } } -FUZZER_NAME = 'fuzzer_libpng_accounting' -LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc' -LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/libafl_cxx' -FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}' -PROJECT_DIR = { script = ["pwd"] } - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this platform" -''' - -# libpng -[tasks.libpng] -linux_alias = "libpng_unix" -mac_alias = "libpng_unix" -windows_alias = "unsupported" - -[tasks.libpng_unix] -condition = { files_not_exist = ["./libpng-1.6.37"] } -script_runner = "@shell" -script = ''' -wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz -tar -xvf v1.6.37.tar.gz -''' - -# Compilers -[tasks.cxx] -linux_alias = "cxx_unix" -mac_alias = "cxx_unix" -windows_alias = "unsupported" - -[tasks.cxx_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.cc] -linux_alias = "cc_unix" -mac_alias = "cc_unix" -windows_alias = "unsupported" - -[tasks.cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -# Library -[tasks.lib] -linux_alias = "lib_unix" -mac_alias = "lib_unix" -windows_alias = "unsupported" - -[tasks.lib_unix] -script_runner = "@shell" -script = ''' -cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes -cd "${PROJECT_DIR}" -make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -''' -dependencies = ["libpng", "cxx", "cc"] - - -# Harness -[tasks.fuzzer] -linux_alias = "fuzzer_unix" -mac_alias = "fuzzer_unix" -windows_alias = "unsupported" - -[tasks.fuzzer_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = [ - "${PROJECT_DIR}/harness.cc", - "${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a", - "-I", - "${PROJECT_DIR}/libpng-1.6.37/", - "-o", - "${FUZZER_NAME}", - "-lm", - "-lz", -] -dependencies = ["lib", "cxx", "cc"] - -# Run the fuzzer -[tasks.run] -linux_alias = "run_unix" -mac_alias = "run_unix" -windows_alias = "unsupported" - -[tasks.run_unix] -script_runner = "@shell" -script = ''' -./${FUZZER_NAME} --cores 0 --input ./corpus -''' -dependencies = ["fuzzer"] - -# Test -[tasks.test] -linux_alias = "test_unix" -mac_alias = "test_mac" -windows_alias = "unsupported" - -[tasks.test_unix] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -timeout 31s ./${FUZZER_NAME} --cores 0 --input ./corpus | tee fuzz_stdout.log 2>/dev/null || true -if grep -qa "corpus: 30" fuzz_stdout.log; then - echo "Fuzzer is working" -else - echo "Fuzzer does not generate any testcases or any crashes" - exit 1 -fi -''' -dependencies = ["fuzzer"] - -[tasks.test_mac] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -timeout 31s ./${FUZZER_NAME} --cores 0 --input ./corpus | tee fuzz_stdout.log 2>/dev/null || true -''' -dependencies = ["fuzzer"] - -# Clean up -[tasks.clean] -linux_alias = "clean_unix" -mac_alias = "clean_unix" -windows_alias = "unsupported" - -[tasks.clean_unix] -# Disable default `clean` definition -clear = true -script_runner = "@shell" -script = ''' -rm -f ./${FUZZER_NAME} -make -C libpng-1.6.37 clean -cargo clean -''' diff --git a/fuzzers/inprocess/libfuzzer_libpng_centralized/Justfile b/fuzzers/inprocess/libfuzzer_libpng_centralized/Justfile new file mode 100644 index 0000000000..19d2c76b88 --- /dev/null +++ b/fuzzers/inprocess/libfuzzer_libpng_centralized/Justfile @@ -0,0 +1,87 @@ +FUZZER_NAME := 'fuzzer_libpng_centralized' +PROJECT_DIR := invocation_directory_native() +PROFILE := env("PROFILE", "release") +PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" } +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME +LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc" +LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx" + + +alias cc := cxx + +[linux] +[macos] +libpng: + #!/bin/bash + if [ ! -f v1.6.37.tar.gz ]; then + wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz + fi + tar -xvf v1.6.37.tar.gz + +[windows] +libpng: + echo "Unsupported on this platform" + +[linux] +[macos] +cxx: + cargo build --profile {{PROFILE}} + +[windows] +cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +lib: libpng cxx + #!/bin/bash + cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes + cd {{PROJECT_DIR}} + make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}" + +[windows] +lib: + echo "Unsupported on this platform" + +[linux] +[macos] +fuzzer: lib cxx + pwd + {{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz + +[windows] +fuzzer: + echo "Unsupported on this platform" + +[linux] +[macos] +run: fuzzer + ./{{FUZZER_NAME}} --cores 0-1 --input ./corpus + +[windows] +run: fuzzer + echo "Unsupported on this platform" + +[linux] +[macos] +test: fuzzer + #!/bin/bash + rm -rf libafl_unix_shmem_server || true + timeout 31s ./{{FUZZER_NAME}} --cores 0-1 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true + if grep -qa "corpus: 30" fuzz_stdout.log; then + echo "Fuzzer is working" + else + echo "Fuzzer does not generate any testcases or any crashes" + exit 1 + fi + +[windows] +test: fuzzer + echo "Unsupported on this platform" + +clean: + rm -rf {{FUZZER_NAME}} + make -C libpng-1.6.37 clean || true + cargo clean + diff --git a/fuzzers/inprocess/libfuzzer_libpng_centralized/Makefile.toml b/fuzzers/inprocess/libfuzzer_libpng_centralized/Makefile.toml deleted file mode 100644 index 12434f52c0..0000000000 --- a/fuzzers/inprocess/libfuzzer_libpng_centralized/Makefile.toml +++ /dev/null @@ -1,146 +0,0 @@ -# Variables -[env] -FUZZER_NAME = 'fuzzer_libpng_launcher' -CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [ - "CARGO_TARGET_DIR", -] } } -PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } } -PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [ - "PROFILE_DIR", -] } } -LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc' -LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/libafl_cxx' -FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}' -PROJECT_DIR = { script = ["pwd"] } - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this platform" -''' - -# libpng -[tasks.libpng] -linux_alias = "libpng_unix" -mac_alias = "libpng_unix" -windows_alias = "unsupported" - -[tasks.libpng_unix] -condition = { files_not_exist = ["./libpng-1.6.37"] } -script_runner = "@shell" -script = ''' -wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz -tar -xvf v1.6.37.tar.gz -''' - -# Compilers -[tasks.cxx] -linux_alias = "cxx_unix" -mac_alias = "cxx_unix" -windows_alias = "unsupported" - -[tasks.cxx_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.cc] -linux_alias = "cc_unix" -mac_alias = "cc_unix" -windows_alias = "unsupported" - -[tasks.cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -# Library -[tasks.lib] -linux_alias = "lib_unix" -mac_alias = "lib_unix" -windows_alias = "unsupported" - -[tasks.lib_unix] -script_runner = "@shell" -script = ''' -cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes -cd "${PROJECT_DIR}" -make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -''' -dependencies = ["libpng", "cxx", "cc"] - - -# Harness -[tasks.fuzzer] -linux_alias = "fuzzer_unix" -mac_alias = "fuzzer_unix" -windows_alias = "unsupported" - -[tasks.fuzzer_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = [ - "${PROJECT_DIR}/harness.cc", - "${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a", - "-I", - "${PROJECT_DIR}/libpng-1.6.37/", - "-o", - "${FUZZER_NAME}", - "-lm", - "-lz", -] -dependencies = ["lib", "cxx", "cc"] - -# Run the fuzzer -[tasks.run] -linux_alias = "run_unix" -mac_alias = "run_unix" -windows_alias = "unsupported" - -[tasks.run_unix] -script_runner = "@shell" -script = ''' -./${FUZZER_NAME} --cores 0-1 --input ./corpus -''' -dependencies = ["fuzzer"] - -# Test -[tasks.test] -linux_alias = "test_unix" -mac_alias = "test_mac" -windows_alias = "unsupported" - -[tasks.test_unix] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -timeout 31s ./${FUZZER_NAME} --cores 0-1 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true -if grep -qa "corpus: 30" fuzz_stdout.log; then - echo "Fuzzer is working" -else - echo "Fuzzer does not generate any testcases or any crashes" - exit 1 -fi -''' -dependencies = ["fuzzer"] - -[tasks.test_mac] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -timeout 31s ./${FUZZER_NAME} --cores 0 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true -''' -dependencies = ["fuzzer"] - -# Clean up -[tasks.clean] -linux_alias = "clean_unix" -mac_alias = "clean_unix" -windows_alias = "unsupported" - -[tasks.clean_unix] -# Disable default `clean` definition -clear = true -script_runner = "@shell" -script = ''' -rm -f ./${FUZZER_NAME} -make -C libpng-1.6.37 clean -cargo clean -''' diff --git a/fuzzers/inprocess/libfuzzer_libpng_cmin/Justfile b/fuzzers/inprocess/libfuzzer_libpng_cmin/Justfile new file mode 100644 index 0000000000..aab47592ba --- /dev/null +++ b/fuzzers/inprocess/libfuzzer_libpng_cmin/Justfile @@ -0,0 +1,136 @@ +FUZZER_NAME := 'fuzzer_libpng_cmin' +PROJECT_DIR := invocation_directory_native() +PROFILE := env("PROFILE", "release") +PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" } +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME +LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc" +LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx" + + +alias cc := cxx + +[linux] +[macos] +libpng: + #!/bin/bash + if [ ! -f v1.6.37.tar.gz ]; then + wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz + fi + tar -xvf v1.6.37.tar.gz + +[windows] +libpng: + echo "Unsupported on this platform" + +[linux] +[macos] +cxx: + cargo build --profile {{PROFILE}} + +[windows] +cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +crash_cxx: + cargo build --profile {{PROFILE}} --features=crash + +[windows] +crash_cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +lib: libpng cxx + #!/bin/bash + cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes + cd {{PROJECT_DIR}} + make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}" + +[windows] +lib: + echo "Unsupported on this platform" + +[linux] +[macos] +crash_lib: libpng crash_cxx + #!/bin/bash + cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes + cd {{PROJECT_DIR}} + make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}" + +[windows] +crash_lib: + echo "Unsupported on this platform" + +[linux] +[macos] +fuzzer: lib cxx + pwd + {{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz -lz3 + +[windows] +fuzzer: + echo "Unsupported on this platform" + +[linux] +[macos] +crash_fuzzer: crash_lib crash_cxx + {{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz -lz3 + +[windows] +crash_fuzzer: + echo "Unsupported on this platform" + + +[linux] +[macos] +run: fuzzer + #!/bin/bash + ./{{FUZZER_NAME}} & + sleep 0.2 + ./{{FUZZER_NAME}} 2>/dev/null + +[windows] +run: fuzzer + echo "Unsupported on this platform" + +[linux] +[macos] +crash: crash_fuzzer + #!/bin/bash + ./{{FUZZER_NAME}} & + sleep 0.2 + ./{{FUZZER_NAME}} 2>/dev/null + +[windows] +crash: fuzzer + echo "Unsupported on this platform" + + +[linux] +[macos] +test: fuzzer + #!/bin/bash + rm -rf libafl_unix_shmem_server || true + (timeout 31s ./{{FUZZER_NAME}} 2>/dev/null | tee fuzz_stdout.log|| true) & + sleep 0.2 + timeout 30s ./{{FUZZER_NAME}} >/dev/null 2>/dev/null || true + if grep -qa "corpus: 30" fuzz_stdout.log; then + echo "Fuzzer is working" + else + echo "Fuzzer does not generate any testcases or any crashes" + exit 1 + fi + +[windows] +test: fuzzer + echo "Unsupported on this platform" + +clean: + rm -rf {{FUZZER_NAME}} + make -C libpng-1.6.37 clean || true + cargo clean + diff --git a/fuzzers/inprocess/libfuzzer_libpng_cmin/Makefile.toml b/fuzzers/inprocess/libfuzzer_libpng_cmin/Makefile.toml deleted file mode 100644 index d1bf2aaec3..0000000000 --- a/fuzzers/inprocess/libfuzzer_libpng_cmin/Makefile.toml +++ /dev/null @@ -1,223 +0,0 @@ -# Variables -[env] -FUZZER_NAME = 'fuzzer_libpng' -PROJECT_DIR = { script = ["pwd"] } -CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [ - "CARGO_TARGET_DIR", -] } } -PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } } -PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [ - "PROFILE_DIR", -] } } -LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc' -LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/libafl_cxx' -FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}' - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this" -''' - -# libpng -[tasks.libpng] -linux_alias = "libpng_unix" -mac_alias = "libpng_unix" -windows_alias = "unsupported" - -[tasks.libpng_unix] -condition = { files_not_exist = ["./libpng-1.6.37"] } -script_runner = "@shell" -script = ''' -wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz -tar -xvf v1.6.37.tar.gz -''' - -# Compilers -[tasks.cxx] -linux_alias = "cxx_unix" -mac_alias = "cxx_unix" -windows_alias = "unsupported" - -[tasks.cxx_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.cc] -linux_alias = "cc_unix" -mac_alias = "cc_unix" -windows_alias = "unsupported" - -[tasks.cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.crash_cxx] -linux_alias = "crash_cxx_unix" -mac_alias = "crash_cxx_unix" -windows_alias = "unsupported" - -[tasks.crash_cxx_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}", "--features=crash"] - -[tasks.crash_cc] -linux_alias = "crash_cc_unix" -mac_alias = "crash_cc_unix" -windows_alias = "unsupported" - -[tasks.crash_cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}", "--features=crash"] - -# Library -[tasks.lib] -linux_alias = "lib_unix" -mac_alias = "lib_unix" -windows_alias = "unsupported" - -[tasks.lib_unix] -script_runner = "@shell" -script = ''' -cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes -cd "${PROJECT_DIR}" -make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -''' -dependencies = ["libpng", "cxx", "cc"] - -# Library -[tasks.crash_lib] -linux_alias = "crash_lib_unix" -mac_alias = "crash_lib_unix" -windows_alias = "unsupported" - -[tasks.crash_lib_unix] -script_runner = "@shell" -script = ''' -cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes -cd "${PROJECT_DIR}" -make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -''' -dependencies = ["libpng", "crash_cxx", "crash_cc"] - -# Harness -[tasks.fuzzer] -linux_alias = "fuzzer_unix" -mac_alias = "fuzzer_unix" -windows_alias = "unsupported" - -[tasks.fuzzer_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = [ - "${PROJECT_DIR}/harness.cc", - "${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a", - "-I", - "${PROJECT_DIR}/libpng-1.6.37/", - "-o", - "${FUZZER_NAME}", - "-lm", - "-lz", - "-lz3", -] -dependencies = ["lib", "cxx", "cc"] - -# Crashing Harness -[tasks.fuzzer_crash] -linux_alias = "fuzzer_crash_unix" -mac_alias = "fuzzer_crash_unix" -windows_alias = "unsupported" - -[tasks.fuzzer_crash_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = [ - "${PROJECT_DIR}/harness.cc", - "${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a", - "-I", - "${PROJECT_DIR}/libpng-1.6.37/", - "-o", - "${FUZZER_NAME}_crash", - "-lm", - "-lz", - "-lz3", -] -dependencies = ["crash_lib", "crash_cxx", "crash_cc"] - -# Run the fuzzer -[tasks.run] -linux_alias = "run_unix" -mac_alias = "run_unix" -windows_alias = "unsupported" - -[tasks.run_unix] -script_runner = "@shell" -script = ''' -./${FUZZER_NAME} & -sleep 0.2 -./${FUZZER_NAME} 2>/dev/null -''' -dependencies = ["fuzzer"] - - -# Run the fuzzer with a crash -[tasks.crash] -linux_alias = "crash_unix" -mac_alias = "crash_unix" -windows_alias = "unsupported" - -[tasks.crash_unix] -script_runner = "@shell" -script = ''' -./${FUZZER_NAME}_crash & -sleep 0.2 -./${FUZZER_NAME}_crash 2>/dev/null -''' -dependencies = ["fuzzer_crash"] - - -# Test -[tasks.test] -linux_alias = "test_unix" -mac_alias = "test_mac" -windows_alias = "unsupported" - -[tasks.test_unix] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -timeout 31s ./${FUZZER_NAME} | tee fuzz_stdout.log & -sleep 0.2 -timeout 30s ./${FUZZER_NAME} >/dev/null 2>/dev/null || true -if grep -qa "corpus: 30" fuzz_stdout.log; then - echo "Fuzzer is working" -else - echo "Fuzzer does not generate any testcases or any crashes" - exit 1 -fi -''' -dependencies = ["fuzzer"] - -[tasks.test_mac] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -timeout 31s ./${FUZZER_NAME} | tee fuzz_stdout.log & -sleep 0.2 -timeout 30s ./${FUZZER_NAME} >/dev/null 2>/dev/null || true -''' -dependencies = ["fuzzer"] - -# Clean up -[tasks.clean] -linux_alias = "clean_unix" -mac_alias = "clean_unix" -windows_alias = "unsupported" - -[tasks.clean_unix] -# Disable default `clean` definition -clear = true -script_runner = "@shell" -script = ''' -rm -f ./${FUZZER_NAME} -make -C libpng-1.6.37 clean -cargo clean -''' diff --git a/fuzzers/inprocess/libfuzzer_libpng_launcher/Justfile b/fuzzers/inprocess/libfuzzer_libpng_launcher/Justfile new file mode 100644 index 0000000000..399be376d1 --- /dev/null +++ b/fuzzers/inprocess/libfuzzer_libpng_launcher/Justfile @@ -0,0 +1,88 @@ +FUZZER_NAME := 'fuzzer_libpng_launcher' +PROJECT_DIR := invocation_directory_native() +PROFILE := env("PROFILE", "release") +PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" } +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME +LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc" +LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx" +LIBTOOL := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_libtool" + + +alias cc := cxx + +[linux] +[macos] +libpng: + #!/bin/bash + if [ ! -f v1.6.37.tar.gz ]; then + wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz + fi + tar -xvf v1.6.37.tar.gz + +[windows] +libpng: + echo "Unsupported on this platform" + +[linux] +[macos] +cxx: + cargo build --profile {{PROFILE}} + +[windows] +cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +lib: libpng cxx + #!/bin/bash + cd libpng-1.6.37 && CC={{LIBAFL_CC}} CXX={{LIBAFL_CXX}} ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes + cd {{PROJECT_DIR}} + make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}" LIBTOOL="{{LIBTOOL}}" + +[windows] +lib: + echo "Unsupported on this platform" + +[linux] +[macos] +fuzzer: lib cxx + pwd + {{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz + +[windows] +fuzzer: + echo "Unsupported on this platform" + +[linux] +[macos] +run: fuzzer + ./{{FUZZER_NAME}}.coverage --broker-port 21337 --cores 0 --input ./corpus + +[windows] +run: fuzzer + echo "Unsupported on this platform" + +[linux] +[macos] +test: fuzzer + #!/bin/bash + rm -rf libafl_unix_shmem_server || true + timeout 31s ./{{FUZZER_NAME}}.coverage --broker-port 21337 --cores 0 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true + if grep -qa "corpus: 30" fuzz_stdout.log; then + echo "Fuzzer is working" + else + echo "Fuzzer does not generate any testcases or any crashes" + exit 1 + fi + +[windows] +test: fuzzer + echo "Unsupported on this platform" + +clean: + rm -rf {{FUZZER_NAME}} + make -C libpng-1.6.37 clean || true + cargo clean + diff --git a/fuzzers/inprocess/libfuzzer_libpng_launcher/Makefile.toml b/fuzzers/inprocess/libfuzzer_libpng_launcher/Makefile.toml deleted file mode 100644 index 3dc75f27f3..0000000000 --- a/fuzzers/inprocess/libfuzzer_libpng_launcher/Makefile.toml +++ /dev/null @@ -1,147 +0,0 @@ -# Variables -[env] -FUZZER_NAME = 'fuzzer_libpng_launcher' -CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [ - "CARGO_TARGET_DIR", -] } } -PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } } -PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [ - "PROFILE_DIR", -] } } -LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc' -LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/libafl_cxx' -LIBAFL_LIBTOOL = '${CARGO_TARGET_DIR}/${PROFILE}/libafl_libtool' -FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}' -PROJECT_DIR = { script = ["pwd"] } - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this platform" -''' - -# libpng -[tasks.libpng] -linux_alias = "libpng_unix" -mac_alias = "libpng_unix" -windows_alias = "unsupported" - -[tasks.libpng_unix] -condition = { files_not_exist = ["./libpng-1.6.37"] } -script_runner = "@shell" -script = ''' -wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz -tar -xvf v1.6.37.tar.gz -''' - -# Compilers -[tasks.cxx] -linux_alias = "cxx_unix" -mac_alias = "cxx_unix" -windows_alias = "unsupported" - -[tasks.cxx_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.cc] -linux_alias = "cc_unix" -mac_alias = "cc_unix" -windows_alias = "unsupported" - -[tasks.cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -# Library -[tasks.lib] -linux_alias = "lib_unix" -mac_alias = "lib_unix" -windows_alias = "unsupported" - -[tasks.lib_unix] -script_runner = "@shell" -script = ''' -cd libpng-1.6.37 && CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes -cd "${PROJECT_DIR}" -make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" LIBTOOL=${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_libtool -''' -dependencies = ["libpng", "cxx", "cc"] - - -# Harness -[tasks.fuzzer] -linux_alias = "fuzzer_unix" -mac_alias = "fuzzer_unix" -windows_alias = "unsupported" - -[tasks.fuzzer_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = [ - "${PROJECT_DIR}/harness.cc", - "${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a", - "-I", - "${PROJECT_DIR}/libpng-1.6.37/", - "-o", - "${FUZZER_NAME}", - "-lm", - "-lz", -] -dependencies = ["lib", "cxx", "cc"] - -# Run the fuzzer -[tasks.run] -linux_alias = "run_unix" -mac_alias = "run_unix" -windows_alias = "unsupported" - -[tasks.run_unix] -script_runner = "@shell" -script = ''' -./${FUZZER_NAME}.coverage --broker-port 21337 --cores 0 --input ./corpus -''' -dependencies = ["fuzzer"] - -# Test -[tasks.test] -linux_alias = "test_unix" -mac_alias = "test_mac" -windows_alias = "unsupported" - -[tasks.test_unix] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -timeout 31s ./${FUZZER_NAME}.coverage --broker-port 21337 --cores 0 --input ./corpus | tee fuzz_stdout.log || true -if grep -qa "corpus: 30" fuzz_stdout.log; then - echo "Fuzzer is working" -else - echo "Fuzzer does not generate any testcases or any crashes" - exit 1 -fi -''' -dependencies = ["fuzzer"] - -[tasks.test_mac] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -timeout 31s ./${FUZZER_NAME} --cores 0 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true -''' -dependencies = ["fuzzer"] - -# Clean up -[tasks.clean] -linux_alias = "clean_unix" -mac_alias = "clean_unix" -windows_alias = "unsupported" - -[tasks.clean_unix] -# Disable default `clean` definition -clear = true -script_runner = "@shell" -script = ''' -rm -f ./${FUZZER_NAME} -make -C libpng-1.6.37 clean -cargo clean -''' diff --git a/fuzzers/inprocess/libfuzzer_libpng_norestart/Justfile b/fuzzers/inprocess/libfuzzer_libpng_norestart/Justfile new file mode 100644 index 0000000000..fa9268baae --- /dev/null +++ b/fuzzers/inprocess/libfuzzer_libpng_norestart/Justfile @@ -0,0 +1,136 @@ +FUZZER_NAME := 'fuzzer_libpng_norestart' +PROJECT_DIR := invocation_directory_native() +PROFILE := env("PROFILE", "release") +PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" } +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME +LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc" +LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx" + + +alias cc := cxx + +[linux] +[macos] +libpng: + #!/bin/bash + if [ ! -f v1.6.37.tar.gz ]; then + wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz + fi + tar -xvf v1.6.37.tar.gz + +[windows] +libpng: + echo "Unsupported on this platform" + +[linux] +[macos] +cxx: + cargo build --profile {{PROFILE}} + +[windows] +cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +crash_cxx: + cargo build --profile {{PROFILE}} --features=crash + +[windows] +crash_cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +lib: libpng cxx + #!/bin/bash + cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes + cd {{PROJECT_DIR}} + make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}" + +[windows] +lib: + echo "Unsupported on this platform" + +[linux] +[macos] +crash_lib: libpng crash_cxx + #!/bin/bash + cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes + cd {{PROJECT_DIR}} + make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}" + +[windows] +crash_lib: + echo "Unsupported on this platform" + +[linux] +[macos] +fuzzer: lib cxx + pwd + {{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz + +[windows] +fuzzer: + echo "Unsupported on this platform" + +[linux] +[macos] +crash_fuzzer: crash_lib crash_cxx + {{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz + +[windows] +crash_fuzzer: + echo "Unsupported on this platform" + + +[linux] +[macos] +run: fuzzer + #!/bin/bash + ./{{FUZZER_NAME}} & + sleep 0.2 + ./{{FUZZER_NAME}} 2>/dev/null + +[windows] +run: fuzzer + echo "Unsupported on this platform" + +[linux] +[macos] +crash: crash_fuzzer + #!/bin/bash + ./{{FUZZER_NAME}} & + sleep 0.2 + ./{{FUZZER_NAME}} 2>/dev/null + +[windows] +crash: fuzzer + echo "Unsupported on this platform" + + +[linux] +[macos] +test: fuzzer + #!/bin/bash + rm -rf libafl_unix_shmem_server || true + (timeout 31s ./{{FUZZER_NAME}} 2>/dev/null | tee fuzz_stdout.log || true) & + sleep 0.2 + timeout 30s ./{{FUZZER_NAME}} >/dev/null 2>/dev/null || true + if grep -qa "corpus: 30" fuzz_stdout.log; then + echo "Fuzzer is working" + else + echo "Fuzzer does not generate any testcases or any crashes" + exit 1 + fi + +[windows] +test: fuzzer + echo "Unsupported on this platform" + +clean: + rm -rf {{FUZZER_NAME}} + make -C libpng-1.6.37 clean || true + cargo clean + diff --git a/fuzzers/inprocess/libfuzzer_libpng_norestart/Makefile.toml b/fuzzers/inprocess/libfuzzer_libpng_norestart/Makefile.toml deleted file mode 100644 index 5769da2f63..0000000000 --- a/fuzzers/inprocess/libfuzzer_libpng_norestart/Makefile.toml +++ /dev/null @@ -1,135 +0,0 @@ -# Variables -[env] -FUZZER_NAME = 'fuzzer_libpng_launcher' -CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [ - "CARGO_TARGET_DIR", -] } } -PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } } -PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [ - "PROFILE_DIR", -] } } -LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc' -LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/libafl_cxx' -FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}' -PROJECT_DIR = { script = ["pwd"] } - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this platform" -''' - -# libpng -[tasks.libpng] -linux_alias = "libpng_unix" -mac_alias = "libpng_unix" -windows_alias = "unsupported" - -[tasks.libpng_unix] -condition = { files_not_exist = ["./libpng-1.6.37"] } -script_runner = "@shell" -script = ''' -wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz -tar -xvf v1.6.37.tar.gz -''' - -[tasks.cc] -linux_alias = "cc_unix" -mac_alias = "cc_unix" -windows_alias = "unsupported" - -[tasks.cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -# Library -[tasks.lib] -linux_alias = "lib_unix" -mac_alias = "lib_unix" -windows_alias = "unsupported" - -[tasks.lib_unix] -script_runner = "@shell" -script = ''' -cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes -cd "${PROJECT_DIR}" -make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -''' -dependencies = ["libpng", "cc"] - - -# Harness -[tasks.fuzzer] -linux_alias = "fuzzer_unix" -mac_alias = "fuzzer_unix" -windows_alias = "unsupported" - -[tasks.fuzzer_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = [ - "${PROJECT_DIR}/harness.cc", - "${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a", - "-I", - "${PROJECT_DIR}/libpng-1.6.37/", - "-o", - "${FUZZER_NAME}", - "-lm", - "-lz", -] -dependencies = ["lib", "cc"] - -# Run the fuzzer -[tasks.run] -linux_alias = "run_unix" -mac_alias = "run_unix" -windows_alias = "unsupported" - -[tasks.run_unix] -script_runner = "@shell" -script = ''' -rm -rf corpus/ || true -mkdir corpus/ || true -cp seeds/* corpus/ || true -./${FUZZER_NAME} --cores 0 --input ./corpus -''' -dependencies = ["fuzzer"] - -# Test -[tasks.test] -linux_alias = "test_unix" -mac_alias = "test_unix" -windows_alias = "unsupported" - -[tasks.test_unix] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -rm -rf corpus/ || true -mkdir corpus/ || true -cp seeds/* corpus/ || true -timeout 31s ./${FUZZER_NAME} --cores 0 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true -if grep -qa "corpus: 30" fuzz_stdout.log; then - echo "Fuzzer is working" -else - echo "Fuzzer does not generate any testcases or any crashes" - exit 1 -fi -''' -dependencies = ["fuzzer"] - -# Clean up -[tasks.clean] -linux_alias = "clean_unix" -mac_alias = "clean_unix" -windows_alias = "unsupported" - -[tasks.clean_unix] -# Disable default `clean` definition -clear = true -script_runner = "@shell" -script = ''' -rm -rf corpus/ || true -rm -f ./${FUZZER_NAME} -make -C libpng-1.6.37 clean -cargo clean -''' diff --git a/fuzzers/inprocess/libfuzzer_libpng_tcp_manager/Justfile b/fuzzers/inprocess/libfuzzer_libpng_tcp_manager/Justfile new file mode 100644 index 0000000000..52f68396d9 --- /dev/null +++ b/fuzzers/inprocess/libfuzzer_libpng_tcp_manager/Justfile @@ -0,0 +1,87 @@ +FUZZER_NAME := 'fuzzer_libpng_tcp_manager' +PROJECT_DIR := invocation_directory_native() +PROFILE := env("PROFILE", "release") +PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" } +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME +LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc" +LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx" + + +alias cc := cxx + +[linux] +[macos] +libpng: + #!/bin/bash + if [ ! -f v1.6.37.tar.gz ]; then + wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz + fi + tar -xvf v1.6.37.tar.gz + +[windows] +libpng: + echo "Unsupported on this platform" + +[linux] +[macos] +cxx: + cargo build --profile {{PROFILE}} + +[windows] +cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +lib: libpng cxx + #!/bin/bash + cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes + cd {{PROJECT_DIR}} + make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}" + +[windows] +lib: + echo "Unsupported on this platform" + +[linux] +[macos] +fuzzer: lib cxx + pwd + {{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz + +[windows] +fuzzer: + echo "Unsupported on this platform" + +[linux] +[macos] +run: fuzzer + ./{{FUZZER_NAME}} --cores 0-1 --input ./corpus + +[windows] +run: fuzzer + echo "Unsupported on this platform" + +[linux] +[macos] +test: fuzzer + #!/bin/bash + rm -rf libafl_unix_shmem_server || true + timeout 31s ./{{FUZZER_NAME}} --cores 0-1 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true + if grep -qa "corpus: 30" fuzz_stdout.log; then + echo "Fuzzer is working" + else + echo "Fuzzer does not generate any testcases or any crashes" + exit 1 + fi + +[windows] +test: fuzzer + echo "Unsupported on this platform" + +clean: + rm -rf {{FUZZER_NAME}} + make -C libpng-1.6.37 clean || true + cargo clean + diff --git a/fuzzers/inprocess/libfuzzer_libpng_tcp_manager/Makefile.toml b/fuzzers/inprocess/libfuzzer_libpng_tcp_manager/Makefile.toml deleted file mode 100644 index 7b0c8d0213..0000000000 --- a/fuzzers/inprocess/libfuzzer_libpng_tcp_manager/Makefile.toml +++ /dev/null @@ -1,221 +0,0 @@ -# Variables -[env] -FUZZER_NAME = 'fuzzer_libpng' -PROJECT_DIR = { script = ["pwd"] } -CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [ - "CARGO_TARGET_DIR", -] } } -PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } } -PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [ - "PROFILE_DIR", -] } } -LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc' -LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/libafl_cxx' -FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}' - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this" -''' - -# libpng -[tasks.libpng] -linux_alias = "libpng_unix" -mac_alias = "libpng_unix" -windows_alias = "unsupported" - -[tasks.libpng_unix] -condition = { files_not_exist = ["./libpng-1.6.37"] } -script_runner = "@shell" -script = ''' -wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz -tar -xvf v1.6.37.tar.gz -''' - -# Compilers -[tasks.cxx] -linux_alias = "cxx_unix" -mac_alias = "cxx_unix" -windows_alias = "unsupported" - -[tasks.cxx_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.cc] -linux_alias = "cc_unix" -mac_alias = "cc_unix" -windows_alias = "unsupported" - -[tasks.cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.crash_cxx] -linux_alias = "crash_cxx_unix" -mac_alias = "crash_cxx_unix" -windows_alias = "unsupported" - -[tasks.crash_cxx_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}", "--features=crash"] - -[tasks.crash_cc] -linux_alias = "crash_cc_unix" -mac_alias = "crash_cc_unix" -windows_alias = "unsupported" - -[tasks.crash_cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}", "--features=crash"] - -# Library -[tasks.lib] -linux_alias = "lib_unix" -mac_alias = "lib_unix" -windows_alias = "unsupported" - -[tasks.lib_unix] -script_runner = "@shell" -script = ''' -cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes -cd "${PROJECT_DIR}" -make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -''' -dependencies = ["libpng", "cxx", "cc"] - -# Library -[tasks.crash_lib] -linux_alias = "crash_lib_unix" -mac_alias = "crash_lib_unix" -windows_alias = "unsupported" - -[tasks.crash_lib_unix] -script_runner = "@shell" -script = ''' -cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes -cd "${PROJECT_DIR}" -make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -''' -dependencies = ["libpng", "crash_cxx", "crash_cc"] - -# Harness -[tasks.fuzzer] -linux_alias = "fuzzer_unix" -mac_alias = "fuzzer_unix" -windows_alias = "unsupported" - -[tasks.fuzzer_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = [ - "${PROJECT_DIR}/harness.cc", - "${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a", - "-I", - "${PROJECT_DIR}/libpng-1.6.37/", - "-o", - "${FUZZER_NAME}", - "-lm", - "-lz", -] -dependencies = ["lib", "cxx", "cc"] - -# Crashing Harness -[tasks.fuzzer_crash] -linux_alias = "fuzzer_crash_unix" -mac_alias = "fuzzer_crash_unix" -windows_alias = "unsupported" - -[tasks.fuzzer_crash_unix] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = [ - "${PROJECT_DIR}/harness.cc", - "${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a", - "-I", - "${PROJECT_DIR}/libpng-1.6.37/", - "-o", - "${FUZZER_NAME}_crash", - "-lm", - "-lz", -] -dependencies = ["crash_lib", "crash_cxx", "crash_cc"] - -# Run the fuzzer -[tasks.run] -linux_alias = "run_unix" -mac_alias = "run_unix" -windows_alias = "unsupported" - -[tasks.run_unix] -script_runner = "@shell" -script = ''' -./${FUZZER_NAME} & -sleep 0.2 -./${FUZZER_NAME} 2>/dev/null -''' -dependencies = ["fuzzer"] - - -# Run the fuzzer with a crash -[tasks.crash] -linux_alias = "crash_unix" -mac_alias = "crash_unix" -windows_alias = "unsupported" - -[tasks.crash_unix] -script_runner = "@shell" -script = ''' -./${FUZZER_NAME}_crash & -sleep 0.2 -./${FUZZER_NAME}_crash 2>/dev/null -''' -dependencies = ["fuzzer_crash"] - - -# Test -[tasks.test] -linux_alias = "test_unix" -mac_alias = "test_mac" -windows_alias = "unsupported" - -[tasks.test_unix] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -(timeout 31s ./${FUZZER_NAME} | tee fuzz_stdout.log 2>/dev/null || true) & -sleep 0.2 -timeout 30s ./${FUZZER_NAME} >/dev/null 2>/dev/null || true -if grep -qa "corpus: 30" fuzz_stdout.log; then - echo "Fuzzer is working" -else - echo "Fuzzer does not generate any testcases or any crashes" - exit 1 -fi -''' -dependencies = ["fuzzer"] - -[tasks.test_mac] -script_runner = "@shell" -script = ''' -rm -rf libafl_unix_shmem_server || true -(timeout 31s ./${FUZZER_NAME} | tee fuzz_stdout.log 2>/dev/null || true) & -sleep 0.2 -timeout 30s ./${FUZZER_NAME} >/dev/null 2>/dev/null || true -''' -dependencies = ["fuzzer"] - -# Clean up -[tasks.clean] -linux_alias = "clean_unix" -mac_alias = "clean_unix" -windows_alias = "unsupported" - -[tasks.clean_unix] -# Disable default `clean` definition -clear = true -script_runner = "@shell" -script = ''' -rm -f ./${FUZZER_NAME} -make -C libpng-1.6.37 clean -cargo clean -''' diff --git a/fuzzers/inprocess/libfuzzer_windows_asan/Justfile b/fuzzers/inprocess/libfuzzer_windows_asan/Justfile new file mode 100644 index 0000000000..2334c2fcfb --- /dev/null +++ b/fuzzers/inprocess/libfuzzer_windows_asan/Justfile @@ -0,0 +1,57 @@ +FUZZER_NAME := 'libfuzzer_windows_asan' +PROJECT_DIR := invocation_directory_native() +PROFILE := env("PROFILE", "release") +PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" } +CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target") +LIBAFL_CXX := CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx" + +set shell := ["cmd.exe", "/c"] + +alias cc := cxx + +[windows] +cxx: + cargo build --profile {{PROFILE}} + +[linux] +[macos] +cxx: + echo "Unsupported on this platform" + +[linux] +[macos] +cxx: + cargo build --profile {{PROFILE}} + +[windows] +fuzzer: cxx + .\target\{{PROFILE}}\libafl_cxx .\harness.cpp -o {{FUZZER_NAME}}.exe + +[linux] +[macos] +fuzzer: + echo "Unsupported on this platform" + + +[windows] +test: fuzzer + start {{FUZZER_NAME}}.exe + start {{FUZZER_NAME}}.exe + ping -n 10 127.0.0.1>NUL && taskkill /im {{FUZZER_NAME}}.exe /F + dir /a-d crashes && (echo Files exist) || (exit /b 1337) + +[linux] +[macos] +test: + echo "Unsupported on this platform" + + +[windows] +clean: + del ./{{FUZZER_NAME}} + cargo clean + +[linux] +[macos] +clean: + echo "Unsupported on this platform" \ No newline at end of file diff --git a/fuzzers/inprocess/libfuzzer_windows_asan/Makefile.toml b/fuzzers/inprocess/libfuzzer_windows_asan/Makefile.toml deleted file mode 100644 index 1c330a0bd2..0000000000 --- a/fuzzers/inprocess/libfuzzer_windows_asan/Makefile.toml +++ /dev/null @@ -1,109 +0,0 @@ -# Variables -[env] -FUZZER_NAME = 'libfuzzer_windows_asan' -CARGO_TARGET_DIR = { value = "./target", condition = { env_not_set = [ - "CARGO_TARGET_DIR", -] } } -PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } } -PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [ - "PROFILE_DIR", -] } } - -[tasks.unsupported] -script_runner = "@shell" -script = ''' -echo "Cargo-make not integrated yet on this" -''' - -# Compilers -[tasks.cxx] -linux_alias = "unsupported" -mac_alias = "unsupported" -windows_alias = "cxx_unix" - -[tasks.cxx_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.cc] -linux_alias = "cc_unix" -mac_alias = "cc_unix" -windows_alias = "cc_unix" - -[tasks.cc_unix] -command = "cargo" -args = ["build", "--profile", "${PROFILE}"] - -[tasks.crash_cxx] -linux_alias = "unsupported" -mac_alias = "unsupported" -windows_alias = "unsupported" - -[tasks.crash_cc] -linux_alias = "unsupported" -mac_alias = "unsupported" -windows_alias = "unsupported" - -# Library -[tasks.lib] -linux_alias = "unsupported" -mac_alias = "unsupported" -windows_alias = "lib_unix" - -[tasks.lib_unix] -dependencies = ["cxx", "cc"] - -# Harness -[tasks.fuzzer] -linux_alias = "unsupported" -mac_alias = "unsupported" -windows_alias = "fuzzer_windows" - -[tasks.fuzzer_windows] -command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" -args = ["./harness.cpp", "-o", "${FUZZER_NAME}.exe"] -dependencies = ["lib", "cxx", "cc"] - -# Run the fuzzer -[tasks.run] -linux_alias = "unsupported" -mac_alias = "unsupported" -windows_alias = "run_windows" # TODO - -[tasks.run_windows] -script_runner = "@shell" -script = ''' -''' -dependencies = ["fuzzer"] - -# Test -[tasks.test] -linux_alias = "unsupported" -mac_alias = "unsupported" -windows_alias = "test_windows" # TODO - -[tasks.test_windows] -script_runner = "@shell" -script = ''' -start "" "${FUZZER_NAME}.exe" -start "" "${FUZZER_NAME}.exe" -#ping is for timeout -ping -n 10 127.0.0.1>NUL && taskkill /im ${FUZZER_NAME}.exe /F ->nul 2>nul dir /a-d "crashes\*" && (echo Files exist) || (exit /b 1337) -''' -dependencies = ["fuzzer"] - -# Clean up -[tasks.clean] -linux_alias = "unsupported" -mac_alias = "unsupported" -windows_alias = "clean_windows" - -[tasks.clean_windows] -# Disable default `clean` definition -clear = true -script_runner = "@shell" -script = ''' -del ./${FUZZER_NAME} -cargo clean -''' diff --git a/scripts/test_fuzzer.sh b/scripts/test_fuzzer.sh index f76b2da8cc..c0ae4a78a3 100755 --- a/scripts/test_fuzzer.sh +++ b/scripts/test_fuzzer.sh @@ -64,6 +64,10 @@ do echo "[*] Testing $fuzzer" cargo make test || exit 1 echo "[+] Done testing $fuzzer" + elif [ -e ./Justfile ]; then + echo "[*] Testing $fuzzer" + just test || exit 1 + echo "[+] Done testing $fuzzer" else echo "[*] Building $fuzzer" cargo build || exit 1