-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fuzzing): updating the precomputed corpus and adding scripts to …
…kickstart fuzzing with afl
- Loading branch information
Showing
26 changed files
with
141 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Operator needs two arguments, but was called with only one | ||
Operator needs two arguments, but was called with 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(((begin))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
($ partial (func ...defar0s) { | ||
($ b000 (s00000-000 a (- (a000000t func) (len defar0s)))) | ||
}) | ||
|
||
(let t0000 (fun (a b c) (* a b c))) | ||
(let t000000000 (partial e000 0)) | ||
(t000_00000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
($ last (...a00s) (p0000 a00s "0000" (@ a00s -9))) | ||
(last 1 5 6 7 8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(()) | ||
(fun(a b)(if 0 2 3)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(let ba0 (fun (a b) ())) | ||
(ba0 0 0nil?) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
((+)) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(let a[]) | ||
(pop! a 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(mut d [0 5 6]) | ||
(concat! d d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(((begin))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
($ partial (func ...defargs) { | ||
($ bloc (suffix-dup a (- (argcount func) (len defargs)))) | ||
}) | ||
|
||
(let test_func (fun (a b c) (* a b c))) | ||
(let test_func1 (partial test_func 1)) | ||
(test_func1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
($ last (...args) (print args " => " (@ args -9))) | ||
(last 1 5 6 7 8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(()) | ||
(fun (a b) (if 1 2 3)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(let ba0 (fun (a b) ())) | ||
(ba0 0 0 nil?) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
((+)) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(let a []) | ||
(pop! a 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(mut d [4 5 6]) | ||
(concat! d d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
if ! [ -f /.dockerenv ]; then | ||
echo "This script needs to run inside the aflplusplus docker container" | ||
exit 1 | ||
fi | ||
if [[ $(ls -l | grep tests) == "" ]]; then | ||
echo "This script needs to run at the root of ArkScript-lang/Ark" | ||
exit 1 | ||
fi | ||
|
||
if [[ $# != 1 ]]; then | ||
echo "Usage: fuzz.sh [campaign id]" | ||
echo " 0: main" | ||
echo " 1: old queue cycling" | ||
echo " 2: mOPT" | ||
echo " 3: exploit" | ||
echo " 4: explore" | ||
|
||
exit 1 | ||
fi | ||
|
||
export AFL_IMPORT_FIRST=1 | ||
export AFL_USE_ASAN=1 | ||
export AFL_USE_UBSAN=1 | ||
|
||
export FUZZER_SEED=0 | ||
export FUZZER_TIMEOUT_EXEC_MS=500 | ||
export BUILD_FOLDER=build | ||
|
||
# 50-70% of the time | ||
# export AFL_DISABLE_TRIM=1 | ||
|
||
DEFAULT_ARGS="-i tests/fuzzing/corpus-cmin-tmin -o output -a ascii -s $FUZZER_SEED -t $FUZZER_TIMEOUT_EXEC_MS -- ${BUILD_FOLDER}/arkscript @@ -L /src/lib" | ||
|
||
case $1 in | ||
0) | ||
afl-fuzz -M main $DEFAULT_ARGS | ||
;; | ||
1) | ||
afl-fuzz -S oldqueuecycling -Z $DEFAULT_ARGS | ||
;; | ||
2) | ||
afl-fuzz -S mopt -L 0 $DEFAULT_ARGS | ||
;; | ||
3) | ||
afl-fuzz -S exploit -P exploit $DEFAULT_ARGS | ||
;; | ||
4) | ||
afl-fuzz -S explore -P explore $DEFAULT_ARGS | ||
;; | ||
*) | ||
echo "Unknown campaign $1" | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
if [[ $(ls -l | grep tests) == "" ]]; then | ||
echo "This script needs to run at the root of ArkScript-lang/Ark" | ||
exit 1 | ||
fi | ||
|
||
# we need a ton of ramdisks, one per fuzzer, to avoid killing the | ||
# disk with millions of writes when cmin/tmin/fuzz are running | ||
docker run -it --rm --name afldocker \ | ||
--mount type=tmpfs,destination=/ramdisk \ | ||
--mount type=tmpfs,destination=/ramdisk2 \ | ||
--mount type=tmpfs,destination=/ramdisk3 \ | ||
--mount type=tmpfs,destination=/ramdisk4 \ | ||
-e AFL_TMPDIR=/ramdisk \ | ||
-v $(pwd):/src \ | ||
aflplusplus/aflplusplus:v4.20c |