Skip to content

Commit 2ab78a8

Browse files
committed
Use aflplusplus not cargo-afl
1 parent f4cc3c1 commit 2ab78a8

File tree

3 files changed

+20
-36
lines changed

3 files changed

+20
-36
lines changed

flake.nix

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,27 @@
177177
cargo-watch
178178
rust-analyzer
179179
dart
180+
cargo-fuzz
181+
cargo-honggfuzz
182+
aflplusplus
183+
lldb
184+
clang
180185
]
181186
++ pkgs.lib.optionals (!pkgs.stdenv.isDarwin) [
182187
cargo-llvm-cov
183188
];
189+
190+
buildInputs = with pkgs; [
191+
libbfd_2_38
192+
libunwind.dev
193+
libopcodes_2_38
194+
pkgsStatic.libblocksruntime
195+
];
196+
197+
shellHook = ''
198+
export UNSCREW_WERROR_ORIG=$(which clang)
199+
export PATH="$(pwd)/scripts/dev/unscrew-werror/:$PATH"
200+
'';
184201
}
185202
) craneLibVersions;
186203

@@ -210,35 +227,6 @@
210227
};
211228
devShells = devShells // {
212229
default = devShells.nightly;
213-
214-
fuzz = pkgs.mkShell {
215-
nativeBuildInputs =
216-
with pkgs;
217-
[
218-
cargo-edit
219-
cargo-nextest
220-
cargo-watch
221-
rust-analyzer
222-
dart
223-
cargo-honggfuzz
224-
lldb
225-
clang
226-
]
227-
++ pkgs.lib.optionals (!pkgs.stdenv.isDarwin) [ cargo-llvm-cov ];
228-
229-
buildInputs = with pkgs; [
230-
libbfd_2_38
231-
libunwind.dev
232-
libopcodes_2_38
233-
pkgsStatic.libblocksruntime
234-
];
235-
236-
shellHook = ''
237-
export UNSCREW_WERROR_ORIG=$(which clang)
238-
export PATH="$(pwd)/scripts/dev/unscrew-werror/:$PATH"
239-
'';
240-
};
241-
242230
};
243231
formatter = treefmtEval.config.build.wrapper;
244232
checks =

fuzz/cycle.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ elif [[ $ENGINE == "afl" ]]; then
4343
for targetFile in $(listTargetFiles); do
4444
targetName=$(targetFileToName "$targetFile")
4545
echo "Fuzzing target $targetName ($targetFile)"
46-
cargo afl config --build --force
47-
cargo afl build --bin "$targetName" --features afl_fuzz
4846
# fuzz for one hour
49-
cargo afl fuzz -i corpus -o afl_target -V 30 target/debug/"$targetName" --features afl_fuzz
47+
afl-fuzz -i corpus/"$targetName"/ -o afl_target -V 3600 target/debug/"$targetName" --features afl_fuzz
5048
# minimize the corpus
5149
find afl_target/default/crashes -type f -name 'id:*' | while read -r CRASH; do
5250
BASE=$(basename "$CRASH")
@@ -55,7 +53,7 @@ elif [[ $ENGINE == "afl" ]]; then
5553
# skip if already minimized
5654
[ -f "$MIN_FILE" ] && continue
5755

58-
cargo afl tmin \
56+
afl-tmin \
5957
-i "$CRASH" \
6058
-o "$MIN_FILE" \
6159
-- target/debug/"$targetName" --features afl_fuzz

fuzz/fuzz.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ elif [[ $ENGINE == "afl" ]]; then
5252
for targetFile in $targetFiles; do
5353
targetName=$(targetFileToName "$targetFile")
5454
echo "Fuzzing target $targetName ($targetFile)"
55-
cargo afl config --build --force
56-
cargo afl build --bin "$targetName" --features afl_fuzz
57-
cargo afl fuzz -i corpus -o afl_target -V 30 target/debug/"$targetName" --features afl_fuzz
55+
afl-fuzz -i corpus/"$targetName"/ -o afl_target -V 30 target/debug/"$targetName" --features afl_fuzz
5856
done
5957
else
6058
for targetFile in $targetFiles; do

0 commit comments

Comments
 (0)