Skip to content

Commit

Permalink
Merge branch 'master' into wasm-fuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
olapiv authored Aug 28, 2020
2 parents 6ccd3bc + 49f794f commit 08dc80b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
[submodule "llvm"]
path = llvm
url = https://github.com/Jacarte/llvm-project
branch = master
branch = master
3 changes: 3 additions & 0 deletions wasm-fuzzer/.env
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ LOCAL_WASM_DIR=/tmp/wasm

SWAM_SOCKET_HOST=localhost
SWAM_SOCKET_PORT=9999

# Filter out WASI
WASI_FILTER=True
4 changes: 3 additions & 1 deletion wasm-fuzzer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ Right now, we support fuzzing of four data types as function parameter:
* int32
* int64
* float32
* float 64
* float64

Reference documentation in (see part 1, Coverage Measurements): https://github.com/google/AFL/blob/master/docs/technical_details.txt

## Parsing AFL's fuzzed inputs

Expand Down
29 changes: 29 additions & 0 deletions wasm-fuzzer/fuzzing-server-entry/entrypoint_mill_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Get wasm/wat from $DOCKER_WASM directory
WASM_OR_WAT_FILE=${DOCKER_WASM}/${WASM_EXECUTABLE}
echo "WASM_OR_WAT_FILE: $WASM_OR_WAT_FILE"

# Parse WASM_ARG_TYPES_LIST: "Int64,Int32" to "--argType Int64 --argType Int32"
ALL_ARG_TYPES=""
IFS=',' read -r -a array <<< "$WASM_ARG_TYPES_LIST"
for element in "${array[@]}"
do
ALL_ARG_TYPES="$ALL_ARG_TYPES --argType $element"
done
echo "ALL_ARG_TYPES: $ALL_ARG_TYPES"

if [[ $WASM_OR_WAT_FILE == *.wat ]]; then WAT_ARG="--wat"; fi
if [[ $WASI == "True" ]]; then WASI_ARG="--wasi"; fi
if [[ $WASI_FILTER == "True" ]]; then WASI_ARG="$WASI_ARG -r"; fi

cd $DOCKER_SWAM_SRC

# This also compiles the cli package in case source code / dependencies have changed:

if [ ! -f cli-0.6.0-RC3.jar ]; then
echo "No SWAM jar file !!. Exiting..."
exit 1
fi
echo "java -jar cli-0.6.0-RC3.jar run_server $WAT_ARG $WASI_ARG $ALL_ARG_TYPES --main $TARGET_FUNCTION $WASM_OR_WAT_FILE" # Avoiding WASI
exec java -jar cli-0.6.0-RC3.jar run_server $WAT_ARG $WASI_ARG $ALL_ARG_TYPES --main $TARGET_FUNCTION $WASM_OR_WAT_FILE

0 comments on commit 08dc80b

Please sign in to comment.