diff options
author | Federico Maggi <federico.maggi@gmail.com> | 2021-10-11 19:20:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-11 13:20:15 -0400 |
commit | 0c5679cd24e5e6130a8b8a2501a47e69edd09082 (patch) | |
tree | 7dae5c1ca6dda20079dd6a56a914c85f921c37ad | |
parent | 7bda69cbeb3c58d117e2e13b06da16606870303e (diff) | |
download | oss-fuzz-0c5679cd24e5e6130a8b8a2501a47e69edd09082.tar.gz |
Run multiple jobs/workers by setting env vars (#5924)
* Run multiple jobs/workers by setting env vars
```bash
$ infra/base-images/all.sh
$ python3 infra/helper.py run_fuzzer -e N_JOBS=4 -e N_WORKERS=4 --engine $ENGINE $PROJECT_NAME $FUZZ_TARGET
```
* Switched from N_JOBS/WORKERS to FUZZER_EXTRA_ARGS
* Added hashicorp/hcl/hclsyntax fuzzers
* Getting rid of FUZZER_EXTRA_ARGS
-rwxr-xr-x | infra/base-images/base-runner/run_fuzzer | 4 | ||||
-rw-r--r-- | projects/hcl/Dockerfile | 20 | ||||
-rw-r--r-- | projects/hcl/build.sh | 36 | ||||
-rw-r--r-- | projects/hcl/project.yaml | 10 |
4 files changed, 68 insertions, 2 deletions
diff --git a/infra/base-images/base-runner/run_fuzzer b/infra/base-images/base-runner/run_fuzzer index cda877cf1..426688ea3 100755 --- a/infra/base-images/base-runner/run_fuzzer +++ b/infra/base-images/base-runner/run_fuzzer @@ -120,7 +120,7 @@ if [[ "$FUZZING_ENGINE" = afl ]]; then test -e "$OUT/afl++.dict" && AFL_FUZZER_ARGS="$AFL_FUZZER_ARGS -x $OUT/afl++.dict" # Ensure timeout is a bit larger than 1sec as some of the OSS-Fuzz fuzzers # are slower than this. - AFL_FUZZER_ARGS="$AFL_FUZZER_ARGS -t 5000+" + AFL_FUZZER_ARGS="$FUZZER_ARGS $AFL_FUZZER_ARGS -t 5000+" # AFL expects at least 1 file in the input dir. echo input > ${CORPUS_DIR}/input echo afl++ setup: @@ -140,7 +140,7 @@ elif [[ "$FUZZING_ENGINE" = honggfuzz ]]; then # -P: use persistent mode of fuzzing (i.e. LLVMFuzzerTestOneInput) # -f: location of the initial (and destination) file corpus # -n: number of fuzzing threads (and processes) - CMD_LINE="$OUT/honggfuzz -n 1 --exit_upon_crash -R /tmp/${FUZZER}_honggfuzz.report -W $FUZZER_OUT -v -z -P -f \"$CORPUS_DIR\" $(get_dictionary) $* -- \"$OUT/$FUZZER\"" + CMD_LINE="$OUT/honggfuzz -n 1 --exit_upon_crash -R /tmp/${FUZZER}_honggfuzz.report -W $FUZZER_OUT -v -z -P -f \"$CORPUS_DIR\" $(get_dictionary) $FUZZER_ARGS $* -- \"$OUT/$FUZZER\"" else diff --git a/projects/hcl/Dockerfile b/projects/hcl/Dockerfile new file mode 100644 index 000000000..122beca6b --- /dev/null +++ b/projects/hcl/Dockerfile @@ -0,0 +1,20 @@ +# Copyright 2021 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +FROM gcr.io/oss-fuzz-base/base-builder-go +RUN git clone --depth 1 https://github.com/hashicorp/hcl +COPY build.sh $SRC +WORKDIR $SRC/hcl
\ No newline at end of file diff --git a/projects/hcl/build.sh b/projects/hcl/build.sh new file mode 100644 index 000000000..986e1009f --- /dev/null +++ b/projects/hcl/build.sh @@ -0,0 +1,36 @@ +#!/bin/bash -eu +# Copyright 2021 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +FUZZERS_BASE=$SRC/hcl/hclsyntax/fuzz +FUZZERS_PACKAGE=github.com/hashicorp/hcl/v2/hclsyntax/fuzz +FUZZER_CLASS=Fuzz + +for THE_FUZZER in config expr template traversal +do + THE_FUZZER_NAME="fuzz_"$THE_FUZZER + compile_go_fuzzer $FUZZERS_PACKAGE/$THE_FUZZER $FUZZER_CLASS $THE_FUZZER_NAME + + OUTDIR=$OUT/$THE_FUZZER_NAME"_seed_corpus" + mkdir $OUTDIR + find $FUZZERS_BASE/$THE_FUZZER/corpus -type f | while read FNAME + do + SHASUM_NAME=$(shasum "$FNAME" | awk '{print $1}') + cp "$FNAME" $OUTDIR + done + zip -r $OUTDIR".zip" $OUTDIR + rm -rf $OUTDIR +done
\ No newline at end of file diff --git a/projects/hcl/project.yaml b/projects/hcl/project.yaml new file mode 100644 index 000000000..4abeeb5f5 --- /dev/null +++ b/projects/hcl/project.yaml @@ -0,0 +1,10 @@ +homepage: "https://github.com/hashicorp/hcl" +language: go +auto_ccs: + - federico.maggi@gmail.com +fuzzing_engines: + - libfuzzer +sanitizers: + - address +primary_contact: "security@hashicorp.com" +main_repo: 'https://github.com/hashicorp/hcl'
\ No newline at end of file |