Add files using upload-large-folder tool
Browse files- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-fuzzbench/Dockerfile +26 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_build +28 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_install_dependencies +22 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_measure +32 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_run_fuzzer +41 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-go/Dockerfile +33 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-go/gosigfuzz.c +47 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-go/ossfuzz_coverage_runner.go +80 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-python/Dockerfile +20 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-swift/Dockerfile +22 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-swift/precompile_swift +33 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner-debug/Dockerfile +26 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/bad_build_check +494 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/coverage_helper +17 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/download_corpus +30 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/install_deps.sh +37 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/install_javascript.sh +30 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/profraw_update.py +182 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/rcfilt +21 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/reproduce +34 -0
- local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/run_fuzzer +228 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/actions/run_fuzzers/action.yml +82 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/external-actions/build_fuzzers/action.yml +75 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/external-actions/run_fuzzers/action.yml +97 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/__init__.py +54 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/git/__init__.py +158 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/git/git_test.py +122 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_actions_test.py +283 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_api.py +109 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/gitlab/__init__.py +133 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/gsutil/__init__.py +109 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/no_filestore/__init__.py +51 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/TimeoutFuzzer.cpp +36 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/example_crash_fuzzer_bug_summary.txt +68 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/example_crash_fuzzer_output.txt +202 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/.clusterfuzzlite/Dockerfile +22 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/.clusterfuzzlite/build.sh +24 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/Makefile +44 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.cpp +24 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.dict +6 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.cpp +36 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.h +19 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/standalone_fuzz_target_runner.cpp +47 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/sarif_utils_only_llvmfuzzer_stack.txt +302 -0
- local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/sarif_utils_systemd_stack.txt +302 -0
- local-test-tika-delta-04/fuzz-tooling/infra/tools/wycheproof/.gitignore +1 -0
- local-test-tika-delta-04/fuzz-tooling/infra/tools/wycheproof/generate_job.py +50 -0
- local-test-tika-delta-04/fuzz-tooling/infra/tools/wycheproof/launcher.py +34 -0
- local-test-tika-delta-04/fuzz-tooling/infra/tools/wycheproof/package.bash +18 -0
- local-test-tika-delta-04/fuzz-tooling/infra/tools/wycheproof/run.py +50 -0
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-fuzzbench/Dockerfile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2023 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
#
|
| 15 |
+
################################################################################
|
| 16 |
+
|
| 17 |
+
ARG IMG_TAG=latest
|
| 18 |
+
FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
|
| 19 |
+
|
| 20 |
+
# Copy/Run this now to make the cache more resilient.
|
| 21 |
+
COPY fuzzbench_install_dependencies /usr/local/bin
|
| 22 |
+
RUN fuzzbench_install_dependencies
|
| 23 |
+
|
| 24 |
+
ENV OSS_FUZZ_ON_DEMAND=1
|
| 25 |
+
|
| 26 |
+
COPY fuzzbench_build fuzzbench_run_fuzzer fuzzbench_measure /usr/local/bin/
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_build
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/bash -eux
|
| 2 |
+
# Copyright 2023 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
# TODO(metzman): Do this in a docket image so we don't need to waste time
|
| 19 |
+
# reinstalling.
|
| 20 |
+
PYTHONPATH=$FUZZBENCH_PATH python3 -B -u -c "from fuzzers.$FUZZING_ENGINE import fuzzer; fuzzer.build()"
|
| 21 |
+
|
| 22 |
+
if [ "$FUZZING_ENGINE" = "coverage" ]; then
|
| 23 |
+
cd $OUT
|
| 24 |
+
mkdir -p filestore/oss-fuzz-on-demand/coverage-binaries
|
| 25 |
+
# We expect an error regarding leading slashes. Just assume this step succeeds.
|
| 26 |
+
# TODO(metzman): Fix this when I get a chance.
|
| 27 |
+
tar -czvf filestore/oss-fuzz-on-demand/coverage-binaries/coverage-build-$PROJECT.tar.gz * /src /work || exit 0
|
| 28 |
+
fi
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_install_dependencies
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/bash -eux
|
| 2 |
+
# Copyright 2023 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
apt-get update && apt-get install -y gcc gfortran python-dev libopenblas-dev liblapack-dev cython libpq-dev
|
| 19 |
+
wget -O /tmp/requirements.txt https://raw.githubusercontent.com/google/fuzzbench/master/requirements.txt
|
| 20 |
+
pip3 install pip --upgrade
|
| 21 |
+
CFLAGS= CXXFLAGS= pip3 install -r /tmp/requirements.txt
|
| 22 |
+
rm /tmp/requirements.txt
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_measure
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/bash -eux
|
| 2 |
+
# Copyright 2023 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
# TODO(metzman): Make these configurable.
|
| 19 |
+
export DB_PATH=$OUT/experiment.db
|
| 20 |
+
export SNAPSHOT_PERIOD=30
|
| 21 |
+
export EXPERIMENT_FILESTORE=$OUT/filestore
|
| 22 |
+
export MAX_TOTAL_TIME=120
|
| 23 |
+
export EXPERIMENT=oss-fuzz-on-demand
|
| 24 |
+
|
| 25 |
+
rm -f $DB_PATH
|
| 26 |
+
|
| 27 |
+
# FUZZER=mopt BENCHMARK=skcms
|
| 28 |
+
|
| 29 |
+
export SQL_DATABASE_URL=sqlite:///$DB_PATH
|
| 30 |
+
|
| 31 |
+
cd $FUZZBENCH_PATH
|
| 32 |
+
PYTHONPATH=. python3 -B experiment/measurer/standalone.py $MAX_TOTAL_TIME
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_run_fuzzer
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/bash -eux
|
| 2 |
+
# Copyright 2023 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
export RUNNER_NICENESS="-5"
|
| 19 |
+
export EXPERIMENT_FILESTORE=$OUT/filestore
|
| 20 |
+
export EXPERIMENT=oss-fuzz-on-demand
|
| 21 |
+
export OSS_FUZZ_ON_DEMAND=1
|
| 22 |
+
export OUTPUT_CORPUS_DIR=/output-corpus
|
| 23 |
+
export SEED_CORPUS_DIR=/input-corpus
|
| 24 |
+
mkdir $SEED_CORPUS_DIR
|
| 25 |
+
rm -rf $OUTPUT_CORPUS_DIR
|
| 26 |
+
mkdir $OUTPUT_CORPUS_DIR
|
| 27 |
+
export FUZZER=$FUZZING_ENGINE
|
| 28 |
+
# TODO(metzman): Make this configurable.
|
| 29 |
+
export MAX_TOTAL_TIME=120
|
| 30 |
+
export SNAPSHOT_PERIOD=30
|
| 31 |
+
export TRIAL_ID=1
|
| 32 |
+
export FORCE_LOCAL=1
|
| 33 |
+
|
| 34 |
+
# BENCHMARK, FUZZ_TARGET
|
| 35 |
+
cd $OUT
|
| 36 |
+
|
| 37 |
+
# Prevent permissions issues with pyc files and docker.
|
| 38 |
+
cp -r $FUZZBENCH_PATH /tmp/fuzzbench
|
| 39 |
+
|
| 40 |
+
PYTHONPATH=/tmp/fuzzbench nice -n $RUNNER_NICENESS python3 -B -u /tmp/fuzzbench/experiment/runner.py
|
| 41 |
+
cat $EXPERIMENT_FILESTORE/$EXPERIMENT/experiment-folders/$BENCHMARK-$FUZZER/trial-$TRIAL_ID/results/fuzzer-log.txt
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-go/Dockerfile
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
#
|
| 15 |
+
################################################################################
|
| 16 |
+
|
| 17 |
+
ARG IMG_TAG=latest
|
| 18 |
+
FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
|
| 19 |
+
|
| 20 |
+
# Set up Golang environment variables (copied from /root/.bash_profile).
|
| 21 |
+
ENV GOPATH /root/go
|
| 22 |
+
|
| 23 |
+
# /root/.go/bin is for the standard Go binaries (i.e. go, gofmt, etc).
|
| 24 |
+
# $GOPATH/bin is for the binaries from the dependencies installed via "go get".
|
| 25 |
+
ENV PATH $PATH:/root/.go/bin:$GOPATH/bin
|
| 26 |
+
|
| 27 |
+
COPY gosigfuzz.c $GOPATH/gosigfuzz/
|
| 28 |
+
|
| 29 |
+
RUN install_go.sh
|
| 30 |
+
|
| 31 |
+
# TODO(jonathanmetzman): Install this file using install_go.sh.
|
| 32 |
+
COPY ossfuzz_coverage_runner.go \
|
| 33 |
+
$GOPATH/
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-go/gosigfuzz.c
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2023 Google LLC
|
| 3 |
+
|
| 4 |
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
* you may not use this file except in compliance with the License.
|
| 6 |
+
* You may obtain a copy of the License at
|
| 7 |
+
|
| 8 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
|
| 10 |
+
* Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
* See the License for the specific language governing permissions and
|
| 14 |
+
* limitations under the License.
|
| 15 |
+
*/
|
| 16 |
+
|
| 17 |
+
#include<stdlib.h>
|
| 18 |
+
#include<signal.h>
|
| 19 |
+
|
| 20 |
+
static void fixSignalHandler(int signum) {
|
| 21 |
+
struct sigaction new_action;
|
| 22 |
+
struct sigaction old_action;
|
| 23 |
+
sigemptyset (&new_action.sa_mask);
|
| 24 |
+
sigaction (signum, NULL, &old_action);
|
| 25 |
+
new_action.sa_flags = old_action.sa_flags | SA_ONSTACK;
|
| 26 |
+
new_action.sa_sigaction = old_action.sa_sigaction;
|
| 27 |
+
new_action.sa_handler = old_action.sa_handler;
|
| 28 |
+
sigaction (signum, &new_action, NULL);
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
static void FixStackSignalHandler() {
|
| 32 |
+
fixSignalHandler(SIGSEGV);
|
| 33 |
+
fixSignalHandler(SIGABRT);
|
| 34 |
+
fixSignalHandler(SIGALRM);
|
| 35 |
+
fixSignalHandler(SIGINT);
|
| 36 |
+
fixSignalHandler(SIGTERM);
|
| 37 |
+
fixSignalHandler(SIGBUS);
|
| 38 |
+
fixSignalHandler(SIGFPE);
|
| 39 |
+
fixSignalHandler(SIGXFSZ);
|
| 40 |
+
fixSignalHandler(SIGUSR1);
|
| 41 |
+
fixSignalHandler(SIGUSR2);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
int LLVMFuzzerInitialize(int *argc, char ***argv) {
|
| 45 |
+
FixStackSignalHandler();
|
| 46 |
+
return 0;
|
| 47 |
+
}
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-go/ossfuzz_coverage_runner.go
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2020 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
|
| 15 |
+
package mypackagebeingfuzzed
|
| 16 |
+
|
| 17 |
+
import (
|
| 18 |
+
"io/fs"
|
| 19 |
+
"io/ioutil"
|
| 20 |
+
"os"
|
| 21 |
+
"path/filepath"
|
| 22 |
+
"runtime/pprof"
|
| 23 |
+
"testing"
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
func TestFuzzCorpus(t *testing.T) {
|
| 27 |
+
dir := os.Getenv("FUZZ_CORPUS_DIR")
|
| 28 |
+
if dir == "" {
|
| 29 |
+
t.Logf("No fuzzing corpus directory set")
|
| 30 |
+
return
|
| 31 |
+
}
|
| 32 |
+
filename := ""
|
| 33 |
+
defer func() {
|
| 34 |
+
if r := recover(); r != nil {
|
| 35 |
+
t.Error("Fuzz panicked in "+filename, r)
|
| 36 |
+
}
|
| 37 |
+
}()
|
| 38 |
+
profname := os.Getenv("FUZZ_PROFILE_NAME")
|
| 39 |
+
if profname != "" {
|
| 40 |
+
f, err := os.Create(profname + ".cpu.prof")
|
| 41 |
+
if err != nil {
|
| 42 |
+
t.Logf("error creating profile file %s\n", err)
|
| 43 |
+
} else {
|
| 44 |
+
_ = pprof.StartCPUProfile(f)
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
_, err := ioutil.ReadDir(dir)
|
| 48 |
+
if err != nil {
|
| 49 |
+
t.Logf("Not fuzzing corpus directory %s", err)
|
| 50 |
+
return
|
| 51 |
+
}
|
| 52 |
+
// recurse for regressions subdirectory
|
| 53 |
+
err = filepath.Walk(dir, func(fname string, info fs.FileInfo, err error) error {
|
| 54 |
+
if info.IsDir() {
|
| 55 |
+
return nil
|
| 56 |
+
}
|
| 57 |
+
data, err := ioutil.ReadFile(fname)
|
| 58 |
+
if err != nil {
|
| 59 |
+
t.Error("Failed to read corpus file", err)
|
| 60 |
+
return err
|
| 61 |
+
}
|
| 62 |
+
filename = fname
|
| 63 |
+
FuzzFunction(data)
|
| 64 |
+
return nil
|
| 65 |
+
})
|
| 66 |
+
if err != nil {
|
| 67 |
+
t.Error("Failed to run corpus", err)
|
| 68 |
+
}
|
| 69 |
+
if profname != "" {
|
| 70 |
+
pprof.StopCPUProfile()
|
| 71 |
+
f, err := os.Create(profname + ".heap.prof")
|
| 72 |
+
if err != nil {
|
| 73 |
+
t.Logf("error creating heap profile file %s\n", err)
|
| 74 |
+
}
|
| 75 |
+
if err = pprof.WriteHeapProfile(f); err != nil {
|
| 76 |
+
t.Logf("error writing heap profile file %s\n", err)
|
| 77 |
+
}
|
| 78 |
+
f.Close()
|
| 79 |
+
}
|
| 80 |
+
}
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-python/Dockerfile
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
#
|
| 15 |
+
################################################################################
|
| 16 |
+
|
| 17 |
+
ARG IMG_TAG=latest
|
| 18 |
+
FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
|
| 19 |
+
|
| 20 |
+
RUN install_python.sh
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-swift/Dockerfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
#
|
| 15 |
+
################################################################################
|
| 16 |
+
|
| 17 |
+
ARG IMG_TAG=latest
|
| 18 |
+
FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
|
| 19 |
+
|
| 20 |
+
RUN install_swift.sh
|
| 21 |
+
|
| 22 |
+
COPY precompile_swift /usr/local/bin/
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-builder-swift/precompile_swift
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eu
|
| 2 |
+
# Copyright 2021 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
cp /usr/local/bin/llvm-symbolizer-swift $OUT/llvm-symbolizer
|
| 19 |
+
|
| 20 |
+
export SWIFTFLAGS="-Xswiftc -parse-as-library -Xswiftc -static-stdlib --static-swift-stdlib"
|
| 21 |
+
if [ "$SANITIZER" = "coverage" ]
|
| 22 |
+
then
|
| 23 |
+
export SWIFTFLAGS="$SWIFTFLAGS -Xswiftc -profile-generate -Xswiftc -profile-coverage-mapping -Xswiftc -sanitize=fuzzer"
|
| 24 |
+
else
|
| 25 |
+
export SWIFTFLAGS="$SWIFTFLAGS -Xswiftc -sanitize=fuzzer,$SANITIZER --sanitize=$SANITIZER"
|
| 26 |
+
for f in $CFLAGS; do
|
| 27 |
+
export SWIFTFLAGS="$SWIFTFLAGS -Xcc=$f"
|
| 28 |
+
done
|
| 29 |
+
|
| 30 |
+
for f in $CXXFLAGS; do
|
| 31 |
+
export SWIFTFLAGS="$SWIFTFLAGS -Xcxx=$f"
|
| 32 |
+
done
|
| 33 |
+
fi
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner-debug/Dockerfile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2016 Google Inc.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
#
|
| 15 |
+
################################################################################
|
| 16 |
+
|
| 17 |
+
ARG IMG_TAG=latest
|
| 18 |
+
FROM ghcr.io/aixcc-finals/base-runner:${IMG_TAG}
|
| 19 |
+
RUN apt-get update && apt-get install -y valgrind zip
|
| 20 |
+
|
| 21 |
+
# Installing GDB 12, re https://github.com/google/oss-fuzz/issues/7513.
|
| 22 |
+
RUN apt-get install -y build-essential libgmp-dev && \
|
| 23 |
+
wget https://ftp.gnu.org/gnu/gdb/gdb-12.1.tar.xz && \
|
| 24 |
+
tar -xf gdb-12.1.tar.xz && cd gdb-12.1 && ./configure && \
|
| 25 |
+
make -j $(expr $(nproc) / 2) && make install && cd .. && \
|
| 26 |
+
rm -rf gdb-12.1* && apt-get remove --purge -y build-essential libgmp-dev
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/bad_build_check
ADDED
|
@@ -0,0 +1,494 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -u
|
| 2 |
+
# Copyright 2017 Google Inc.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
# A minimal number of runs to test fuzz target with a non-empty input.
|
| 19 |
+
MIN_NUMBER_OF_RUNS=4
|
| 20 |
+
|
| 21 |
+
# The "example" target has 73 with ASan, 65 with UBSan, and 6648 with MSan.
|
| 22 |
+
# Real world targets have greater values (arduinojson: 407, zlib: 664).
|
| 23 |
+
# Mercurial's bdiff_fuzzer has 116 PCs when built with ASan.
|
| 24 |
+
THRESHOLD_FOR_NUMBER_OF_EDGES=100
|
| 25 |
+
|
| 26 |
+
# A fuzz target is supposed to have at least two functions, such as
|
| 27 |
+
# LLVMFuzzerTestOneInput and an API that is being called from there.
|
| 28 |
+
THRESHOLD_FOR_NUMBER_OF_FUNCTIONS=2
|
| 29 |
+
|
| 30 |
+
# Threshold values for different sanitizers used by instrumentation checks.
|
| 31 |
+
ASAN_CALLS_THRESHOLD_FOR_ASAN_BUILD=1000
|
| 32 |
+
ASAN_CALLS_THRESHOLD_FOR_NON_ASAN_BUILD=0
|
| 33 |
+
|
| 34 |
+
# The value below can definitely be higher (like 500-1000), but avoid being too
|
| 35 |
+
# agressive here while still evaluating the DFT-based fuzzing approach.
|
| 36 |
+
DFSAN_CALLS_THRESHOLD_FOR_DFSAN_BUILD=100
|
| 37 |
+
DFSAN_CALLS_THRESHOLD_FOR_NON_DFSAN_BUILD=0
|
| 38 |
+
|
| 39 |
+
MSAN_CALLS_THRESHOLD_FOR_MSAN_BUILD=1000
|
| 40 |
+
# Some engines (e.g. honggfuzz) may make a very small number of calls to msan
|
| 41 |
+
# for memory poisoning.
|
| 42 |
+
MSAN_CALLS_THRESHOLD_FOR_NON_MSAN_BUILD=3
|
| 43 |
+
|
| 44 |
+
# Usually, a non UBSan build (e.g. ASan) has 165 calls to UBSan runtime. The
|
| 45 |
+
# majority of targets built with UBSan have 200+ UBSan calls, but there are
|
| 46 |
+
# some very small targets that may have < 200 UBSan calls even in a UBSan build.
|
| 47 |
+
# Use the threshold value of 168 (slightly > 165) for UBSan build.
|
| 48 |
+
UBSAN_CALLS_THRESHOLD_FOR_UBSAN_BUILD=168
|
| 49 |
+
|
| 50 |
+
# It would be risky to use the threshold value close to 165 for non UBSan build,
|
| 51 |
+
# as UBSan runtime may change any time and thus we could have different number
|
| 52 |
+
# of calls to UBSan runtime even in ASan build. With that, we use the threshold
|
| 53 |
+
# value of 200 that would detect unnecessary UBSan instrumentation in the vast
|
| 54 |
+
# majority of targets, except of a handful very small ones, which would not be
|
| 55 |
+
# a big concern either way as the overhead for them would not be significant.
|
| 56 |
+
UBSAN_CALLS_THRESHOLD_FOR_NON_UBSAN_BUILD=200
|
| 57 |
+
|
| 58 |
+
# ASan builds on i386 generally have about 250 UBSan runtime calls.
|
| 59 |
+
if [[ $ARCHITECTURE == 'i386' ]]
|
| 60 |
+
then
|
| 61 |
+
UBSAN_CALLS_THRESHOLD_FOR_NON_UBSAN_BUILD=280
|
| 62 |
+
fi
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
# Verify that the given fuzz target is correctly built to run with a particular
|
| 66 |
+
# engine.
|
| 67 |
+
function check_engine {
|
| 68 |
+
local FUZZER=$1
|
| 69 |
+
local FUZZER_NAME=$(basename $FUZZER)
|
| 70 |
+
local FUZZER_OUTPUT="/tmp/$FUZZER_NAME.output"
|
| 71 |
+
local CHECK_FAILED=0
|
| 72 |
+
|
| 73 |
+
if [[ "$FUZZING_ENGINE" == libfuzzer ]]; then
|
| 74 |
+
# Store fuzz target's output into a temp file to be used for further checks.
|
| 75 |
+
$FUZZER -seed=1337 -runs=$MIN_NUMBER_OF_RUNS &>$FUZZER_OUTPUT
|
| 76 |
+
CHECK_FAILED=$(egrep "ERROR: no interesting inputs were found. Is the code instrumented" -c $FUZZER_OUTPUT)
|
| 77 |
+
if (( $CHECK_FAILED > 0 )); then
|
| 78 |
+
echo "BAD BUILD: $FUZZER does not seem to have coverage instrumentation."
|
| 79 |
+
cat $FUZZER_OUTPUT
|
| 80 |
+
# Bail out as the further check does not make any sense, there are 0 PCs.
|
| 81 |
+
return 1
|
| 82 |
+
fi
|
| 83 |
+
|
| 84 |
+
local NUMBER_OF_EDGES=$(grep -Po "INFO: Loaded [[:digit:]]+ module.*\(.*(counters|guards)\):[[:space:]]+\K[[:digit:]]+" $FUZZER_OUTPUT)
|
| 85 |
+
|
| 86 |
+
# If a fuzz target fails to start, grep won't find anything, so bail out early to let check_startup_crash deal with it.
|
| 87 |
+
[[ -z "$NUMBER_OF_EDGES" ]] && return
|
| 88 |
+
|
| 89 |
+
if (( $NUMBER_OF_EDGES < $THRESHOLD_FOR_NUMBER_OF_EDGES )); then
|
| 90 |
+
echo "BAD BUILD: $FUZZER seems to have only partial coverage instrumentation."
|
| 91 |
+
fi
|
| 92 |
+
elif [[ "$FUZZING_ENGINE" == afl ]]; then
|
| 93 |
+
AFL_FORKSRV_INIT_TMOUT=30000 AFL_NO_UI=1 SKIP_SEED_CORPUS=1 timeout --preserve-status -s INT 35s run_fuzzer $FUZZER_NAME &>$FUZZER_OUTPUT
|
| 94 |
+
CHECK_PASSED=$(egrep "All set and ready to roll" -c $FUZZER_OUTPUT)
|
| 95 |
+
if (( $CHECK_PASSED == 0 )); then
|
| 96 |
+
echo "BAD BUILD: fuzzing $FUZZER with afl-fuzz failed."
|
| 97 |
+
cat $FUZZER_OUTPUT
|
| 98 |
+
return 1
|
| 99 |
+
fi
|
| 100 |
+
elif [[ "$FUZZING_ENGINE" == honggfuzz ]]; then
|
| 101 |
+
SKIP_SEED_CORPUS=1 timeout --preserve-status -s INT 20s run_fuzzer $FUZZER_NAME &>$FUZZER_OUTPUT
|
| 102 |
+
CHECK_PASSED=$(egrep "^Sz:[0-9]+ Tm:[0-9]+" -c $FUZZER_OUTPUT)
|
| 103 |
+
if (( $CHECK_PASSED == 0 )); then
|
| 104 |
+
echo "BAD BUILD: fuzzing $FUZZER with honggfuzz failed."
|
| 105 |
+
cat $FUZZER_OUTPUT
|
| 106 |
+
return 1
|
| 107 |
+
fi
|
| 108 |
+
elif [[ "$FUZZING_ENGINE" == dataflow ]]; then
|
| 109 |
+
$FUZZER &> $FUZZER_OUTPUT
|
| 110 |
+
local NUMBER_OF_FUNCTIONS=$(grep -Po "INFO:\s+\K[[:digit:]]+(?=\s+instrumented function.*)" $FUZZER_OUTPUT)
|
| 111 |
+
[[ -z "$NUMBER_OF_FUNCTIONS" ]] && NUMBER_OF_FUNCTIONS=0
|
| 112 |
+
if (( $NUMBER_OF_FUNCTIONS < $THRESHOLD_FOR_NUMBER_OF_FUNCTIONS )); then
|
| 113 |
+
echo "BAD BUILD: $FUZZER does not seem to be properly built in 'dataflow' config."
|
| 114 |
+
cat $FUZZER_OUTPUT
|
| 115 |
+
return 1
|
| 116 |
+
fi
|
| 117 |
+
elif [[ "$FUZZING_ENGINE" == centipede \
|
| 118 |
+
&& ("${HELPER:-}" == True || "$SANITIZER" == none ) ]]; then
|
| 119 |
+
# Performs run test on unsanitized binaries with auxiliary sanitized
|
| 120 |
+
# binaries if they are built with helper.py.
|
| 121 |
+
# Performs run test on unsanitized binaries without auxiliary sanitized
|
| 122 |
+
# binaries if they are from trial build and production build.
|
| 123 |
+
# TODO(Dongge): Support run test with sanitized binaries for trial and
|
| 124 |
+
# production build.
|
| 125 |
+
SKIP_SEED_CORPUS=1 timeout --preserve-status -s INT 20s run_fuzzer $FUZZER_NAME &>$FUZZER_OUTPUT
|
| 126 |
+
CHECK_PASSED=$(egrep "\[S0.0] begin-fuzz: ft: 0 corp: 0/0" -c $FUZZER_OUTPUT)
|
| 127 |
+
if (( $CHECK_PASSED == 0 )); then
|
| 128 |
+
echo "BAD BUILD: fuzzing $FUZZER with centipede failed."
|
| 129 |
+
cat $FUZZER_OUTPUT
|
| 130 |
+
return 1
|
| 131 |
+
fi
|
| 132 |
+
fi
|
| 133 |
+
|
| 134 |
+
return 0
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
# Verify that the given fuzz target has been built properly and works.
|
| 138 |
+
function check_startup_crash {
|
| 139 |
+
local FUZZER=$1
|
| 140 |
+
local FUZZER_NAME=$(basename $FUZZER)
|
| 141 |
+
local FUZZER_OUTPUT="/tmp/$FUZZER_NAME.output"
|
| 142 |
+
local CHECK_PASSED=0
|
| 143 |
+
|
| 144 |
+
if [[ "$FUZZING_ENGINE" = libfuzzer ]]; then
|
| 145 |
+
# Skip seed corpus as there is another explicit check that uses seed corpora.
|
| 146 |
+
SKIP_SEED_CORPUS=1 run_fuzzer $FUZZER_NAME -seed=1337 -runs=$MIN_NUMBER_OF_RUNS &>$FUZZER_OUTPUT
|
| 147 |
+
CHECK_PASSED=$(egrep "Done $MIN_NUMBER_OF_RUNS runs" -c $FUZZER_OUTPUT)
|
| 148 |
+
elif [[ "$FUZZING_ENGINE" = afl ]]; then
|
| 149 |
+
AFL_FORKSRV_INIT_TMOUT=30000 AFL_NO_UI=1 SKIP_SEED_CORPUS=1 timeout --preserve-status -s INT 35s run_fuzzer $FUZZER_NAME &>$FUZZER_OUTPUT
|
| 150 |
+
if [ $(egrep "target binary (crashed|terminated)" -c $FUZZER_OUTPUT) -eq 0 ]; then
|
| 151 |
+
CHECK_PASSED=1
|
| 152 |
+
fi
|
| 153 |
+
elif [[ "$FUZZING_ENGINE" = dataflow ]]; then
|
| 154 |
+
# TODO(https://github.com/google/oss-fuzz/issues/1632): add check for
|
| 155 |
+
# binaries compiled with dataflow engine when the interface becomes stable.
|
| 156 |
+
CHECK_PASSED=1
|
| 157 |
+
else
|
| 158 |
+
# TODO: add checks for another fuzzing engines if possible.
|
| 159 |
+
CHECK_PASSED=1
|
| 160 |
+
fi
|
| 161 |
+
|
| 162 |
+
if [ "$CHECK_PASSED" -eq "0" ]; then
|
| 163 |
+
echo "BAD BUILD: $FUZZER seems to have either startup crash or exit:"
|
| 164 |
+
cat $FUZZER_OUTPUT
|
| 165 |
+
return 1
|
| 166 |
+
fi
|
| 167 |
+
|
| 168 |
+
return 0
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
# Mixed sanitizers check for ASan build.
|
| 172 |
+
function check_asan_build {
|
| 173 |
+
local FUZZER=$1
|
| 174 |
+
local ASAN_CALLS=$2
|
| 175 |
+
local DFSAN_CALLS=$3
|
| 176 |
+
local MSAN_CALLS=$4
|
| 177 |
+
local UBSAN_CALLS=$5
|
| 178 |
+
|
| 179 |
+
# Perform all the checks for more detailed error message.
|
| 180 |
+
if (( $ASAN_CALLS < $ASAN_CALLS_THRESHOLD_FOR_ASAN_BUILD )); then
|
| 181 |
+
echo "BAD BUILD: $FUZZER does not seem to be compiled with ASan."
|
| 182 |
+
return 1
|
| 183 |
+
fi
|
| 184 |
+
|
| 185 |
+
if (( $DFSAN_CALLS > $DFSAN_CALLS_THRESHOLD_FOR_NON_DFSAN_BUILD )); then
|
| 186 |
+
echo "BAD BUILD: ASan build of $FUZZER seems to be compiled with DFSan."
|
| 187 |
+
return 1
|
| 188 |
+
fi
|
| 189 |
+
|
| 190 |
+
if (( $MSAN_CALLS > $MSAN_CALLS_THRESHOLD_FOR_NON_MSAN_BUILD )); then
|
| 191 |
+
echo "BAD BUILD: ASan build of $FUZZER seems to be compiled with MSan."
|
| 192 |
+
return 1
|
| 193 |
+
fi
|
| 194 |
+
|
| 195 |
+
if (( $UBSAN_CALLS > $UBSAN_CALLS_THRESHOLD_FOR_NON_UBSAN_BUILD )); then
|
| 196 |
+
echo "BAD BUILD: ASan build of $FUZZER seems to be compiled with UBSan."
|
| 197 |
+
return 1
|
| 198 |
+
fi
|
| 199 |
+
|
| 200 |
+
return 0
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
# Mixed sanitizers check for DFSan build.
|
| 204 |
+
function check_dfsan_build {
|
| 205 |
+
local FUZZER=$1
|
| 206 |
+
local ASAN_CALLS=$2
|
| 207 |
+
local DFSAN_CALLS=$3
|
| 208 |
+
local MSAN_CALLS=$4
|
| 209 |
+
local UBSAN_CALLS=$5
|
| 210 |
+
|
| 211 |
+
# Perform all the checks for more detailed error message.
|
| 212 |
+
if (( $ASAN_CALLS > $ASAN_CALLS_THRESHOLD_FOR_NON_ASAN_BUILD )); then
|
| 213 |
+
echo "BAD BUILD: DFSan build of $FUZZER seems to be compiled with ASan."
|
| 214 |
+
return 1
|
| 215 |
+
fi
|
| 216 |
+
|
| 217 |
+
if (( $DFSAN_CALLS < $DFSAN_CALLS_THRESHOLD_FOR_DFSAN_BUILD )); then
|
| 218 |
+
echo "BAD BUILD: $FUZZER does not seem to be compiled with DFSan."
|
| 219 |
+
return 1
|
| 220 |
+
fi
|
| 221 |
+
|
| 222 |
+
if (( $MSAN_CALLS > $MSAN_CALLS_THRESHOLD_FOR_NON_MSAN_BUILD )); then
|
| 223 |
+
echo "BAD BUILD: ASan build of $FUZZER seems to be compiled with MSan."
|
| 224 |
+
return 1
|
| 225 |
+
fi
|
| 226 |
+
|
| 227 |
+
if (( $UBSAN_CALLS > $UBSAN_CALLS_THRESHOLD_FOR_NON_UBSAN_BUILD )); then
|
| 228 |
+
echo "BAD BUILD: ASan build of $FUZZER seems to be compiled with UBSan."
|
| 229 |
+
return 1
|
| 230 |
+
fi
|
| 231 |
+
|
| 232 |
+
return 0
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
# Mixed sanitizers check for MSan build.
|
| 237 |
+
function check_msan_build {
|
| 238 |
+
local FUZZER=$1
|
| 239 |
+
local ASAN_CALLS=$2
|
| 240 |
+
local DFSAN_CALLS=$3
|
| 241 |
+
local MSAN_CALLS=$4
|
| 242 |
+
local UBSAN_CALLS=$5
|
| 243 |
+
|
| 244 |
+
# Perform all the checks for more detailed error message.
|
| 245 |
+
if (( $ASAN_CALLS > $ASAN_CALLS_THRESHOLD_FOR_NON_ASAN_BUILD )); then
|
| 246 |
+
echo "BAD BUILD: MSan build of $FUZZER seems to be compiled with ASan."
|
| 247 |
+
return 1
|
| 248 |
+
fi
|
| 249 |
+
|
| 250 |
+
if (( $DFSAN_CALLS > $DFSAN_CALLS_THRESHOLD_FOR_NON_DFSAN_BUILD )); then
|
| 251 |
+
echo "BAD BUILD: MSan build of $FUZZER seems to be compiled with DFSan."
|
| 252 |
+
return 1
|
| 253 |
+
fi
|
| 254 |
+
|
| 255 |
+
if (( $MSAN_CALLS < $MSAN_CALLS_THRESHOLD_FOR_MSAN_BUILD )); then
|
| 256 |
+
echo "BAD BUILD: $FUZZER does not seem to be compiled with MSan."
|
| 257 |
+
return 1
|
| 258 |
+
fi
|
| 259 |
+
|
| 260 |
+
if (( $UBSAN_CALLS > $UBSAN_CALLS_THRESHOLD_FOR_NON_UBSAN_BUILD )); then
|
| 261 |
+
echo "BAD BUILD: MSan build of $FUZZER seems to be compiled with UBSan."
|
| 262 |
+
return 1
|
| 263 |
+
fi
|
| 264 |
+
|
| 265 |
+
return 0
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
# Mixed sanitizers check for UBSan build.
|
| 269 |
+
function check_ubsan_build {
|
| 270 |
+
local FUZZER=$1
|
| 271 |
+
local ASAN_CALLS=$2
|
| 272 |
+
local DFSAN_CALLS=$3
|
| 273 |
+
local MSAN_CALLS=$4
|
| 274 |
+
local UBSAN_CALLS=$5
|
| 275 |
+
|
| 276 |
+
if [[ "$FUZZING_ENGINE" != libfuzzer ]]; then
|
| 277 |
+
# Ignore UBSan checks for fuzzing engines other than libFuzzer because:
|
| 278 |
+
# A) we (probably) are not going to use those with UBSan
|
| 279 |
+
# B) such builds show indistinguishable number of calls to UBSan
|
| 280 |
+
return 0
|
| 281 |
+
fi
|
| 282 |
+
|
| 283 |
+
# Perform all the checks for more detailed error message.
|
| 284 |
+
if (( $ASAN_CALLS > $ASAN_CALLS_THRESHOLD_FOR_NON_ASAN_BUILD )); then
|
| 285 |
+
echo "BAD BUILD: UBSan build of $FUZZER seems to be compiled with ASan."
|
| 286 |
+
return 1
|
| 287 |
+
fi
|
| 288 |
+
|
| 289 |
+
if (( $DFSAN_CALLS > $DFSAN_CALLS_THRESHOLD_FOR_NON_DFSAN_BUILD )); then
|
| 290 |
+
echo "BAD BUILD: UBSan build of $FUZZER seems to be compiled with DFSan."
|
| 291 |
+
return 1
|
| 292 |
+
fi
|
| 293 |
+
|
| 294 |
+
if (( $MSAN_CALLS > $MSAN_CALLS_THRESHOLD_FOR_NON_MSAN_BUILD )); then
|
| 295 |
+
echo "BAD BUILD: UBSan build of $FUZZER seems to be compiled with MSan."
|
| 296 |
+
return 1
|
| 297 |
+
fi
|
| 298 |
+
|
| 299 |
+
if (( $UBSAN_CALLS < $UBSAN_CALLS_THRESHOLD_FOR_UBSAN_BUILD )); then
|
| 300 |
+
echo "BAD BUILD: $FUZZER does not seem to be compiled with UBSan."
|
| 301 |
+
return 1
|
| 302 |
+
fi
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
# Verify that the given fuzz target is compiled with correct sanitizer.
|
| 306 |
+
function check_mixed_sanitizers {
|
| 307 |
+
local FUZZER=$1
|
| 308 |
+
local result=0
|
| 309 |
+
local CALL_INSN=
|
| 310 |
+
|
| 311 |
+
if [ "${FUZZING_LANGUAGE:-}" = "jvm" ]; then
|
| 312 |
+
# Sanitizer runtime is linked into the Jazzer driver, so this check does not
|
| 313 |
+
# apply.
|
| 314 |
+
return 0
|
| 315 |
+
fi
|
| 316 |
+
|
| 317 |
+
if [ "${FUZZING_LANGUAGE:-}" = "javascript" ]; then
|
| 318 |
+
# Jazzer.js currently does not support using sanitizers with native Node.js addons.
|
| 319 |
+
# This is not relevant anyways since supporting this will be done by preloading
|
| 320 |
+
# the sanitizers in the wrapper script starting Jazzer.js.
|
| 321 |
+
return 0
|
| 322 |
+
fi
|
| 323 |
+
|
| 324 |
+
if [ "${FUZZING_LANGUAGE:-}" = "python" ]; then
|
| 325 |
+
# Sanitizer runtime is loaded via LD_PRELOAD, so this check does not apply.
|
| 326 |
+
return 0
|
| 327 |
+
fi
|
| 328 |
+
|
| 329 |
+
# For fuzztest fuzzers point to the binary instead of launcher script.
|
| 330 |
+
if [[ $FUZZER == *"@"* ]]; then
|
| 331 |
+
FUZZER=(${FUZZER//@/ }[0])
|
| 332 |
+
fi
|
| 333 |
+
|
| 334 |
+
CALL_INSN=
|
| 335 |
+
if [[ $ARCHITECTURE == "x86_64" ]]
|
| 336 |
+
then
|
| 337 |
+
CALL_INSN="callq?\s+[0-9a-f]+\s+<"
|
| 338 |
+
elif [[ $ARCHITECTURE == "i386" ]]
|
| 339 |
+
then
|
| 340 |
+
CALL_INSN="call\s+[0-9a-f]+\s+<"
|
| 341 |
+
elif [[ $ARCHITECTURE == "aarch64" ]]
|
| 342 |
+
then
|
| 343 |
+
CALL_INSN="bl\s+[0-9a-f]+\s+<"
|
| 344 |
+
else
|
| 345 |
+
echo "UNSUPPORTED ARCHITECTURE"
|
| 346 |
+
exit 1
|
| 347 |
+
fi
|
| 348 |
+
local ASAN_CALLS=$(objdump -dC $FUZZER | egrep "${CALL_INSN}__asan" -c)
|
| 349 |
+
local DFSAN_CALLS=$(objdump -dC $FUZZER | egrep "${CALL_INSN}__dfsan" -c)
|
| 350 |
+
local MSAN_CALLS=$(objdump -dC $FUZZER | egrep "${CALL_INSN}__msan" -c)
|
| 351 |
+
local UBSAN_CALLS=$(objdump -dC $FUZZER | egrep "${CALL_INSN}__ubsan" -c)
|
| 352 |
+
|
| 353 |
+
|
| 354 |
+
if [[ "$SANITIZER" = address ]]; then
|
| 355 |
+
check_asan_build $FUZZER $ASAN_CALLS $DFSAN_CALLS $MSAN_CALLS $UBSAN_CALLS
|
| 356 |
+
result=$?
|
| 357 |
+
elif [[ "$SANITIZER" = dataflow ]]; then
|
| 358 |
+
check_dfsan_build $FUZZER $ASAN_CALLS $DFSAN_CALLS $MSAN_CALLS $UBSAN_CALLS
|
| 359 |
+
result=$?
|
| 360 |
+
elif [[ "$SANITIZER" = memory ]]; then
|
| 361 |
+
check_msan_build $FUZZER $ASAN_CALLS $DFSAN_CALLS $MSAN_CALLS $UBSAN_CALLS
|
| 362 |
+
result=$?
|
| 363 |
+
elif [[ "$SANITIZER" = undefined ]]; then
|
| 364 |
+
check_ubsan_build $FUZZER $ASAN_CALLS $DFSAN_CALLS $MSAN_CALLS $UBSAN_CALLS
|
| 365 |
+
result=$?
|
| 366 |
+
elif [[ "$SANITIZER" = thread ]]; then
|
| 367 |
+
# TODO(metzman): Implement this.
|
| 368 |
+
result=0
|
| 369 |
+
fi
|
| 370 |
+
|
| 371 |
+
return $result
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
# Verify that the given fuzz target doesn't crash on the seed corpus.
|
| 375 |
+
function check_seed_corpus {
|
| 376 |
+
local FUZZER=$1
|
| 377 |
+
local FUZZER_NAME="$(basename $FUZZER)"
|
| 378 |
+
local FUZZER_OUTPUT="/tmp/$FUZZER_NAME.output"
|
| 379 |
+
|
| 380 |
+
if [[ "$FUZZING_ENGINE" != libfuzzer ]]; then
|
| 381 |
+
return 0
|
| 382 |
+
fi
|
| 383 |
+
|
| 384 |
+
# Set up common fuzzing arguments, otherwise "run_fuzzer" errors out.
|
| 385 |
+
if [ -z "$FUZZER_ARGS" ]; then
|
| 386 |
+
export FUZZER_ARGS="-rss_limit_mb=2560 -timeout=25"
|
| 387 |
+
fi
|
| 388 |
+
|
| 389 |
+
bash -c "run_fuzzer $FUZZER_NAME -runs=0" &> $FUZZER_OUTPUT
|
| 390 |
+
|
| 391 |
+
# Don't output anything if fuzz target hasn't crashed.
|
| 392 |
+
if [ $? -ne 0 ]; then
|
| 393 |
+
echo "BAD BUILD: $FUZZER has a crashing input in its seed corpus:"
|
| 394 |
+
cat $FUZZER_OUTPUT
|
| 395 |
+
return 1
|
| 396 |
+
fi
|
| 397 |
+
|
| 398 |
+
return 0
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
function check_architecture {
|
| 402 |
+
local FUZZER=$1
|
| 403 |
+
local FUZZER_NAME=$(basename $FUZZER)
|
| 404 |
+
|
| 405 |
+
if [ "${FUZZING_LANGUAGE:-}" = "jvm" ]; then
|
| 406 |
+
# The native dependencies of a JVM project are not packaged, but loaded
|
| 407 |
+
# dynamically at runtime and thus cannot be checked here.
|
| 408 |
+
return 0;
|
| 409 |
+
fi
|
| 410 |
+
|
| 411 |
+
if [ "${FUZZING_LANGUAGE:-}" = "javascript" ]; then
|
| 412 |
+
# Jazzer.js fuzzers are wrapper scripts that start the fuzz target with
|
| 413 |
+
# the Jazzer.js CLI.
|
| 414 |
+
return 0;
|
| 415 |
+
fi
|
| 416 |
+
|
| 417 |
+
if [ "${FUZZING_LANGUAGE:-}" = "python" ]; then
|
| 418 |
+
FUZZER=${FUZZER}.pkg
|
| 419 |
+
fi
|
| 420 |
+
|
| 421 |
+
# For fuzztest fuzzers point to the binary instead of launcher script.
|
| 422 |
+
if [[ $FUZZER == *"@"* ]]; then
|
| 423 |
+
FUZZER=(${FUZZER//@/ }[0])
|
| 424 |
+
fi
|
| 425 |
+
|
| 426 |
+
FILE_OUTPUT=$(file $FUZZER)
|
| 427 |
+
if [[ $ARCHITECTURE == "x86_64" ]]
|
| 428 |
+
then
|
| 429 |
+
echo $FILE_OUTPUT | grep "x86-64" > /dev/null
|
| 430 |
+
elif [[ $ARCHITECTURE == "i386" ]]
|
| 431 |
+
then
|
| 432 |
+
echo $FILE_OUTPUT | grep "80386" > /dev/null
|
| 433 |
+
elif [[ $ARCHITECTURE == "aarch64" ]]
|
| 434 |
+
then
|
| 435 |
+
echo $FILE_OUTPUT | grep "aarch64" > /dev/null
|
| 436 |
+
else
|
| 437 |
+
echo "UNSUPPORTED ARCHITECTURE"
|
| 438 |
+
return 1
|
| 439 |
+
fi
|
| 440 |
+
result=$?
|
| 441 |
+
if [[ $result != 0 ]]
|
| 442 |
+
then
|
| 443 |
+
echo "BAD BUILD $FUZZER is not built for architecture: $ARCHITECTURE"
|
| 444 |
+
echo "file command output: $FILE_OUTPUT"
|
| 445 |
+
echo "check_mixed_sanitizers test will fail."
|
| 446 |
+
fi
|
| 447 |
+
return $result
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
function main {
|
| 451 |
+
local FUZZER=$1
|
| 452 |
+
local AUXILIARY_FUZZER=${2:-}
|
| 453 |
+
local checks_failed=0
|
| 454 |
+
local result=0
|
| 455 |
+
|
| 456 |
+
export RUN_FUZZER_MODE="batch"
|
| 457 |
+
check_engine $FUZZER
|
| 458 |
+
result=$?
|
| 459 |
+
checks_failed=$(( $checks_failed + $result ))
|
| 460 |
+
|
| 461 |
+
check_architecture $FUZZER
|
| 462 |
+
result=$?
|
| 463 |
+
checks_failed=$(( $checks_failed + $result ))
|
| 464 |
+
|
| 465 |
+
if [[ "$FUZZING_ENGINE" == centipede \
|
| 466 |
+
&& "$SANITIZER" != none && "${HELPER:-}" == True ]]; then
|
| 467 |
+
check_mixed_sanitizers $AUXILIARY_FUZZER
|
| 468 |
+
else
|
| 469 |
+
check_mixed_sanitizers $FUZZER
|
| 470 |
+
fi
|
| 471 |
+
result=$?
|
| 472 |
+
checks_failed=$(( $checks_failed + $result ))
|
| 473 |
+
|
| 474 |
+
check_startup_crash $FUZZER
|
| 475 |
+
result=$?
|
| 476 |
+
checks_failed=$(( $checks_failed + $result ))
|
| 477 |
+
|
| 478 |
+
# TODO: re-enable after introducing bug auto-filing for bad builds.
|
| 479 |
+
# check_seed_corpus $FUZZER
|
| 480 |
+
return $checks_failed
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
|
| 484 |
+
if [ $# -ne 1 -a $# -ne 2 ]; then
|
| 485 |
+
echo "Usage: $0 <fuzz_target_binary> [<auxiliary_binary>]"
|
| 486 |
+
exit 1
|
| 487 |
+
fi
|
| 488 |
+
|
| 489 |
+
# Fuzz target path.
|
| 490 |
+
FUZZER=$1
|
| 491 |
+
AUXILIARY_FUZZER=${2:-}
|
| 492 |
+
|
| 493 |
+
main $FUZZER $AUXILIARY_FUZZER
|
| 494 |
+
exit $?
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/coverage_helper
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -u
|
| 2 |
+
# Copyright 2018 Google Inc.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
python3 $CODE_COVERAGE_SRC/coverage_utils.py $@
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/download_corpus
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -u
|
| 2 |
+
# Copyright 2018 Google Inc.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
if (( $# < 1 )); then
|
| 19 |
+
echo "Usage: $0 \"path_download_to url_download_from\" (can be repeated)" >&2
|
| 20 |
+
exit 1
|
| 21 |
+
fi
|
| 22 |
+
|
| 23 |
+
for pair in "$@"; do
|
| 24 |
+
read path url <<< "$pair"
|
| 25 |
+
wget -q -O $path $url
|
| 26 |
+
done
|
| 27 |
+
|
| 28 |
+
# Always exit with 0 as we do not track wget return codes and should not rely
|
| 29 |
+
# on the latest command execution.
|
| 30 |
+
exit 0
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/install_deps.sh
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eux
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
# Install dependencies in a platform-aware way.
|
| 19 |
+
|
| 20 |
+
apt-get update && apt-get install -y \
|
| 21 |
+
binutils \
|
| 22 |
+
file \
|
| 23 |
+
ca-certificates \
|
| 24 |
+
fonts-dejavu \
|
| 25 |
+
git \
|
| 26 |
+
libcap2 \
|
| 27 |
+
rsync \
|
| 28 |
+
unzip \
|
| 29 |
+
wget \
|
| 30 |
+
zip --no-install-recommends
|
| 31 |
+
|
| 32 |
+
case $(uname -m) in
|
| 33 |
+
x86_64)
|
| 34 |
+
# We only need to worry about i386 if we are on x86_64.
|
| 35 |
+
apt-get install -y lib32gcc1 libc6-i386
|
| 36 |
+
;;
|
| 37 |
+
esac
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/install_javascript.sh
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eux
|
| 2 |
+
# Copyright 2023 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
# see installation instructions: https://github.com/nodesource/distributions#available-architectures
|
| 18 |
+
apt-get update
|
| 19 |
+
apt-get install -y ca-certificates curl gnupg
|
| 20 |
+
mkdir -p /etc/apt/keyrings
|
| 21 |
+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
| 22 |
+
|
| 23 |
+
NODE_MAJOR=20
|
| 24 |
+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
| 25 |
+
|
| 26 |
+
apt-get update
|
| 27 |
+
apt-get install nodejs -y
|
| 28 |
+
|
| 29 |
+
# Install latest versions of nyc for source-based coverage reporting
|
| 30 |
+
npm install --global nyc
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/profraw_update.py
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# Copyright 2021 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
"""Helper script for upgrading a profraw file to latest version."""
|
| 18 |
+
|
| 19 |
+
from collections import namedtuple
|
| 20 |
+
import struct
|
| 21 |
+
import subprocess
|
| 22 |
+
import sys
|
| 23 |
+
|
| 24 |
+
HeaderGeneric = namedtuple('HeaderGeneric', 'magic version')
|
| 25 |
+
HeaderVersion9 = namedtuple(
|
| 26 |
+
'HeaderVersion9',
|
| 27 |
+
'BinaryIdsSize DataSize PaddingBytesBeforeCounters CountersSize \
|
| 28 |
+
PaddingBytesAfterCounters NumBitmapBytes PaddingBytesAfterBitmapBytes NamesSize CountersDelta BitmapDelta NamesDelta ValueKindLast'
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
PROFRAW_MAGIC = 0xff6c70726f667281
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def relativize_address(data, offset, databegin, sect_prf_cnts, sect_prf_data):
|
| 35 |
+
"""Turns an absolute offset into a relative one."""
|
| 36 |
+
value = struct.unpack('Q', data[offset:offset + 8])[0]
|
| 37 |
+
if sect_prf_cnts <= value < sect_prf_data:
|
| 38 |
+
# If the value is an address in the right section, make it relative.
|
| 39 |
+
value = (value - databegin) & 0xffffffffffffffff
|
| 40 |
+
value = struct.pack('Q', value)
|
| 41 |
+
for i in range(8):
|
| 42 |
+
data[offset + i] = value[i]
|
| 43 |
+
# address was made relative
|
| 44 |
+
return True
|
| 45 |
+
# no changes done
|
| 46 |
+
return False
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def upgrade(data, sect_prf_cnts, sect_prf_data):
|
| 50 |
+
"""Upgrades profraw data, knowing the sections addresses."""
|
| 51 |
+
generic_header = HeaderGeneric._make(struct.unpack('QQ', data[:16]))
|
| 52 |
+
if generic_header.magic != PROFRAW_MAGIC:
|
| 53 |
+
raise Exception('Bad magic.')
|
| 54 |
+
base_version = generic_header.version
|
| 55 |
+
|
| 56 |
+
if base_version >= 9:
|
| 57 |
+
# Nothing to do.
|
| 58 |
+
return data
|
| 59 |
+
if base_version < 5 or base_version == 6:
|
| 60 |
+
raise Exception('Unhandled version.')
|
| 61 |
+
|
| 62 |
+
if generic_header.version == 5:
|
| 63 |
+
generic_header = generic_header._replace(version=7)
|
| 64 |
+
# Upgrade from version 5 to 7 by adding binaryids field.
|
| 65 |
+
data = data[:8] + struct.pack('Q', generic_header.version) + struct.pack(
|
| 66 |
+
'Q', 0) + data[16:]
|
| 67 |
+
if generic_header.version == 7:
|
| 68 |
+
# cf https://reviews.llvm.org/D111123
|
| 69 |
+
generic_header = generic_header._replace(version=8)
|
| 70 |
+
data = data[:8] + struct.pack('Q', generic_header.version) + data[16:]
|
| 71 |
+
if generic_header.version == 8:
|
| 72 |
+
# see https://reviews.llvm.org/D138846
|
| 73 |
+
generic_header = generic_header._replace(version=9)
|
| 74 |
+
# Upgrade from version 8 to 9 by adding NumBitmapBytes, PaddingBytesAfterBitmapBytes and BitmapDelta fields.
|
| 75 |
+
data = data[:8] + struct.pack(
|
| 76 |
+
'Q', generic_header.version) + data[16:56] + struct.pack(
|
| 77 |
+
'QQ', 0, 0) + data[56:72] + struct.pack('Q', 0) + data[72:]
|
| 78 |
+
|
| 79 |
+
v9_header = HeaderVersion9._make(struct.unpack('QQQQQQQQQQQQ', data[16:112]))
|
| 80 |
+
|
| 81 |
+
if base_version <= 8 and v9_header.BinaryIdsSize % 8 != 0:
|
| 82 |
+
# Adds padding for binary ids.
|
| 83 |
+
# cf commit b9f547e8e51182d32f1912f97a3e53f4899ea6be
|
| 84 |
+
# cf https://reviews.llvm.org/D110365
|
| 85 |
+
padlen = 8 - (v9_header.BinaryIdsSize % 8)
|
| 86 |
+
v7_header = v9_header._replace(BinaryIdsSize=v9_header.BinaryIdsSize +
|
| 87 |
+
padlen)
|
| 88 |
+
data = data[:16] + struct.pack('Q', v9_header.BinaryIdsSize) + data[24:]
|
| 89 |
+
data = data[:112 + v9_header.BinaryIdsSize] + bytes(
|
| 90 |
+
padlen) + data[112 + v9_header.BinaryIdsSize:]
|
| 91 |
+
|
| 92 |
+
if base_version <= 8:
|
| 93 |
+
offset = 112 + v9_header.BinaryIdsSize
|
| 94 |
+
for d in range(v9_header.DataSize):
|
| 95 |
+
# Add BitmapPtr and aligned u32(NumBitmapBytes)
|
| 96 |
+
data = data[:offset + 3 * 8] + struct.pack(
|
| 97 |
+
'Q', 0) + data[offset + 3 * 8:offset + 6 * 8] + struct.pack(
|
| 98 |
+
'Q', 0) + data[offset + 6 * 8:]
|
| 99 |
+
value = struct.unpack('Q',
|
| 100 |
+
data[offset + 2 * 8:offset + 3 * 8])[0] - 16 * d
|
| 101 |
+
data = data[:offset + 2 * 8] + struct.pack('Q',
|
| 102 |
+
value) + data[offset + 3 * 8:]
|
| 103 |
+
offset += 8 * 8
|
| 104 |
+
|
| 105 |
+
if base_version >= 8:
|
| 106 |
+
# Nothing more to do.
|
| 107 |
+
return data
|
| 108 |
+
|
| 109 |
+
# Last changes are relaed to bump from 7 to version 8 making CountersPtr relative.
|
| 110 |
+
dataref = sect_prf_data
|
| 111 |
+
# 80 is offset of CountersDelta.
|
| 112 |
+
if not relativize_address(data, 80, dataref, sect_prf_cnts, sect_prf_data):
|
| 113 |
+
return data
|
| 114 |
+
|
| 115 |
+
offset = 112 + v9_header.BinaryIdsSize
|
| 116 |
+
# This also works for C+Rust binaries compiled with
|
| 117 |
+
# clang-14/rust-nightly-clang-13.
|
| 118 |
+
for _ in range(v9_header.DataSize):
|
| 119 |
+
# 16 is the offset of CounterPtr in ProfrawData structure.
|
| 120 |
+
relativize_address(data, offset + 16, dataref, sect_prf_cnts, sect_prf_data)
|
| 121 |
+
# We need this because of CountersDelta -= sizeof(*SrcData);
|
| 122 |
+
# seen in __llvm_profile_merge_from_buffer.
|
| 123 |
+
dataref += 44 + 2 * (v9_header.ValueKindLast + 1)
|
| 124 |
+
if was8:
|
| 125 |
+
#profraw9 added RelativeBitmapPtr and NumBitmapBytes (8+4 rounded up to 16)
|
| 126 |
+
dataref -= 16
|
| 127 |
+
# This is the size of one ProfrawData structure.
|
| 128 |
+
offset += 44 + 2 * (v9_header.ValueKindLast + 1)
|
| 129 |
+
|
| 130 |
+
return data
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def main():
|
| 134 |
+
"""Helper script for upgrading a profraw file to latest version."""
|
| 135 |
+
if len(sys.argv) < 3:
|
| 136 |
+
sys.stderr.write('Usage: %s <binary> options? <profraw>...\n' % sys.argv[0])
|
| 137 |
+
return 1
|
| 138 |
+
|
| 139 |
+
# First find llvm profile sections addresses in the elf, quick and dirty.
|
| 140 |
+
process = subprocess.Popen(['readelf', '-S', sys.argv[1]],
|
| 141 |
+
stdout=subprocess.PIPE)
|
| 142 |
+
output, err = process.communicate()
|
| 143 |
+
if err:
|
| 144 |
+
print('readelf failed')
|
| 145 |
+
return 2
|
| 146 |
+
for line in iter(output.split(b'\n')):
|
| 147 |
+
if b'__llvm_prf_cnts' in line:
|
| 148 |
+
sect_prf_cnts = int(line.split()[3], 16)
|
| 149 |
+
elif b'__llvm_prf_data' in line:
|
| 150 |
+
sect_prf_data = int(line.split()[3], 16)
|
| 151 |
+
|
| 152 |
+
out_name = "default.profup"
|
| 153 |
+
in_place = False
|
| 154 |
+
start = 2
|
| 155 |
+
if sys.argv[2] == "-i":
|
| 156 |
+
in_place = True
|
| 157 |
+
start = start + 1
|
| 158 |
+
elif sys.argv[2] == "-o":
|
| 159 |
+
out_name = sys.argv[3]
|
| 160 |
+
start = 4
|
| 161 |
+
|
| 162 |
+
if len(sys.argv) < start:
|
| 163 |
+
sys.stderr.write('Usage: %s <binary> options <profraw>...\n' % sys.argv[0])
|
| 164 |
+
return 1
|
| 165 |
+
|
| 166 |
+
for i in range(start, len(sys.argv)):
|
| 167 |
+
# Then open and read the input profraw file.
|
| 168 |
+
with open(sys.argv[i], 'rb') as input_file:
|
| 169 |
+
profraw_base = bytearray(input_file.read())
|
| 170 |
+
# Do the upgrade, returning a bytes object.
|
| 171 |
+
profraw_latest = upgrade(profraw_base, sect_prf_cnts, sect_prf_data)
|
| 172 |
+
# Write the output to the file given to the command line.
|
| 173 |
+
if in_place:
|
| 174 |
+
out_name = sys.argv[i]
|
| 175 |
+
with open(out_name, 'wb') as output_file:
|
| 176 |
+
output_file.write(profraw_latest)
|
| 177 |
+
|
| 178 |
+
return 0
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
if __name__ == '__main__':
|
| 182 |
+
sys.exit(main())
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/rcfilt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -u
|
| 2 |
+
# Copyright 2020 Google Inc.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
# Symbol demangling for both C++ and Rust
|
| 17 |
+
#
|
| 18 |
+
################################################################################
|
| 19 |
+
|
| 20 |
+
# simply pipe
|
| 21 |
+
rustfilt | c++filt -n
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/reproduce
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eux
|
| 2 |
+
# Copyright 2016 Google Inc.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
FUZZER=$1
|
| 19 |
+
shift
|
| 20 |
+
|
| 21 |
+
if [ ! -v TESTCASE ]; then
|
| 22 |
+
TESTCASE="/testcase"
|
| 23 |
+
fi
|
| 24 |
+
|
| 25 |
+
if [ ! -f $TESTCASE ]; then
|
| 26 |
+
echo "Error: $TESTCASE not found, use: docker run -v <path>:$TESTCASE ..."
|
| 27 |
+
exit 1
|
| 28 |
+
fi
|
| 29 |
+
|
| 30 |
+
export RUN_FUZZER_MODE="interactive"
|
| 31 |
+
export FUZZING_ENGINE="libfuzzer"
|
| 32 |
+
export SKIP_SEED_CORPUS="1"
|
| 33 |
+
|
| 34 |
+
run_fuzzer $FUZZER $@ $TESTCASE
|
local-test-tika-delta-04/fuzz-tooling/infra/base-images/base-runner/run_fuzzer
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eu
|
| 2 |
+
# Copyright 2024 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
# Fuzzer runner. Appends .options arguments and seed corpus to users args.
|
| 19 |
+
# Usage: $0 <fuzzer_name> <fuzzer_args>
|
| 20 |
+
|
| 21 |
+
sysctl -w vm.mmap_rnd_bits=28
|
| 22 |
+
|
| 23 |
+
export PATH=$OUT:$PATH
|
| 24 |
+
cd $OUT
|
| 25 |
+
|
| 26 |
+
DEBUGGER=${DEBUGGER:-}
|
| 27 |
+
|
| 28 |
+
FUZZER=$1
|
| 29 |
+
shift
|
| 30 |
+
|
| 31 |
+
# This env var is set by CIFuzz. CIFuzz fills this directory with the corpus
|
| 32 |
+
# from ClusterFuzz.
|
| 33 |
+
CORPUS_DIR=${CORPUS_DIR:-}
|
| 34 |
+
if [ -z "$CORPUS_DIR" ]
|
| 35 |
+
then
|
| 36 |
+
CORPUS_DIR="/tmp/${FUZZER}_corpus"
|
| 37 |
+
rm -rf $CORPUS_DIR && mkdir -p $CORPUS_DIR
|
| 38 |
+
fi
|
| 39 |
+
|
| 40 |
+
SANITIZER=${SANITIZER:-}
|
| 41 |
+
if [ -z $SANITIZER ]; then
|
| 42 |
+
# If $SANITIZER is not specified (e.g. calling from `reproduce` command), it
|
| 43 |
+
# is not important and can be set to any value.
|
| 44 |
+
SANITIZER="default"
|
| 45 |
+
fi
|
| 46 |
+
|
| 47 |
+
if [[ "$RUN_FUZZER_MODE" = interactive ]]; then
|
| 48 |
+
FUZZER_OUT="$OUT/${FUZZER}_${FUZZING_ENGINE}_${SANITIZER}_out"
|
| 49 |
+
else
|
| 50 |
+
FUZZER_OUT="/tmp/${FUZZER}_${FUZZING_ENGINE}_${SANITIZER}_out"
|
| 51 |
+
fi
|
| 52 |
+
|
| 53 |
+
function get_dictionary() {
|
| 54 |
+
local options_file="$FUZZER.options"
|
| 55 |
+
local dict_file="$FUZZER.dict"
|
| 56 |
+
local dict=""
|
| 57 |
+
if [[ -f "$options_file" ]]; then
|
| 58 |
+
dict=$(sed -n 's/^\s*dict\s*=\s*\(.*\)/\1/p' "$options_file" | tail -1)
|
| 59 |
+
fi
|
| 60 |
+
if [[ -z "$dict" && -f "$dict_file" ]]; then
|
| 61 |
+
dict="$dict_file"
|
| 62 |
+
fi
|
| 63 |
+
[[ -z "$dict" ]] && return
|
| 64 |
+
if [[ "$FUZZING_ENGINE" = "libfuzzer" ]]; then
|
| 65 |
+
printf -- "-dict=%s" "$dict"
|
| 66 |
+
elif [[ "$FUZZING_ENGINE" = "afl" ]]; then
|
| 67 |
+
printf -- "-x %s" "$dict"
|
| 68 |
+
elif [[ "$FUZZING_ENGINE" = "honggfuzz" ]]; then
|
| 69 |
+
printf -- "--dict %s" "$dict"
|
| 70 |
+
elif [[ "$FUZZING_ENGINE" = "centipede" ]]; then
|
| 71 |
+
printf -- "--dictionary %s" "$dict"
|
| 72 |
+
else
|
| 73 |
+
printf "Unexpected FUZZING_ENGINE: $FUZZING_ENGINE, ignoring\n" >&2
|
| 74 |
+
fi
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
function get_extra_binaries() {
|
| 78 |
+
[[ "$FUZZING_ENGINE" != "centipede" ]] && return
|
| 79 |
+
|
| 80 |
+
extra_binaries="$OUT/__centipede_${SANITIZER}/${FUZZER}"
|
| 81 |
+
if compgen -G "$extra_binaries" >> /dev/null; then
|
| 82 |
+
printf -- "--extra_binaries %s" \""$extra_binaries\""
|
| 83 |
+
fi
|
| 84 |
+
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
rm -rf $FUZZER_OUT && mkdir -p $FUZZER_OUT
|
| 88 |
+
|
| 89 |
+
SEED_CORPUS="${FUZZER}_seed_corpus.zip"
|
| 90 |
+
|
| 91 |
+
# TODO: Investigate why this code block is skipped
|
| 92 |
+
# by all default fuzzers in bad_build_check.
|
| 93 |
+
# They all set SKIP_SEED_CORPUS=1.
|
| 94 |
+
if [ -f $SEED_CORPUS ] && [ -z ${SKIP_SEED_CORPUS:-} ]; then
|
| 95 |
+
echo "Using seed corpus: $SEED_CORPUS"
|
| 96 |
+
unzip -o -d ${CORPUS_DIR}/ $SEED_CORPUS > /dev/null
|
| 97 |
+
fi
|
| 98 |
+
|
| 99 |
+
OPTIONS_FILE="${FUZZER}.options"
|
| 100 |
+
CUSTOM_LIBFUZZER_OPTIONS=""
|
| 101 |
+
|
| 102 |
+
if [ -f $OPTIONS_FILE ]; then
|
| 103 |
+
custom_asan_options=$(parse_options.py $OPTIONS_FILE asan)
|
| 104 |
+
if [ ! -z $custom_asan_options ]; then
|
| 105 |
+
export ASAN_OPTIONS="$ASAN_OPTIONS:$custom_asan_options"
|
| 106 |
+
fi
|
| 107 |
+
|
| 108 |
+
custom_msan_options=$(parse_options.py $OPTIONS_FILE msan)
|
| 109 |
+
if [ ! -z $custom_msan_options ]; then
|
| 110 |
+
export MSAN_OPTIONS="$MSAN_OPTIONS:$custom_msan_options"
|
| 111 |
+
fi
|
| 112 |
+
|
| 113 |
+
custom_ubsan_options=$(parse_options.py $OPTIONS_FILE ubsan)
|
| 114 |
+
if [ ! -z $custom_ubsan_options ]; then
|
| 115 |
+
export UBSAN_OPTIONS="$UBSAN_OPTIONS:$custom_ubsan_options"
|
| 116 |
+
fi
|
| 117 |
+
|
| 118 |
+
CUSTOM_LIBFUZZER_OPTIONS=$(parse_options.py $OPTIONS_FILE libfuzzer)
|
| 119 |
+
fi
|
| 120 |
+
|
| 121 |
+
if [[ "$FUZZING_ENGINE" = afl ]]; then
|
| 122 |
+
|
| 123 |
+
# Set afl++ environment options.
|
| 124 |
+
export ASAN_OPTIONS="$ASAN_OPTIONS:abort_on_error=1:symbolize=0:detect_odr_violation=0:"
|
| 125 |
+
export MSAN_OPTIONS="$MSAN_OPTIONS:exit_code=86:symbolize=0"
|
| 126 |
+
export UBSAN_OPTIONS="$UBSAN_OPTIONS:symbolize=0"
|
| 127 |
+
export AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1
|
| 128 |
+
export AFL_SKIP_CPUFREQ=1
|
| 129 |
+
export AFL_TRY_AFFINITY=1
|
| 130 |
+
export AFL_FAST_CAL=1
|
| 131 |
+
export AFL_CMPLOG_ONLY_NEW=1
|
| 132 |
+
export AFL_FORKSRV_INIT_TMOUT=30000
|
| 133 |
+
export AFL_IGNORE_PROBLEMS=1
|
| 134 |
+
export AFL_IGNORE_UNKNOWN_ENVS=1
|
| 135 |
+
|
| 136 |
+
# If $OUT/afl_cmplog.txt is present this means the target was compiled for
|
| 137 |
+
# CMPLOG. So we have to add the proper parameters to afl-fuzz.
|
| 138 |
+
test -e "$OUT/afl_cmplog.txt" && AFL_FUZZER_ARGS="$AFL_FUZZER_ARGS -c $OUT/$FUZZER"
|
| 139 |
+
|
| 140 |
+
# If $OUT/afl++.dict we load it as a dictionary for afl-fuzz.
|
| 141 |
+
test -e "$OUT/afl++.dict" && AFL_FUZZER_ARGS="$AFL_FUZZER_ARGS -x $OUT/afl++.dict"
|
| 142 |
+
|
| 143 |
+
# Ensure timeout is a bit larger than 1sec as some of the OSS-Fuzz fuzzers
|
| 144 |
+
# are slower than this.
|
| 145 |
+
AFL_FUZZER_ARGS="$AFL_FUZZER_ARGS -t 5000+"
|
| 146 |
+
|
| 147 |
+
# AFL expects at least 1 file in the input dir.
|
| 148 |
+
echo input > ${CORPUS_DIR}/input
|
| 149 |
+
|
| 150 |
+
CMD_LINE="$OUT/afl-fuzz $AFL_FUZZER_ARGS -i $CORPUS_DIR -o $FUZZER_OUT $(get_dictionary) $* -- $OUT/$FUZZER"
|
| 151 |
+
|
| 152 |
+
echo afl++ setup:
|
| 153 |
+
env|grep AFL_
|
| 154 |
+
cat "$OUT/afl_options.txt"
|
| 155 |
+
|
| 156 |
+
elif [[ "$FUZZING_ENGINE" = honggfuzz ]]; then
|
| 157 |
+
|
| 158 |
+
# Honggfuzz expects at least 1 file in the input dir.
|
| 159 |
+
echo input > $CORPUS_DIR/input
|
| 160 |
+
# --exit_upon_crash: exit whith a first crash seen
|
| 161 |
+
# -V: verify crashes
|
| 162 |
+
# -R (report): save report file to this location
|
| 163 |
+
# -W (working dir): where the crashes go
|
| 164 |
+
# -v (verbose): don't use VTE UI, just stderr
|
| 165 |
+
# -z: use software-instrumentation of clang (trace-pc-guard....)
|
| 166 |
+
# -P: use persistent mode of fuzzing (i.e. LLVMFuzzerTestOneInput)
|
| 167 |
+
# -f: location of the initial (and destination) file corpus
|
| 168 |
+
# -n: number of fuzzing threads (and processes)
|
| 169 |
+
CMD_LINE="$OUT/honggfuzz -n 1 --exit_upon_crash -V -R /tmp/${FUZZER}_honggfuzz.report -W $FUZZER_OUT -v -z -P -f \"$CORPUS_DIR\" $(get_dictionary) $* -- \"$OUT/$FUZZER\""
|
| 170 |
+
|
| 171 |
+
if [[ $(LC_ALL=C grep -P "\x01_LIBHFUZZ_NETDRIVER_BINARY_SIGNATURE_\x02\xFF" "$FUZZER" ) ]]; then
|
| 172 |
+
# Honggfuzz Netdriver port. This must match the port in Clusterfuzz.
|
| 173 |
+
export HFND_TCP_PORT=8666
|
| 174 |
+
fi
|
| 175 |
+
elif [[ "$FUZZING_ENGINE" = centipede ]]; then
|
| 176 |
+
|
| 177 |
+
# Create the work and corpus directory for Centipede.
|
| 178 |
+
CENTIPEDE_WORKDIR="${CENTIPEDE_WORKDIR:-$OUT}"
|
| 179 |
+
|
| 180 |
+
# Centipede only saves crashes to crashes/ in workdir.
|
| 181 |
+
rm -rf $FUZZER_OUT
|
| 182 |
+
|
| 183 |
+
# --workdir: Dir that stores corpus&features in Centipede's own format.
|
| 184 |
+
# --corpus_dir: Location of the initial (and destination) file corpus.
|
| 185 |
+
# --fork_server: Execute the target(s) via the fork server.
|
| 186 |
+
# Run in fork mode to continue fuzzing indefinitely in case of
|
| 187 |
+
# OOMs, timeouts, and crashes.
|
| 188 |
+
# --exit_on_crash=0: Do not exit on crash.
|
| 189 |
+
# --timeout=1200: The process that executes target binary will abort
|
| 190 |
+
# if an input runs >= 1200s.
|
| 191 |
+
# --rss_limit_mb=0: Disable RSS limit.
|
| 192 |
+
# --address_space_limit_mb=0: No address space limit.
|
| 193 |
+
# --binary: The target binary under test without sanitizer.
|
| 194 |
+
# --extra_binary: The target binaries under test with sanitizers.
|
| 195 |
+
CMD_LINE="$OUT/centipede --workdir=$CENTIPEDE_WORKDIR --corpus_dir=\"$CORPUS_DIR\" --fork_server=1 --exit_on_crash=1 --timeout=1200 --rss_limit_mb=4096 --address_space_limit_mb=5120 $(get_dictionary) --binary=\"$OUT/${FUZZER}\" $(get_extra_binaries) $*"
|
| 196 |
+
else
|
| 197 |
+
|
| 198 |
+
CMD_LINE="$OUT/$FUZZER $FUZZER_ARGS $*"
|
| 199 |
+
|
| 200 |
+
if [ -z ${SKIP_SEED_CORPUS:-} ]; then
|
| 201 |
+
CMD_LINE="$CMD_LINE $CORPUS_DIR"
|
| 202 |
+
fi
|
| 203 |
+
|
| 204 |
+
if [[ ! -z ${CUSTOM_LIBFUZZER_OPTIONS} ]]; then
|
| 205 |
+
CMD_LINE="$CMD_LINE $CUSTOM_LIBFUZZER_OPTIONS"
|
| 206 |
+
fi
|
| 207 |
+
|
| 208 |
+
if [[ ! "$CMD_LINE" =~ "-dict=" ]]; then
|
| 209 |
+
if [ -f "$FUZZER.dict" ]; then
|
| 210 |
+
CMD_LINE="$CMD_LINE -dict=$FUZZER.dict"
|
| 211 |
+
fi
|
| 212 |
+
fi
|
| 213 |
+
|
| 214 |
+
CMD_LINE="$CMD_LINE < /dev/null"
|
| 215 |
+
|
| 216 |
+
fi
|
| 217 |
+
|
| 218 |
+
echo $CMD_LINE
|
| 219 |
+
|
| 220 |
+
# Unset OUT so the fuzz target can't rely on it.
|
| 221 |
+
unset OUT
|
| 222 |
+
|
| 223 |
+
if [ ! -z "$DEBUGGER" ]; then
|
| 224 |
+
CMD_LINE="$DEBUGGER $CMD_LINE"
|
| 225 |
+
fi
|
| 226 |
+
|
| 227 |
+
bash -c "$CMD_LINE"
|
| 228 |
+
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/actions/run_fuzzers/action.yml
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# action.yml
|
| 2 |
+
name: 'run-fuzzers'
|
| 3 |
+
description: 'Runs fuzz target binaries for a specified length of time.'
|
| 4 |
+
inputs:
|
| 5 |
+
oss-fuzz-project-name:
|
| 6 |
+
description: 'The OSS-Fuzz project name.'
|
| 7 |
+
required: true
|
| 8 |
+
language:
|
| 9 |
+
description: 'Programming language project is written in.'
|
| 10 |
+
required: false
|
| 11 |
+
default: 'c++'
|
| 12 |
+
fuzz-seconds:
|
| 13 |
+
description: 'The total time allotted for fuzzing in seconds.'
|
| 14 |
+
required: true
|
| 15 |
+
default: 600
|
| 16 |
+
dry-run:
|
| 17 |
+
description: 'If set, run the action without actually reporting a failure.'
|
| 18 |
+
default: false
|
| 19 |
+
sanitizer:
|
| 20 |
+
description: 'The sanitizer to run the fuzzers with.'
|
| 21 |
+
default: 'address'
|
| 22 |
+
mode:
|
| 23 |
+
description: |
|
| 24 |
+
The mode to run the fuzzers with ("code-change", "batch", "coverage", or "prune").
|
| 25 |
+
"code-change" is for fuzzing a pull request or commit.
|
| 26 |
+
"batch" is for non-interactive fuzzing of an entire project.
|
| 27 |
+
"coverage" is for coverage generation.
|
| 28 |
+
"prune" is for corpus pruning.
|
| 29 |
+
required: false
|
| 30 |
+
default: 'code-change'
|
| 31 |
+
github-token:
|
| 32 |
+
description: |
|
| 33 |
+
Token for GitHub API. WARNING: THIS SHOULD NOT BE USED IN PRODUCTION YET
|
| 34 |
+
You should use "secrets.GITHUB_TOKEN" in your workflow file, do not
|
| 35 |
+
hardcode the token.
|
| 36 |
+
TODO(https://github.com/google/oss-fuzz/pull/5841#discussion_r639393361):
|
| 37 |
+
Document locking this down.
|
| 38 |
+
required: false
|
| 39 |
+
report-unreproducible-crashes:
|
| 40 |
+
description: 'If True, then unreproducible crashes will be reported.'
|
| 41 |
+
required: false
|
| 42 |
+
default: False
|
| 43 |
+
minimize-crashes:
|
| 44 |
+
description: 'If True, reportable crashes will be minimized.'
|
| 45 |
+
required: false
|
| 46 |
+
default: False
|
| 47 |
+
parallel-fuzzing:
|
| 48 |
+
description: "Whether to use all available cores for fuzzing."
|
| 49 |
+
required: false
|
| 50 |
+
default: false
|
| 51 |
+
output-sarif:
|
| 52 |
+
description: "Whether to output fuzzing results to SARIF."
|
| 53 |
+
required: false
|
| 54 |
+
default: false
|
| 55 |
+
report-timeouts:
|
| 56 |
+
description: "Whether to report fails due to timeout."
|
| 57 |
+
required: false
|
| 58 |
+
default: true
|
| 59 |
+
report-ooms:
|
| 60 |
+
description: "Whether to report fails due to OOM."
|
| 61 |
+
required: false
|
| 62 |
+
default: true
|
| 63 |
+
runs:
|
| 64 |
+
using: 'docker'
|
| 65 |
+
image: '../../../run_fuzzers.Dockerfile'
|
| 66 |
+
env:
|
| 67 |
+
OSS_FUZZ_PROJECT_NAME: ${{ inputs.oss-fuzz-project-name }}
|
| 68 |
+
LANGUAGE: ${{ inputs.language }}
|
| 69 |
+
FUZZ_SECONDS: ${{ inputs.fuzz-seconds }}
|
| 70 |
+
DRY_RUN: ${{ inputs.dry-run}}
|
| 71 |
+
SANITIZER: ${{ inputs.sanitizer }}
|
| 72 |
+
MODE: ${{ inputs.mode }}
|
| 73 |
+
GITHUB_TOKEN: ${{ inputs.github-token }}
|
| 74 |
+
LOW_DISK_SPACE: 'True'
|
| 75 |
+
REPORT_UNREPRODUCIBLE_CRASHES: ${{ inputs.report-unreproducible-crashes }}
|
| 76 |
+
MINIMIZE_CRASHES: ${{ inputs.minimize-crashes }}
|
| 77 |
+
CIFUZZ_DEBUG: 'True'
|
| 78 |
+
CFL_PLATFORM: 'github'
|
| 79 |
+
PARALLEL_FUZZING: ${{ inputs.parallel-fuzzing }}
|
| 80 |
+
OUTPUT_SARIF: ${{ inputs.output-sarif }}
|
| 81 |
+
REPORT_TIMEOUTS: ${{ inputs.report-timeouts }}
|
| 82 |
+
REPORT_OOMS: ${{ inputs.report-ooms}}
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/external-actions/build_fuzzers/action.yml
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# action.yml
|
| 2 |
+
name: 'build-fuzzers'
|
| 3 |
+
description: "Builds an OSS-Fuzz project's fuzzers."
|
| 4 |
+
inputs:
|
| 5 |
+
language:
|
| 6 |
+
description: 'Programming language project is written in.'
|
| 7 |
+
required: false
|
| 8 |
+
default: 'c++'
|
| 9 |
+
dry-run:
|
| 10 |
+
description: 'If set, run the action without actually reporting a failure.'
|
| 11 |
+
default: false
|
| 12 |
+
allowed-broken-targets-percentage:
|
| 13 |
+
description: 'The percentage of broken targets allowed in bad_build_check.'
|
| 14 |
+
required: false
|
| 15 |
+
sanitizer:
|
| 16 |
+
description: 'The sanitizer to build the fuzzers with.'
|
| 17 |
+
default: 'address'
|
| 18 |
+
project-src-path:
|
| 19 |
+
description: "The path to the project's source code checkout."
|
| 20 |
+
required: false
|
| 21 |
+
bad-build-check:
|
| 22 |
+
description: "Whether or not OSS-Fuzz's check for bad builds should be done."
|
| 23 |
+
required: false
|
| 24 |
+
default: true
|
| 25 |
+
keep-unaffected-fuzz-targets:
|
| 26 |
+
description: "Whether to keep unaffected fuzzers or delete them."
|
| 27 |
+
required: false
|
| 28 |
+
default: false
|
| 29 |
+
storage-repo:
|
| 30 |
+
description: |
|
| 31 |
+
The git repo to use for storing certain artifacts from fuzzing.
|
| 32 |
+
required: false
|
| 33 |
+
storage-repo-branch:
|
| 34 |
+
description: |
|
| 35 |
+
The branch of the git repo to use for storing certain artifacts from
|
| 36 |
+
fuzzing.
|
| 37 |
+
required: false
|
| 38 |
+
storage-repo-branch-coverage:
|
| 39 |
+
description: |
|
| 40 |
+
The branch of the git repo to use for storing coverage reports.
|
| 41 |
+
required: false
|
| 42 |
+
upload-build:
|
| 43 |
+
description: |
|
| 44 |
+
If set, will upload the build.
|
| 45 |
+
default: false
|
| 46 |
+
github-token:
|
| 47 |
+
description: |
|
| 48 |
+
Token for GitHub API. WARNING: THIS SHOULD NOT BE USED IN PRODUCTION YET
|
| 49 |
+
You should use "secrets.GITHUB_TOKEN" in your workflow file, do not
|
| 50 |
+
hardcode the token.
|
| 51 |
+
TODO(https://github.com/google/oss-fuzz/pull/5841#discussion_r639393361):
|
| 52 |
+
Document locking this down.
|
| 53 |
+
required: false
|
| 54 |
+
output-sarif:
|
| 55 |
+
description: "Whether to output fuzzing results to SARIF."
|
| 56 |
+
required: false
|
| 57 |
+
default: false
|
| 58 |
+
runs:
|
| 59 |
+
using: 'docker'
|
| 60 |
+
image: '../../../build_fuzzers.Dockerfile'
|
| 61 |
+
env:
|
| 62 |
+
OSS_FUZZ_PROJECT_NAME: ${{ inputs.oss-fuzz-project-name }}
|
| 63 |
+
LANGUAGE: ${{ inputs.language }}
|
| 64 |
+
DRY_RUN: ${{ inputs.dry-run}}
|
| 65 |
+
ALLOWED_BROKEN_TARGETS_PERCENTAGE: ${{ inputs.allowed-broken-targets-percentage}}
|
| 66 |
+
SANITIZER: ${{ inputs.sanitizer }}
|
| 67 |
+
PROJECT_SRC_PATH: ${{ inputs.project-src-path }}
|
| 68 |
+
GITHUB_TOKEN: ${{ inputs.github-token }}
|
| 69 |
+
LOW_DISK_SPACE: 'True'
|
| 70 |
+
BAD_BUILD_CHECK: ${{ inputs.bad-build-check }}
|
| 71 |
+
UPLOAD_BUILD: ${{ inputs.upload-build }}
|
| 72 |
+
CIFUZZ_DEBUG: 'True'
|
| 73 |
+
CFL_PLATFORM: 'github'
|
| 74 |
+
KEEP_UNAFFECTED_FUZZ_TARGETS: ${{ inputs.keep-unaffected-fuzz-targets }}
|
| 75 |
+
OUTPUT_SARIF: ${{ inputs.output-sarif }}
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/external-actions/run_fuzzers/action.yml
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# action.yml
|
| 2 |
+
name: 'run-fuzzers'
|
| 3 |
+
description: 'Runs fuzz target binaries for a specified length of time.'
|
| 4 |
+
inputs:
|
| 5 |
+
language:
|
| 6 |
+
description: 'Programming language project is written in.'
|
| 7 |
+
required: false
|
| 8 |
+
default: 'c++'
|
| 9 |
+
fuzz-seconds:
|
| 10 |
+
description: 'The total time allotted for fuzzing in seconds.'
|
| 11 |
+
required: true
|
| 12 |
+
default: 600
|
| 13 |
+
dry-run:
|
| 14 |
+
description: 'If set, run the action without actually reporting a failure.'
|
| 15 |
+
default: false
|
| 16 |
+
sanitizer:
|
| 17 |
+
description: 'The sanitizer to run the fuzzers with.'
|
| 18 |
+
default: 'address'
|
| 19 |
+
mode:
|
| 20 |
+
description: |
|
| 21 |
+
The mode to run the fuzzers with ("code-change", "batch", "coverage", or "prune").
|
| 22 |
+
"code-change" is for fuzzing a pull request or commit.
|
| 23 |
+
"batch" is for non-interactive fuzzing of an entire project.
|
| 24 |
+
"coverage" is for coverage generation.
|
| 25 |
+
"prune" is for corpus pruning.
|
| 26 |
+
required: false
|
| 27 |
+
default: 'code-change'
|
| 28 |
+
github-token:
|
| 29 |
+
description: |
|
| 30 |
+
Token for GitHub API. WARNING: THIS SHOULD NOT BE USED IN PRODUCTION YET
|
| 31 |
+
You should use "secrets.GITHUB_TOKEN" in your workflow file, do not
|
| 32 |
+
hardcode the token.
|
| 33 |
+
TODO(https://github.com/google/oss-fuzz/pull/5841#discussion_r639393361):
|
| 34 |
+
Document locking this down.
|
| 35 |
+
required: true
|
| 36 |
+
storage-repo:
|
| 37 |
+
description: |
|
| 38 |
+
The git repo to use for storing certain artifacts from fuzzing.
|
| 39 |
+
required: false
|
| 40 |
+
storage-repo-branch:
|
| 41 |
+
description: |
|
| 42 |
+
The branch of the git repo to use for storing certain artifacts from
|
| 43 |
+
fuzzing.
|
| 44 |
+
default: main
|
| 45 |
+
required: false
|
| 46 |
+
storage-repo-branch-coverage:
|
| 47 |
+
description: |
|
| 48 |
+
The branch of the git repo to use for storing coverage reports.
|
| 49 |
+
default: gh-pages
|
| 50 |
+
required: false
|
| 51 |
+
report-unreproducible-crashes:
|
| 52 |
+
description: 'If True, then unreproducible crashes will be reported.'
|
| 53 |
+
required: false
|
| 54 |
+
default: false
|
| 55 |
+
minimize-crashes:
|
| 56 |
+
description: 'If True, reportable crashes will be minimized.'
|
| 57 |
+
required: false
|
| 58 |
+
default: False
|
| 59 |
+
parallel-fuzzing:
|
| 60 |
+
description: "Whether to use all available cores for fuzzing."
|
| 61 |
+
required: false
|
| 62 |
+
default: false
|
| 63 |
+
output-sarif:
|
| 64 |
+
description: "Whether to output fuzzing results to SARIF."
|
| 65 |
+
required: false
|
| 66 |
+
default: false
|
| 67 |
+
report-timeouts:
|
| 68 |
+
description: "Whether to report fails due to timeout."
|
| 69 |
+
required: false
|
| 70 |
+
default: true
|
| 71 |
+
report-ooms:
|
| 72 |
+
description: "Whether to report fails due to OOM."
|
| 73 |
+
required: false
|
| 74 |
+
default: true
|
| 75 |
+
runs:
|
| 76 |
+
using: 'docker'
|
| 77 |
+
image: '../../../run_fuzzers.Dockerfile'
|
| 78 |
+
env:
|
| 79 |
+
OSS_FUZZ_PROJECT_NAME: ${{ inputs.oss-fuzz-project-name }}
|
| 80 |
+
LANGUAGE: ${{ inputs.language }}
|
| 81 |
+
FUZZ_SECONDS: ${{ inputs.fuzz-seconds }}
|
| 82 |
+
DRY_RUN: ${{ inputs.dry-run}}
|
| 83 |
+
SANITIZER: ${{ inputs.sanitizer }}
|
| 84 |
+
MODE: ${{ inputs.mode }}
|
| 85 |
+
GITHUB_TOKEN: ${{ inputs.github-token }}
|
| 86 |
+
LOW_DISK_SPACE: 'True'
|
| 87 |
+
GIT_STORE_REPO: ${{ inputs.storage-repo }}
|
| 88 |
+
GIT_STORE_BRANCH: ${{ inputs.storage-repo-branch }}
|
| 89 |
+
GIT_STORE_BRANCH_COVERAGE: ${{ inputs.storage-repo-branch-coverage }}
|
| 90 |
+
REPORT_UNREPRODUCIBLE_CRASHES: ${{ inputs.report-unreproducible-crashes }}
|
| 91 |
+
MINIMIZE_CRASHES: ${{ inputs.minimize-crashes }}
|
| 92 |
+
CIFUZZ_DEBUG: 'True'
|
| 93 |
+
CFL_PLATFORM: 'github'
|
| 94 |
+
PARALLEL_FUZZING: ${{ inputs.parallel-fuzzing }}
|
| 95 |
+
OUTPUT_SARIF: ${{ inputs.output-sarif }}
|
| 96 |
+
REPORT_TIMEOUTS: ${{ inputs.report-timeouts }}
|
| 97 |
+
REPORT_OOMS: ${{ inputs.report-ooms}}
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/__init__.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Module for a generic filestore."""
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class FilestoreError(Exception):
|
| 18 |
+
"""Error using the filestore."""
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# pylint: disable=unused-argument,no-self-use
|
| 22 |
+
class BaseFilestore:
|
| 23 |
+
"""Base class for a filestore."""
|
| 24 |
+
|
| 25 |
+
def __init__(self, config):
|
| 26 |
+
self.config = config
|
| 27 |
+
|
| 28 |
+
def upload_crashes(self, name, directory):
|
| 29 |
+
"""Uploads the crashes at |directory| to |name|."""
|
| 30 |
+
raise NotImplementedError('Child class must implement method.')
|
| 31 |
+
|
| 32 |
+
def upload_corpus(self, name, directory, replace=False):
|
| 33 |
+
"""Uploads the corpus at |directory| to |name|."""
|
| 34 |
+
raise NotImplementedError('Child class must implement method.')
|
| 35 |
+
|
| 36 |
+
def upload_build(self, name, directory):
|
| 37 |
+
"""Uploads the build at |directory| to |name|."""
|
| 38 |
+
raise NotImplementedError('Child class must implement method.')
|
| 39 |
+
|
| 40 |
+
def upload_coverage(self, name, directory):
|
| 41 |
+
"""Uploads the coverage report at |directory| to |name|."""
|
| 42 |
+
raise NotImplementedError('Child class must implement method.')
|
| 43 |
+
|
| 44 |
+
def download_corpus(self, name, dst_directory):
|
| 45 |
+
"""Downloads the corpus located at |name| to |dst_directory|."""
|
| 46 |
+
raise NotImplementedError('Child class must implement method.')
|
| 47 |
+
|
| 48 |
+
def download_build(self, name, dst_directory):
|
| 49 |
+
"""Downloads the build with |name| to |dst_directory|."""
|
| 50 |
+
raise NotImplementedError('Child class must implement method.')
|
| 51 |
+
|
| 52 |
+
def download_coverage(self, name, dst_directory):
|
| 53 |
+
"""Downloads the latest project coverage report."""
|
| 54 |
+
raise NotImplementedError('Child class must implement method.')
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/git/__init__.py
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Module for a git based filestore."""
|
| 15 |
+
|
| 16 |
+
import logging
|
| 17 |
+
import os
|
| 18 |
+
import shutil
|
| 19 |
+
import subprocess
|
| 20 |
+
import sys
|
| 21 |
+
import tempfile
|
| 22 |
+
|
| 23 |
+
import filestore
|
| 24 |
+
|
| 25 |
+
# pylint: disable=wrong-import-position
|
| 26 |
+
INFRA_DIR = os.path.dirname(
|
| 27 |
+
os.path.dirname(os.path.dirname(os.path.dirname(
|
| 28 |
+
os.path.abspath(__file__)))))
|
| 29 |
+
sys.path.append(INFRA_DIR)
|
| 30 |
+
|
| 31 |
+
import retry
|
| 32 |
+
|
| 33 |
+
_PUSH_RETRIES = 3
|
| 34 |
+
_PUSH_BACKOFF = 1
|
| 35 |
+
_GIT_EMAIL = 'cifuzz@clusterfuzz.com'
|
| 36 |
+
_GIT_NAME = 'CIFuzz'
|
| 37 |
+
_CORPUS_DIR = 'corpus'
|
| 38 |
+
_COVERAGE_DIR = 'coverage'
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def git_runner(repo_path):
|
| 42 |
+
"""Returns a gits runner for the repo_path."""
|
| 43 |
+
|
| 44 |
+
def func(*args):
|
| 45 |
+
return subprocess.check_call(('git', '-C', repo_path) + args)
|
| 46 |
+
|
| 47 |
+
return func
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
# pylint: disable=unused-argument,no-self-use
|
| 51 |
+
class GitFilestore(filestore.BaseFilestore):
|
| 52 |
+
"""Generic git filestore. This still relies on another filestore provided by
|
| 53 |
+
the CI for larger artifacts or artifacts which make sense to be included as
|
| 54 |
+
the result of a workflow run."""
|
| 55 |
+
|
| 56 |
+
def __init__(self, config, ci_filestore):
|
| 57 |
+
super().__init__(config)
|
| 58 |
+
self.repo_path = tempfile.mkdtemp()
|
| 59 |
+
self._git = git_runner(self.repo_path)
|
| 60 |
+
self._clone(self.config.git_store_repo)
|
| 61 |
+
|
| 62 |
+
self._ci_filestore = ci_filestore
|
| 63 |
+
|
| 64 |
+
def __del__(self):
|
| 65 |
+
shutil.rmtree(self.repo_path)
|
| 66 |
+
|
| 67 |
+
def _clone(self, repo_url):
|
| 68 |
+
"""Clones repo URL."""
|
| 69 |
+
self._git('clone', repo_url, '.')
|
| 70 |
+
self._git('config', '--local', 'user.email', _GIT_EMAIL)
|
| 71 |
+
self._git('config', '--local', 'user.name', _GIT_NAME)
|
| 72 |
+
|
| 73 |
+
def _reset_git(self, branch):
|
| 74 |
+
"""Resets the git repo."""
|
| 75 |
+
self._git('fetch', 'origin')
|
| 76 |
+
try:
|
| 77 |
+
self._git('checkout', '-B', branch, 'origin/' + branch)
|
| 78 |
+
self._git('reset', '--hard', 'HEAD')
|
| 79 |
+
except subprocess.CalledProcessError:
|
| 80 |
+
self._git('checkout', '--orphan', branch)
|
| 81 |
+
|
| 82 |
+
self._git('clean', '-fxd')
|
| 83 |
+
|
| 84 |
+
# pylint: disable=too-many-arguments
|
| 85 |
+
@retry.wrap(_PUSH_RETRIES, _PUSH_BACKOFF)
|
| 86 |
+
def _upload_to_git(self,
|
| 87 |
+
message,
|
| 88 |
+
branch,
|
| 89 |
+
upload_path,
|
| 90 |
+
local_path,
|
| 91 |
+
replace=False):
|
| 92 |
+
"""Uploads a directory to git. If `replace` is True, then existing contents
|
| 93 |
+
in the upload_path is deleted."""
|
| 94 |
+
self._reset_git(branch)
|
| 95 |
+
|
| 96 |
+
full_repo_path = os.path.join(self.repo_path, upload_path)
|
| 97 |
+
if replace and os.path.exists(full_repo_path):
|
| 98 |
+
shutil.rmtree(full_repo_path)
|
| 99 |
+
|
| 100 |
+
shutil.copytree(local_path, full_repo_path, dirs_exist_ok=True)
|
| 101 |
+
self._git('add', '.')
|
| 102 |
+
try:
|
| 103 |
+
self._git('commit', '-m', message)
|
| 104 |
+
except subprocess.CalledProcessError:
|
| 105 |
+
logging.debug('No changes, skipping git push.')
|
| 106 |
+
return
|
| 107 |
+
|
| 108 |
+
self._git('push', 'origin', branch)
|
| 109 |
+
|
| 110 |
+
def upload_crashes(self, name, directory):
|
| 111 |
+
"""Uploads the crashes at |directory| to |name|."""
|
| 112 |
+
return self._ci_filestore.upload_crashes(name, directory)
|
| 113 |
+
|
| 114 |
+
def upload_corpus(self, name, directory, replace=False):
|
| 115 |
+
"""Uploads the corpus at |directory| to |name|."""
|
| 116 |
+
self._upload_to_git('Corpus upload',
|
| 117 |
+
self.config.git_store_branch,
|
| 118 |
+
os.path.join(_CORPUS_DIR, name),
|
| 119 |
+
directory,
|
| 120 |
+
replace=replace)
|
| 121 |
+
|
| 122 |
+
def upload_build(self, name, directory):
|
| 123 |
+
"""Uploads the build at |directory| to |name|."""
|
| 124 |
+
return self._ci_filestore.upload_build(name, directory)
|
| 125 |
+
|
| 126 |
+
def upload_coverage(self, name, directory):
|
| 127 |
+
"""Uploads the coverage report at |directory| to |name|."""
|
| 128 |
+
self._upload_to_git('Coverage upload',
|
| 129 |
+
self.config.git_store_branch_coverage,
|
| 130 |
+
os.path.join(_COVERAGE_DIR, name),
|
| 131 |
+
directory,
|
| 132 |
+
replace=True)
|
| 133 |
+
|
| 134 |
+
def download_corpus(self, name, dst_directory):
|
| 135 |
+
"""Downloads the corpus located at |name| to |dst_directory|."""
|
| 136 |
+
self._reset_git(self.config.git_store_branch)
|
| 137 |
+
path = os.path.join(self.repo_path, _CORPUS_DIR, name)
|
| 138 |
+
if not os.path.exists(path):
|
| 139 |
+
logging.debug('Corpus does not exist at %s.', path)
|
| 140 |
+
return False
|
| 141 |
+
|
| 142 |
+
shutil.copytree(path, dst_directory, dirs_exist_ok=True)
|
| 143 |
+
return True
|
| 144 |
+
|
| 145 |
+
def download_build(self, name, dst_directory):
|
| 146 |
+
"""Downloads the build with |name| to |dst_directory|."""
|
| 147 |
+
return self._ci_filestore.download_build(name, dst_directory)
|
| 148 |
+
|
| 149 |
+
def download_coverage(self, name, dst_directory):
|
| 150 |
+
"""Downloads the latest project coverage report."""
|
| 151 |
+
self._reset_git(self.config.git_store_branch_coverage)
|
| 152 |
+
path = os.path.join(self.repo_path, _COVERAGE_DIR, name)
|
| 153 |
+
if not os.path.exists(path):
|
| 154 |
+
logging.debug('Coverage does not exist at %s.', path)
|
| 155 |
+
return False
|
| 156 |
+
|
| 157 |
+
shutil.copytree(path, dst_directory, dirs_exist_ok=True)
|
| 158 |
+
return True
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/git/git_test.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Tests for git."""
|
| 15 |
+
import filecmp
|
| 16 |
+
import os
|
| 17 |
+
import tempfile
|
| 18 |
+
import subprocess
|
| 19 |
+
import sys
|
| 20 |
+
import unittest
|
| 21 |
+
from unittest import mock
|
| 22 |
+
|
| 23 |
+
# pylint: disable=wrong-import-position
|
| 24 |
+
INFRA_DIR = os.path.dirname(
|
| 25 |
+
os.path.dirname(os.path.dirname(os.path.dirname(
|
| 26 |
+
os.path.abspath(__file__)))))
|
| 27 |
+
sys.path.append(INFRA_DIR)
|
| 28 |
+
|
| 29 |
+
from filestore import git
|
| 30 |
+
import test_helpers
|
| 31 |
+
|
| 32 |
+
# pylint: disable=protected-access,no-self-use
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class GitFilestoreTest(unittest.TestCase):
|
| 36 |
+
"""Tests for GitFilestore."""
|
| 37 |
+
|
| 38 |
+
def setUp(self):
|
| 39 |
+
self.git_dir = tempfile.TemporaryDirectory()
|
| 40 |
+
self.addCleanup(self.git_dir.cleanup)
|
| 41 |
+
|
| 42 |
+
self.local_dir = tempfile.TemporaryDirectory()
|
| 43 |
+
self.addCleanup(self.local_dir.cleanup)
|
| 44 |
+
|
| 45 |
+
self.download_dir = tempfile.TemporaryDirectory()
|
| 46 |
+
self.addCleanup(self.download_dir.cleanup)
|
| 47 |
+
|
| 48 |
+
with open(os.path.join(self.local_dir.name, 'a'), 'w') as handle:
|
| 49 |
+
handle.write('')
|
| 50 |
+
|
| 51 |
+
os.makedirs(os.path.join(self.local_dir.name, 'b'))
|
| 52 |
+
|
| 53 |
+
with open(os.path.join(self.local_dir.name, 'b', 'c'), 'w') as handle:
|
| 54 |
+
handle.write('')
|
| 55 |
+
|
| 56 |
+
self.git_repo = git.git_runner(self.git_dir.name)
|
| 57 |
+
self.git_repo('init', '--bare')
|
| 58 |
+
|
| 59 |
+
self.config = test_helpers.create_run_config(
|
| 60 |
+
git_store_repo='file://' + self.git_dir.name,
|
| 61 |
+
git_store_branch='main',
|
| 62 |
+
git_store_branch_coverage='cov-branch')
|
| 63 |
+
|
| 64 |
+
self.mock_ci_filestore = mock.MagicMock()
|
| 65 |
+
self.git_store = git.GitFilestore(self.config, self.mock_ci_filestore)
|
| 66 |
+
|
| 67 |
+
def assert_dirs_same(self, first, second):
|
| 68 |
+
"""Asserts two dirs are the same."""
|
| 69 |
+
dcmp = filecmp.dircmp(first, second)
|
| 70 |
+
if dcmp.diff_files or dcmp.left_only or dcmp.right_only:
|
| 71 |
+
return False
|
| 72 |
+
|
| 73 |
+
return all(
|
| 74 |
+
self.assert_dirs_same(os.path.join(first, subdir),
|
| 75 |
+
os.path.join(second, subdir))
|
| 76 |
+
for subdir in dcmp.common_dirs)
|
| 77 |
+
|
| 78 |
+
def get_repo_filelist(self, branch):
|
| 79 |
+
"""Get files in repo."""
|
| 80 |
+
return subprocess.check_output([
|
| 81 |
+
'git', '-C', self.git_dir.name, 'ls-tree', '-r', '--name-only', branch
|
| 82 |
+
]).decode().splitlines()
|
| 83 |
+
|
| 84 |
+
def test_upload_download_corpus(self):
|
| 85 |
+
"""Tests uploading and downloading corpus."""
|
| 86 |
+
self.git_store.upload_corpus('target', self.local_dir.name)
|
| 87 |
+
self.git_store.download_corpus('target', self.download_dir.name)
|
| 88 |
+
self.assert_dirs_same(self.local_dir.name, self.download_dir.name)
|
| 89 |
+
|
| 90 |
+
self.assertCountEqual([
|
| 91 |
+
'corpus/target/a',
|
| 92 |
+
'corpus/target/b/c',
|
| 93 |
+
], self.get_repo_filelist('main'))
|
| 94 |
+
|
| 95 |
+
def test_upload_download_coverage(self):
|
| 96 |
+
"""Tests uploading and downloading corpus."""
|
| 97 |
+
self.git_store.upload_coverage('latest', self.local_dir.name)
|
| 98 |
+
self.git_store.download_coverage('latest', self.download_dir.name)
|
| 99 |
+
self.assert_dirs_same(self.local_dir.name, self.download_dir.name)
|
| 100 |
+
|
| 101 |
+
self.assertCountEqual([
|
| 102 |
+
'coverage/latest/a',
|
| 103 |
+
'coverage/latest/b/c',
|
| 104 |
+
], self.get_repo_filelist('cov-branch'))
|
| 105 |
+
|
| 106 |
+
def test_upload_crashes(self):
|
| 107 |
+
"""Tests uploading crashes."""
|
| 108 |
+
self.git_store.upload_crashes('current', self.local_dir.name)
|
| 109 |
+
self.mock_ci_filestore.upload_crashes.assert_called_with(
|
| 110 |
+
'current', self.local_dir.name)
|
| 111 |
+
|
| 112 |
+
def test_upload_build(self):
|
| 113 |
+
"""Tests uploading build."""
|
| 114 |
+
self.git_store.upload_build('sanitizer', self.local_dir.name)
|
| 115 |
+
self.mock_ci_filestore.upload_build.assert_called_with(
|
| 116 |
+
'sanitizer', self.local_dir.name)
|
| 117 |
+
|
| 118 |
+
def test_download_build(self):
|
| 119 |
+
"""Tests downloading build."""
|
| 120 |
+
self.git_store.download_build('sanitizer', self.download_dir.name)
|
| 121 |
+
self.mock_ci_filestore.download_build.assert_called_with(
|
| 122 |
+
'sanitizer', self.download_dir.name)
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_actions_test.py
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Tests for github_actions."""
|
| 15 |
+
import os
|
| 16 |
+
import shutil
|
| 17 |
+
import sys
|
| 18 |
+
import tarfile
|
| 19 |
+
import tempfile
|
| 20 |
+
import unittest
|
| 21 |
+
from unittest import mock
|
| 22 |
+
|
| 23 |
+
from pyfakefs import fake_filesystem_unittest
|
| 24 |
+
|
| 25 |
+
# pylint: disable=wrong-import-position
|
| 26 |
+
INFRA_DIR = os.path.dirname(
|
| 27 |
+
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 28 |
+
sys.path.append(INFRA_DIR)
|
| 29 |
+
|
| 30 |
+
from filestore import github_actions
|
| 31 |
+
import test_helpers
|
| 32 |
+
|
| 33 |
+
# pylint: disable=protected-access,no-self-use
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class GithubActionsFilestoreTest(fake_filesystem_unittest.TestCase):
|
| 37 |
+
"""Tests for GithubActionsFilestore."""
|
| 38 |
+
|
| 39 |
+
@mock.patch('platform_config.github._get_event_data', return_value={})
|
| 40 |
+
def setUp(self, _): # pylint: disable=arguments-differ
|
| 41 |
+
test_helpers.patch_environ(self)
|
| 42 |
+
self.token = 'example githubtoken'
|
| 43 |
+
self.owner = 'exampleowner'
|
| 44 |
+
self.repo = 'examplerepo'
|
| 45 |
+
os.environ['GITHUB_REPOSITORY'] = f'{self.owner}/{self.repo}'
|
| 46 |
+
os.environ['GITHUB_EVENT_PATH'] = '/fake'
|
| 47 |
+
os.environ['CFL_PLATFORM'] = 'github'
|
| 48 |
+
os.environ['GITHUB_WORKSPACE'] = '/workspace'
|
| 49 |
+
self.config = test_helpers.create_run_config(token=self.token)
|
| 50 |
+
self.local_dir = '/local-dir'
|
| 51 |
+
self.testcase = os.path.join(self.local_dir, 'testcase')
|
| 52 |
+
|
| 53 |
+
def _get_expected_http_headers(self):
|
| 54 |
+
return {
|
| 55 |
+
'Authorization': f'token {self.token}',
|
| 56 |
+
'Accept': 'application/vnd.github.v3+json',
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
@mock.patch('filestore.github_actions.github_api.list_artifacts')
|
| 60 |
+
def test_list_artifacts(self, mock_list_artifacts):
|
| 61 |
+
"""Tests that _list_artifacts works as intended."""
|
| 62 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 63 |
+
filestore._list_artifacts()
|
| 64 |
+
mock_list_artifacts.assert_called_with(self.owner, self.repo,
|
| 65 |
+
self._get_expected_http_headers())
|
| 66 |
+
|
| 67 |
+
@mock.patch('logging.warning')
|
| 68 |
+
@mock.patch('filestore.github_actions.GithubActionsFilestore._list_artifacts',
|
| 69 |
+
return_value=None)
|
| 70 |
+
@mock.patch('filestore.github_actions.github_api.find_artifact',
|
| 71 |
+
return_value=None)
|
| 72 |
+
def test_download_build_no_artifact(self, _, __, mock_warning):
|
| 73 |
+
"""Tests that download_build returns None and doesn't exception when
|
| 74 |
+
find_artifact can't find an artifact."""
|
| 75 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 76 |
+
name = 'name'
|
| 77 |
+
build_dir = 'build-dir'
|
| 78 |
+
self.assertFalse(filestore.download_build(name, build_dir))
|
| 79 |
+
mock_warning.assert_called_with('Could not download artifact: %s.',
|
| 80 |
+
'cifuzz-build-' + name)
|
| 81 |
+
|
| 82 |
+
@mock.patch('logging.warning')
|
| 83 |
+
@mock.patch('filestore.github_actions.GithubActionsFilestore._list_artifacts',
|
| 84 |
+
return_value=None)
|
| 85 |
+
@mock.patch('filestore.github_actions.github_api.find_artifact',
|
| 86 |
+
return_value=None)
|
| 87 |
+
def test_download_corpus_no_artifact(self, _, __, mock_warning):
|
| 88 |
+
"""Tests that download_corpus_build returns None and doesn't exception when
|
| 89 |
+
find_artifact can't find an artifact."""
|
| 90 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 91 |
+
name = 'name'
|
| 92 |
+
dst_dir = 'local-dir'
|
| 93 |
+
self.assertFalse(filestore.download_corpus(name, dst_dir))
|
| 94 |
+
mock_warning.assert_called_with('Could not download artifact: %s.',
|
| 95 |
+
'cifuzz-corpus-' + name)
|
| 96 |
+
|
| 97 |
+
@mock.patch('filestore.github_actions.tar_directory')
|
| 98 |
+
@mock.patch('filestore.github_actions._upload_artifact_with_upload_js')
|
| 99 |
+
def test_upload_corpus(self, mock_upload_artifact, mock_tar_directory):
|
| 100 |
+
"""Test uploading corpus."""
|
| 101 |
+
self._create_local_dir()
|
| 102 |
+
|
| 103 |
+
def mock_tar_directory_impl(_, archive_path):
|
| 104 |
+
self.fs.create_file(archive_path)
|
| 105 |
+
|
| 106 |
+
mock_tar_directory.side_effect = mock_tar_directory_impl
|
| 107 |
+
|
| 108 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 109 |
+
filestore.upload_corpus('target', self.local_dir)
|
| 110 |
+
self.assert_upload(mock_upload_artifact, mock_tar_directory,
|
| 111 |
+
'corpus-target')
|
| 112 |
+
|
| 113 |
+
@mock.patch('filestore.github_actions._upload_artifact_with_upload_js')
|
| 114 |
+
def test_upload_crashes(self, mock_upload_artifact):
|
| 115 |
+
"""Test uploading crashes."""
|
| 116 |
+
self._create_local_dir()
|
| 117 |
+
|
| 118 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 119 |
+
filestore.upload_crashes('current', self.local_dir)
|
| 120 |
+
mock_upload_artifact.assert_has_calls(
|
| 121 |
+
[mock.call('crashes-current', ['/local-dir/testcase'], '/local-dir')])
|
| 122 |
+
|
| 123 |
+
@mock.patch('filestore.github_actions.tar_directory')
|
| 124 |
+
@mock.patch('filestore.github_actions._upload_artifact_with_upload_js')
|
| 125 |
+
def test_upload_build(self, mock_upload_artifact, mock_tar_directory):
|
| 126 |
+
"""Test uploading build."""
|
| 127 |
+
self._create_local_dir()
|
| 128 |
+
|
| 129 |
+
def mock_tar_directory_impl(_, archive_path):
|
| 130 |
+
self.fs.create_file(archive_path)
|
| 131 |
+
|
| 132 |
+
mock_tar_directory.side_effect = mock_tar_directory_impl
|
| 133 |
+
|
| 134 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 135 |
+
filestore.upload_build('sanitizer', self.local_dir)
|
| 136 |
+
self.assert_upload(mock_upload_artifact, mock_tar_directory,
|
| 137 |
+
'build-sanitizer')
|
| 138 |
+
|
| 139 |
+
@mock.patch('filestore.github_actions.tar_directory')
|
| 140 |
+
@mock.patch('filestore.github_actions._upload_artifact_with_upload_js')
|
| 141 |
+
def test_upload_coverage(self, mock_upload_artifact, mock_tar_directory):
|
| 142 |
+
"""Test uploading coverage."""
|
| 143 |
+
self._create_local_dir()
|
| 144 |
+
|
| 145 |
+
def mock_tar_directory_impl(_, archive_path):
|
| 146 |
+
self.fs.create_file(archive_path)
|
| 147 |
+
|
| 148 |
+
mock_tar_directory.side_effect = mock_tar_directory_impl
|
| 149 |
+
|
| 150 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 151 |
+
filestore.upload_coverage('latest', self.local_dir)
|
| 152 |
+
self.assert_upload(mock_upload_artifact, mock_tar_directory,
|
| 153 |
+
'coverage-latest')
|
| 154 |
+
|
| 155 |
+
def assert_upload(self, mock_upload_artifact, mock_tar_directory,
|
| 156 |
+
expected_artifact_name):
|
| 157 |
+
"""Tests that upload_directory invokes tar_directory and
|
| 158 |
+
artifact_client.upload_artifact properly."""
|
| 159 |
+
# Don't assert what second argument will be since it's a temporary
|
| 160 |
+
# directory.
|
| 161 |
+
self.assertEqual(mock_tar_directory.call_args_list[0][0][0], self.local_dir)
|
| 162 |
+
|
| 163 |
+
# Don't assert what second and third arguments will be since they are
|
| 164 |
+
# temporary directories.
|
| 165 |
+
expected_artifact_name = 'cifuzz-' + expected_artifact_name
|
| 166 |
+
self.assertEqual(mock_upload_artifact.call_args_list[0][0][0],
|
| 167 |
+
expected_artifact_name)
|
| 168 |
+
|
| 169 |
+
# Assert artifacts list contains one tarfile.
|
| 170 |
+
artifacts_list = mock_upload_artifact.call_args_list[0][0][1]
|
| 171 |
+
self.assertEqual(len(artifacts_list), 1)
|
| 172 |
+
self.assertEqual(os.path.basename(artifacts_list[0]),
|
| 173 |
+
expected_artifact_name + '.tar')
|
| 174 |
+
|
| 175 |
+
def _create_local_dir(self):
|
| 176 |
+
"""Sets up pyfakefs and creates a corpus directory containing
|
| 177 |
+
self.testcase."""
|
| 178 |
+
self.setUpPyfakefs()
|
| 179 |
+
self.fs.create_file(self.testcase, contents='hi')
|
| 180 |
+
|
| 181 |
+
@mock.patch('filestore.github_actions.GithubActionsFilestore._find_artifact')
|
| 182 |
+
@mock.patch('http_utils.download_and_unpack_zip')
|
| 183 |
+
def test_download_artifact(self, mock_download_and_unpack_zip,
|
| 184 |
+
mock_find_artifact):
|
| 185 |
+
"""Tests that _download_artifact works as intended."""
|
| 186 |
+
artifact_download_url = 'http://example.com/download'
|
| 187 |
+
artifact_listing = {
|
| 188 |
+
'expired': False,
|
| 189 |
+
'name': 'corpus',
|
| 190 |
+
'archive_download_url': artifact_download_url
|
| 191 |
+
}
|
| 192 |
+
mock_find_artifact.return_value = artifact_listing
|
| 193 |
+
|
| 194 |
+
self._create_local_dir()
|
| 195 |
+
with tempfile.TemporaryDirectory() as temp_dir:
|
| 196 |
+
# Create a tarball.
|
| 197 |
+
archive_path = os.path.join(temp_dir, 'cifuzz-corpus.tar')
|
| 198 |
+
github_actions.tar_directory(self.local_dir, archive_path)
|
| 199 |
+
|
| 200 |
+
artifact_download_dst_dir = os.path.join(temp_dir, 'dst')
|
| 201 |
+
os.mkdir(artifact_download_dst_dir)
|
| 202 |
+
|
| 203 |
+
def mock_download_and_unpack_zip_impl(url, download_artifact_temp_dir,
|
| 204 |
+
headers):
|
| 205 |
+
self.assertEqual(url, artifact_download_url)
|
| 206 |
+
self.assertEqual(headers, self._get_expected_http_headers())
|
| 207 |
+
shutil.copy(
|
| 208 |
+
archive_path,
|
| 209 |
+
os.path.join(download_artifact_temp_dir,
|
| 210 |
+
os.path.basename(archive_path)))
|
| 211 |
+
return True
|
| 212 |
+
|
| 213 |
+
mock_download_and_unpack_zip.side_effect = (
|
| 214 |
+
mock_download_and_unpack_zip_impl)
|
| 215 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 216 |
+
self.assertTrue(
|
| 217 |
+
filestore._download_artifact('corpus', artifact_download_dst_dir))
|
| 218 |
+
mock_find_artifact.assert_called_with('cifuzz-corpus')
|
| 219 |
+
self.assertTrue(
|
| 220 |
+
os.path.exists(
|
| 221 |
+
os.path.join(artifact_download_dst_dir,
|
| 222 |
+
os.path.basename(self.testcase))))
|
| 223 |
+
|
| 224 |
+
@mock.patch('filestore.github_actions.github_api.list_artifacts')
|
| 225 |
+
def test_find_artifact(self, mock_list_artifacts):
|
| 226 |
+
"""Tests that _find_artifact works as intended."""
|
| 227 |
+
artifact_listing_1 = {
|
| 228 |
+
'expired': False,
|
| 229 |
+
'name': 'other',
|
| 230 |
+
'archive_download_url': 'http://download1'
|
| 231 |
+
}
|
| 232 |
+
artifact_listing_2 = {
|
| 233 |
+
'expired': False,
|
| 234 |
+
'name': 'artifact',
|
| 235 |
+
'archive_download_url': 'http://download2'
|
| 236 |
+
}
|
| 237 |
+
artifact_listing_3 = {
|
| 238 |
+
'expired': True,
|
| 239 |
+
'name': 'artifact',
|
| 240 |
+
'archive_download_url': 'http://download3'
|
| 241 |
+
}
|
| 242 |
+
artifact_listing_4 = {
|
| 243 |
+
'expired': False,
|
| 244 |
+
'name': 'artifact',
|
| 245 |
+
'archive_download_url': 'http://download4'
|
| 246 |
+
}
|
| 247 |
+
artifacts = [
|
| 248 |
+
artifact_listing_1, artifact_listing_2, artifact_listing_3,
|
| 249 |
+
artifact_listing_4
|
| 250 |
+
]
|
| 251 |
+
mock_list_artifacts.return_value = artifacts
|
| 252 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 253 |
+
# Test that find_artifact will return the most recent unexpired artifact
|
| 254 |
+
# with the correct name.
|
| 255 |
+
self.assertEqual(filestore._find_artifact('artifact'), artifact_listing_2)
|
| 256 |
+
mock_list_artifacts.assert_called_with(self.owner, self.repo,
|
| 257 |
+
self._get_expected_http_headers())
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
class TarDirectoryTest(unittest.TestCase):
|
| 261 |
+
"""Tests for tar_directory."""
|
| 262 |
+
|
| 263 |
+
def test_tar_directory(self):
|
| 264 |
+
"""Tests that tar_directory writes the archive to the correct location and
|
| 265 |
+
archives properly."""
|
| 266 |
+
with tempfile.TemporaryDirectory() as temp_dir:
|
| 267 |
+
archive_path = os.path.join(temp_dir, 'myarchive.tar')
|
| 268 |
+
archived_dir = os.path.join(temp_dir, 'toarchive')
|
| 269 |
+
os.mkdir(archived_dir)
|
| 270 |
+
archived_filename = 'file1'
|
| 271 |
+
archived_file_path = os.path.join(archived_dir, archived_filename)
|
| 272 |
+
with open(archived_file_path, 'w') as file_handle:
|
| 273 |
+
file_handle.write('hi')
|
| 274 |
+
github_actions.tar_directory(archived_dir, archive_path)
|
| 275 |
+
self.assertTrue(os.path.exists(archive_path))
|
| 276 |
+
|
| 277 |
+
# Now check it archives correctly.
|
| 278 |
+
unpacked_directory = os.path.join(temp_dir, 'unpacked')
|
| 279 |
+
with tarfile.TarFile(archive_path) as artifact_tarfile:
|
| 280 |
+
artifact_tarfile.extractall(unpacked_directory)
|
| 281 |
+
unpacked_archived_file_path = os.path.join(unpacked_directory,
|
| 282 |
+
archived_filename)
|
| 283 |
+
self.assertTrue(os.path.exists(unpacked_archived_file_path))
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_api.py
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Module for dealing with the GitHub API. This is different from
|
| 15 |
+
github_actions_toolkit which only deals with the actions API. We need to use
|
| 16 |
+
both."""
|
| 17 |
+
import logging
|
| 18 |
+
import os
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
import requests
|
| 22 |
+
|
| 23 |
+
import filestore
|
| 24 |
+
|
| 25 |
+
# pylint: disable=wrong-import-position,import-error
|
| 26 |
+
|
| 27 |
+
sys.path.append(
|
| 28 |
+
os.path.join(__file__, os.path.pardir, os.path.pardir, os.path.pardir,
|
| 29 |
+
os.path.pardir))
|
| 30 |
+
import retry
|
| 31 |
+
|
| 32 |
+
_MAX_ITEMS_PER_PAGE = 100
|
| 33 |
+
|
| 34 |
+
_GET_ATTEMPTS = 3
|
| 35 |
+
_GET_BACKOFF = 1
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def get_http_auth_headers(config):
|
| 39 |
+
"""Returns HTTP headers for authentication to the API."""
|
| 40 |
+
authorization = f'token {config.token}'
|
| 41 |
+
return {
|
| 42 |
+
'Authorization': authorization,
|
| 43 |
+
'Accept': 'application/vnd.github.v3+json'
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def _get_artifacts_list_api_url(repo_owner, repo_name):
|
| 48 |
+
"""Returns the artifacts_api_url for |repo_name| owned by |repo_owner|."""
|
| 49 |
+
github_api_url = os.getenv('GITHUB_API_URL', 'https://api.github.com')
|
| 50 |
+
return (f'{github_api_url}/repos/{repo_owner}/'
|
| 51 |
+
f'{repo_name}/actions/artifacts')
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
@retry.wrap(_GET_ATTEMPTS, _GET_BACKOFF)
|
| 55 |
+
def _do_get_request(*args, **kwargs):
|
| 56 |
+
"""Wrapped version of requests.get that does retries."""
|
| 57 |
+
return requests.get(*args, **kwargs)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def _get_items(url, headers):
|
| 61 |
+
"""Generator that gets and yields items from a GitHub API endpoint (specified
|
| 62 |
+
by |URL|) sending |headers| with the get request."""
|
| 63 |
+
# Github API response pages are 1-indexed.
|
| 64 |
+
page_counter = 1
|
| 65 |
+
|
| 66 |
+
# Set to infinity so we run loop at least once.
|
| 67 |
+
total_num_items = float('inf')
|
| 68 |
+
|
| 69 |
+
item_num = 0
|
| 70 |
+
while item_num < total_num_items:
|
| 71 |
+
params = {'per_page': _MAX_ITEMS_PER_PAGE, 'page': str(page_counter)}
|
| 72 |
+
response = _do_get_request(url, params=params, headers=headers)
|
| 73 |
+
response_json = response.json()
|
| 74 |
+
if not response.status_code == 200:
|
| 75 |
+
# Check that request was successful.
|
| 76 |
+
logging.error('Request to %s failed. Code: %d. Response: %s',
|
| 77 |
+
response.request.url, response.status_code, response_json)
|
| 78 |
+
raise filestore.FilestoreError('Github API request failed.')
|
| 79 |
+
|
| 80 |
+
if total_num_items == float('inf'):
|
| 81 |
+
# Set proper total_num_items
|
| 82 |
+
total_num_items = response_json['total_count']
|
| 83 |
+
|
| 84 |
+
# Get the key for the items we are after.
|
| 85 |
+
keys = [key for key in response_json.keys() if key != 'total_count']
|
| 86 |
+
assert len(keys) == 1, keys
|
| 87 |
+
items_key = keys[0]
|
| 88 |
+
|
| 89 |
+
for item in response_json[items_key]:
|
| 90 |
+
yield item
|
| 91 |
+
item_num += 1
|
| 92 |
+
|
| 93 |
+
page_counter += 1
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def find_artifact(artifact_name, artifacts):
|
| 97 |
+
"""Find the artifact with the name |artifact_name| in |artifacts|."""
|
| 98 |
+
for artifact in artifacts:
|
| 99 |
+
# TODO(metzman): Handle multiple by making sure we download the latest.
|
| 100 |
+
if artifact['name'] == artifact_name and not artifact['expired']:
|
| 101 |
+
return artifact
|
| 102 |
+
return None
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def list_artifacts(owner, repo, headers):
|
| 106 |
+
"""Returns a generator of all the artifacts for |owner|/|repo|."""
|
| 107 |
+
url = _get_artifacts_list_api_url(owner, repo)
|
| 108 |
+
logging.debug('Getting artifacts from: %s', url)
|
| 109 |
+
return _get_items(url, headers)
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/gitlab/__init__.py
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2022 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""GitLab filestore implementation."""
|
| 15 |
+
import logging
|
| 16 |
+
|
| 17 |
+
import json
|
| 18 |
+
import os
|
| 19 |
+
import shutil
|
| 20 |
+
import tempfile
|
| 21 |
+
|
| 22 |
+
import filestore
|
| 23 |
+
import http_utils
|
| 24 |
+
|
| 25 |
+
# pylint: disable=no-self-use,unused-argument
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class GitlabFilestore(filestore.BaseFilestore):
|
| 29 |
+
"""Implementation of BaseFilestore using GitLab.
|
| 30 |
+
Needs a cache to upload and download builds.
|
| 31 |
+
Needs a git repository for corpus and coverage.
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
BUILD_PREFIX = 'build-'
|
| 35 |
+
CORPUS_PREFIX = 'corpus-'
|
| 36 |
+
COVERAGE_PREFIX = 'coverage-'
|
| 37 |
+
CRASHES_PREFIX = 'crashes-'
|
| 38 |
+
|
| 39 |
+
def __init__(self, config):
|
| 40 |
+
super().__init__(config)
|
| 41 |
+
self.artifacts_dir = self.config.platform_conf.artifacts_dir
|
| 42 |
+
self.cache_dir = self.config.platform_conf.cache_dir
|
| 43 |
+
if self.config.git_store_repo:
|
| 44 |
+
self.git_filestore = filestore.git.GitFilestore(config, None)
|
| 45 |
+
else:
|
| 46 |
+
self.git_filestore = None
|
| 47 |
+
|
| 48 |
+
def upload_crashes(self, name, directory):
|
| 49 |
+
"""GitLab artifacts implementation of upload_crashes."""
|
| 50 |
+
# Upload crashes as job artifacts.
|
| 51 |
+
if os.listdir(directory):
|
| 52 |
+
dest_dir_artifacts = os.path.join(self.config.project_src_path,
|
| 53 |
+
self.artifacts_dir,
|
| 54 |
+
self.CRASHES_PREFIX + name)
|
| 55 |
+
logging.info('Uploading artifacts to %s.', dest_dir_artifacts)
|
| 56 |
+
shutil.copytree(directory, dest_dir_artifacts)
|
| 57 |
+
|
| 58 |
+
def upload_corpus(self, name, directory, replace=False):
|
| 59 |
+
"""GitLab artifacts implementation of upload_corpus."""
|
| 60 |
+
# Use the git filestore if any.
|
| 61 |
+
if self.git_filestore:
|
| 62 |
+
self.git_filestore.upload_corpus(name, directory, replace)
|
| 63 |
+
return
|
| 64 |
+
# Fall back to cache.
|
| 65 |
+
dest_dir_cache = os.path.join(self.config.project_src_path, self.cache_dir,
|
| 66 |
+
self.CORPUS_PREFIX + name)
|
| 67 |
+
logging.info('Copying from %s to cache %s.', directory, dest_dir_cache)
|
| 68 |
+
# Remove previous corpus from cache if any.
|
| 69 |
+
shutil.rmtree(dest_dir_cache, ignore_errors=True)
|
| 70 |
+
shutil.copytree(directory, dest_dir_cache, dirs_exist_ok=True)
|
| 71 |
+
|
| 72 |
+
def upload_build(self, name, directory):
|
| 73 |
+
"""GitLab artifacts implementation of upload_build."""
|
| 74 |
+
# Puts build into the cache.
|
| 75 |
+
dest_dir_cache = os.path.join(self.config.project_src_path, self.cache_dir,
|
| 76 |
+
self.BUILD_PREFIX + name)
|
| 77 |
+
logging.info('Copying from %s to cache %s.', directory, dest_dir_cache)
|
| 78 |
+
shutil.copytree(directory, dest_dir_cache, dirs_exist_ok=True)
|
| 79 |
+
|
| 80 |
+
def upload_coverage(self, name, directory):
|
| 81 |
+
"""GitLab artifacts implementation of upload_coverage."""
|
| 82 |
+
# Use the git filestore.
|
| 83 |
+
if self.git_filestore:
|
| 84 |
+
self.git_filestore.upload_coverage(name, directory)
|
| 85 |
+
return
|
| 86 |
+
# Fall back to cache.
|
| 87 |
+
dest_dir_cache = os.path.join(self.config.project_src_path, self.cache_dir,
|
| 88 |
+
self.COVERAGE_PREFIX + name)
|
| 89 |
+
logging.info('Copying from %s to cache %s.', directory, dest_dir_cache)
|
| 90 |
+
shutil.copytree(directory, dest_dir_cache, dirs_exist_ok=True)
|
| 91 |
+
# And also updates coverage reports as artifacts
|
| 92 |
+
# as it should not be too big.
|
| 93 |
+
dest_dir_artifacts = os.path.join(self.config.project_src_path,
|
| 94 |
+
self.artifacts_dir,
|
| 95 |
+
self.COVERAGE_PREFIX + name)
|
| 96 |
+
logging.info('Uploading artifacts to %s.', dest_dir_artifacts)
|
| 97 |
+
shutil.copytree(directory, dest_dir_artifacts)
|
| 98 |
+
|
| 99 |
+
def _copy_from_cache(self, src_dir_cache, dst_directory):
|
| 100 |
+
if not os.path.exists(src_dir_cache):
|
| 101 |
+
logging.info('Cache %s does not exist.', src_dir_cache)
|
| 102 |
+
return False
|
| 103 |
+
logging.info('Copying %s from cache to %s.', src_dir_cache, dst_directory)
|
| 104 |
+
shutil.copytree(src_dir_cache, dst_directory, dirs_exist_ok=True)
|
| 105 |
+
return True
|
| 106 |
+
|
| 107 |
+
def download_corpus(self, name, dst_directory):
|
| 108 |
+
"""GitLab artifacts implementation of download_corpus."""
|
| 109 |
+
# Use the git filestore if any.
|
| 110 |
+
if self.git_filestore:
|
| 111 |
+
self.git_filestore.download_corpus(name, dst_directory)
|
| 112 |
+
return
|
| 113 |
+
# Fall back to cache.
|
| 114 |
+
src_dir_cache = os.path.join(self.config.project_src_path, self.cache_dir,
|
| 115 |
+
self.CORPUS_PREFIX + name)
|
| 116 |
+
self._copy_from_cache(src_dir_cache, dst_directory)
|
| 117 |
+
|
| 118 |
+
def download_build(self, name, dst_directory):
|
| 119 |
+
"""GitLab artifacts implementation of download_build."""
|
| 120 |
+
# Gets build from the cache.
|
| 121 |
+
src_dir_cache = os.path.join(self.config.project_src_path, self.cache_dir,
|
| 122 |
+
self.BUILD_PREFIX + name)
|
| 123 |
+
return self._copy_from_cache(src_dir_cache, dst_directory)
|
| 124 |
+
|
| 125 |
+
def download_coverage(self, name, dst_directory):
|
| 126 |
+
"""GitLab artifacts implementation of download_coverage."""
|
| 127 |
+
# Use the git filestore if any.
|
| 128 |
+
if self.git_filestore:
|
| 129 |
+
return self.git_filestore.download_coverage(name, dst_directory)
|
| 130 |
+
# Fall back to cache.
|
| 131 |
+
src_dir_cache = os.path.join(self.config.project_src_path, self.cache_dir,
|
| 132 |
+
self.COVERAGE_PREFIX + name)
|
| 133 |
+
return self._copy_from_cache(src_dir_cache, dst_directory)
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/gsutil/__init__.py
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Filestore implementation using gsutil."""
|
| 15 |
+
import logging
|
| 16 |
+
import os
|
| 17 |
+
import posixpath
|
| 18 |
+
import subprocess
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
# pylint: disable=wrong-import-position,import-error
|
| 22 |
+
sys.path.append(
|
| 23 |
+
os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir,
|
| 24 |
+
os.pardir, os.pardir))
|
| 25 |
+
import filestore
|
| 26 |
+
import utils
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def _gsutil_execute(*args, parallel=True):
|
| 30 |
+
"""Executes a gsutil command, passing |*args| to gsutil and returns the
|
| 31 |
+
stdout, stderr and returncode. Exceptions on failure."""
|
| 32 |
+
command = ['gsutil']
|
| 33 |
+
if parallel:
|
| 34 |
+
command.append('-m')
|
| 35 |
+
command += list(args)
|
| 36 |
+
logging.info('Executing gsutil command: %s', command)
|
| 37 |
+
return utils.execute(command, check_result=True)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def _rsync(src, dst, recursive=True, delete=False):
|
| 41 |
+
"""Executes gsutil rsync on |src| and |dst|"""
|
| 42 |
+
args = ['rsync']
|
| 43 |
+
if recursive:
|
| 44 |
+
args.append('-r')
|
| 45 |
+
if delete:
|
| 46 |
+
args.append('-d')
|
| 47 |
+
args += [src, dst]
|
| 48 |
+
return _gsutil_execute(*args)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class GSUtilFilestore(filestore.BaseFilestore):
|
| 52 |
+
"""Filestore implementation using gsutil."""
|
| 53 |
+
BUILD_DIR = 'build'
|
| 54 |
+
CRASHES_DIR = 'crashes'
|
| 55 |
+
CORPUS_DIR = 'corpus'
|
| 56 |
+
COVERAGE_DIR = 'coverage'
|
| 57 |
+
|
| 58 |
+
def __init__(self, config):
|
| 59 |
+
super().__init__(config)
|
| 60 |
+
self._cloud_bucket = self.config.cloud_bucket
|
| 61 |
+
|
| 62 |
+
def _get_gsutil_url(self, name, prefix_dir):
|
| 63 |
+
"""Returns the gsutil URL for |name| and |prefix_dir|."""
|
| 64 |
+
if not prefix_dir:
|
| 65 |
+
return posixpath.join(self._cloud_bucket, name)
|
| 66 |
+
return posixpath.join(self._cloud_bucket, prefix_dir, name)
|
| 67 |
+
|
| 68 |
+
def _upload_directory(self, name, directory, prefix, delete=False):
|
| 69 |
+
gsutil_url = self._get_gsutil_url(name, prefix)
|
| 70 |
+
return _rsync(directory, gsutil_url, delete=delete)
|
| 71 |
+
|
| 72 |
+
def _download_directory(self, name, dst_directory, prefix):
|
| 73 |
+
gsutil_url = self._get_gsutil_url(name, prefix)
|
| 74 |
+
return _rsync(gsutil_url, dst_directory)
|
| 75 |
+
|
| 76 |
+
def upload_crashes(self, name, directory):
|
| 77 |
+
"""Uploads the crashes at |directory| to |name|."""
|
| 78 |
+
# Name is going to be "current". I don't know if this makes sense outside of
|
| 79 |
+
# GitHub Actions.
|
| 80 |
+
gsutil_url = self._get_gsutil_url(name, self.CRASHES_DIR)
|
| 81 |
+
logging.info('Uploading crashes to %s.', gsutil_url)
|
| 82 |
+
return _rsync(directory, gsutil_url)
|
| 83 |
+
|
| 84 |
+
def upload_corpus(self, name, directory, replace=False):
|
| 85 |
+
"""Uploads the crashes at |directory| to |name|."""
|
| 86 |
+
return self._upload_directory(name,
|
| 87 |
+
directory,
|
| 88 |
+
self.CORPUS_DIR,
|
| 89 |
+
delete=replace)
|
| 90 |
+
|
| 91 |
+
def upload_build(self, name, directory):
|
| 92 |
+
"""Uploads the build located at |directory| to |name|."""
|
| 93 |
+
return self._upload_directory(name, directory, self.BUILD_DIR)
|
| 94 |
+
|
| 95 |
+
def upload_coverage(self, name, directory):
|
| 96 |
+
"""Uploads the coverage report at |directory| to |name|."""
|
| 97 |
+
return self._upload_directory(name, directory, self.COVERAGE_DIR)
|
| 98 |
+
|
| 99 |
+
def download_corpus(self, name, dst_directory):
|
| 100 |
+
"""Downloads the corpus located at |name| to |dst_directory|."""
|
| 101 |
+
return self._download_directory(name, dst_directory, self.CORPUS_DIR)
|
| 102 |
+
|
| 103 |
+
def download_build(self, name, dst_directory):
|
| 104 |
+
"""Downloads the build with |name| to |dst_directory|."""
|
| 105 |
+
return self._download_directory(name, dst_directory, self.BUILD_DIR)
|
| 106 |
+
|
| 107 |
+
def download_coverage(self, name, dst_directory):
|
| 108 |
+
"""Downloads the latest project coverage report."""
|
| 109 |
+
return self._download_directory(name, dst_directory, self.COVERAGE_DIR)
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/filestore/no_filestore/__init__.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Empty filestore implementation for platforms that haven't implemented it."""
|
| 15 |
+
import logging
|
| 16 |
+
|
| 17 |
+
import filestore
|
| 18 |
+
|
| 19 |
+
# pylint:disable=no-self-use,unused-argument
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class NoFilestore(filestore.BaseFilestore):
|
| 23 |
+
"""Empty Filestore implementation."""
|
| 24 |
+
|
| 25 |
+
def upload_crashes(self, name, directory):
|
| 26 |
+
"""Noop implementation of upload_crashes."""
|
| 27 |
+
logging.info('Not uploading crashes because no Filestore.')
|
| 28 |
+
|
| 29 |
+
def upload_corpus(self, name, directory, replace=False):
|
| 30 |
+
"""Noop implementation of upload_corpus."""
|
| 31 |
+
logging.info('Not uploading corpus because no Filestore.')
|
| 32 |
+
|
| 33 |
+
def upload_build(self, name, directory):
|
| 34 |
+
"""Noop implementation of upload_build."""
|
| 35 |
+
logging.info('Not uploading build because no Filestore.')
|
| 36 |
+
|
| 37 |
+
def upload_coverage(self, name, directory):
|
| 38 |
+
"""Noop implementation of upload_coverage."""
|
| 39 |
+
logging.info('Not uploading coverage because no Filestore.')
|
| 40 |
+
|
| 41 |
+
def download_corpus(self, name, dst_directory):
|
| 42 |
+
"""Noop implementation of download_corpus."""
|
| 43 |
+
logging.info('Not downloading corpus because no Filestore.')
|
| 44 |
+
|
| 45 |
+
def download_build(self, name, dst_directory):
|
| 46 |
+
"""Noop implementation of download_build."""
|
| 47 |
+
logging.info('Not downloading build because no Filestore.')
|
| 48 |
+
|
| 49 |
+
def download_coverage(self, name, dst_directory):
|
| 50 |
+
"""Noop implementation of download_coverage."""
|
| 51 |
+
logging.info('Not downloading coverage because no Filestore.')
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/TimeoutFuzzer.cpp
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2021 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
|
| 15 |
+
// Example of a standalone runner for "fuzz targets".
|
| 16 |
+
// It reads all files passed as parameters and feeds their contents
|
| 17 |
+
// one by one into the fuzz target (LLVMFuzzerTestOneInput).
|
| 18 |
+
// This runner does not do any fuzzing, but allows us to run the fuzz target
|
| 19 |
+
// on the test corpus (e.g. "do_stuff_test_data") or on a single file,
|
| 20 |
+
// e.g. the one that comes from a bug report.
|
| 21 |
+
|
| 22 |
+
// This is a fuzz target that times out on every input by infinite looping.
|
| 23 |
+
// This is used for testing.
|
| 24 |
+
// Build instructions:
|
| 25 |
+
// 1. clang++ -fsanitize=fuzzer TimeoutFuzzer.cpp -o timeout_fuzzer
|
| 26 |
+
// 2. strip timeout_fuzzer
|
| 27 |
+
// The binary is stripped to save space in the git repo.
|
| 28 |
+
|
| 29 |
+
#include <stddef.h>
|
| 30 |
+
#include <stdint.h>
|
| 31 |
+
|
| 32 |
+
extern "C" int LLVMFuzzerTestOneInput(uint8_t* data, size_t size) {
|
| 33 |
+
while (true)
|
| 34 |
+
;
|
| 35 |
+
return 0;
|
| 36 |
+
}
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/example_crash_fuzzer_bug_summary.txt
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
AddressSanitizer: heap-buffer-overflow on address 0x62500001b530 at pc 0x00000052138a bp 0x7ffe62db2c10 sp 0x7ffe62db23d8
|
| 2 |
+
READ of size 52 at 0x62500001b530 thread T0
|
| 3 |
+
SCARINESS: 26 (multi-byte-read-heap-buffer-overflow)
|
| 4 |
+
#0 0x521389 in __asan_memcpy /src/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:22:3
|
| 5 |
+
#1 0x567590 in yr_object_set_string /src/yara/libyara/object.c:1122:5
|
| 6 |
+
#2 0x5afced in dex_parse /src/yara/libyara/modules/dex/dex.c:781:5
|
| 7 |
+
#3 0x5b4a8b in dex__load /src/yara/libyara/modules/dex/dex.c:1218:7
|
| 8 |
+
#4 0x56537c in yr_modules_load /src/yara/libyara/modules.c:179:16
|
| 9 |
+
#5 0x5d6583 in yr_execute_code /src/yara/libyara/exec.c:1276:18
|
| 10 |
+
#6 0x56f5c0 in yr_scanner_scan_mem_blocks /src/yara/libyara/scanner.c:444:3
|
| 11 |
+
#7 0x56bf23 in yr_rules_scan_mem_blocks /src/yara/libyara/rules.c:235:12
|
| 12 |
+
#8 0x56c182 in yr_rules_scan_mem /src/yara/libyara/rules.c:285:10
|
| 13 |
+
#9 0x5548d2 in LLVMFuzzerTestOneInput /src/yara/tests/oss-fuzz/dex_fuzzer.cc:40:3
|
| 14 |
+
#10 0x45a3b1 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:556:15
|
| 15 |
+
#11 0x459ad5 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:470:3
|
| 16 |
+
#12 0x45be77 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:698:19
|
| 17 |
+
#13 0x45cc05 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:830:5
|
| 18 |
+
#14 0x44ac88 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:824:6
|
| 19 |
+
#15 0x474ab2 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:19:10
|
| 20 |
+
#16 0x7f4409b7a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
|
| 21 |
+
#17 0x41e348 in _start (out/dex_fuzzer+0x41e348)
|
| 22 |
+
|
| 23 |
+
0x62500001b530 is located 0 bytes to the right of 9264-byte region [0x625000019100,0x62500001b530)
|
| 24 |
+
allocated by thread T0 here:
|
| 25 |
+
#0 0x521f4d in malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
|
| 26 |
+
#1 0x4331b7 in operator new(unsigned long) (out/dex_fuzzer+0x4331b7)
|
| 27 |
+
#2 0x459ad5 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:470:3
|
| 28 |
+
#3 0x45be77 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:698:19
|
| 29 |
+
#4 0x45cc05 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:830:5
|
| 30 |
+
#5 0x44ac88 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:824:6
|
| 31 |
+
#6 0x474ab2 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:19:10
|
| 32 |
+
#7 0x7f4409b7a82f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
|
| 33 |
+
|
| 34 |
+
SUMMARY: AddressSanitizer: heap-buffer-overflow /src/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:22:3 in __asan_memcpy
|
| 35 |
+
Shadow bytes around the buggy address:
|
| 36 |
+
0x0c4a7fffb650: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 37 |
+
0x0c4a7fffb660: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 38 |
+
0x0c4a7fffb670: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 39 |
+
0x0c4a7fffb680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 40 |
+
0x0c4a7fffb690: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
|
| 41 |
+
=>0x0c4a7fffb6a0: 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa fa fa
|
| 42 |
+
0x0c4a7fffb6b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 43 |
+
0x0c4a7fffb6c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 44 |
+
0x0c4a7fffb6d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 45 |
+
0x0c4a7fffb6e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 46 |
+
0x0c4a7fffb6f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 47 |
+
|
| 48 |
+
Shadow byte legend (one shadow byte represents 8 application bytes):
|
| 49 |
+
Addressable: 00
|
| 50 |
+
Partially addressable: 01 02 03 04 05 06 07
|
| 51 |
+
Heap left redzone: fa
|
| 52 |
+
Freed heap region: fd
|
| 53 |
+
Stack left redzone: f1
|
| 54 |
+
Stack mid redzone: f2
|
| 55 |
+
Stack right redzone: f3
|
| 56 |
+
Stack after return: f5
|
| 57 |
+
Stack use after scope: f8
|
| 58 |
+
Global redzone: f9
|
| 59 |
+
Global init order: f6
|
| 60 |
+
Poisoned by user: f7
|
| 61 |
+
Container overflow: fc
|
| 62 |
+
Array cookie: ac
|
| 63 |
+
Intra object redzone: bb
|
| 64 |
+
ASan internal: fe
|
| 65 |
+
Left alloca redzone: ca
|
| 66 |
+
Right alloca redzone: cb
|
| 67 |
+
Shadow gap: cc
|
| 68 |
+
==12==ABORTING
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/example_crash_fuzzer_output.txt
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/github/workspace/build-out/do_stuff_fuzzer -timeout=25 -rss_limit_mb=2560 -dict=/github/workspace/build-out/do_stuff_fuzzer.dict -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmp9p1w4p8r/ -max_total_time=600 -print_final_stats=1 /github/workspace/cifuzz-corpus/do_stuff_fuzzer >fuzz-0.log 2>&1
|
| 2 |
+
================== Job 0 exited with exit code 77 ============
|
| 3 |
+
Dictionary: 3 entries
|
| 4 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 5 |
+
INFO: Seed: 1337
|
| 6 |
+
INFO: Loaded 1 modules (86 inline 8-bit counters): 86 [0x6150e0, 0x615136),
|
| 7 |
+
INFO: Loaded 1 PC tables (86 PCs): 86 [0x5c8b08,0x5c9068),
|
| 8 |
+
INFO: 5 files found in /github/workspace/cifuzz-corpus/do_stuff_fuzzer
|
| 9 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
|
| 10 |
+
INFO: seed corpus: files: 5 min: 3b max: 44b total: 64b rss: 31Mb
|
| 11 |
+
#6 INITED cov: 64 ft: 70 corp: 5/64b exec/s: 0 rss: 32Mb
|
| 12 |
+
#9 NEW cov: 64 ft: 72 corp: 6/74b lim: 4096 exec/s: 0 rss: 32Mb L: 10/44 MS: 3 ChangeBit-InsertByte-ManualDict- DE: "foo"-
|
| 13 |
+
#17 NEW cov: 64 ft: 74 corp: 7/86b lim: 4096 exec/s: 0 rss: 32Mb L: 12/44 MS: 3 ChangeBit-ManualDict-PersAutoDict- DE: "ouch"-"foo"-
|
| 14 |
+
#18 NEW cov: 64 ft: 76 corp: 8/100b lim: 4096 exec/s: 0 rss: 32Mb L: 14/44 MS: 1 CrossOver-
|
| 15 |
+
#22 NEW cov: 64 ft: 78 corp: 9/141b lim: 4096 exec/s: 0 rss: 32Mb L: 41/44 MS: 4 InsertRepeatedBytes-CopyPart-ChangeBinInt-ChangeBit-
|
| 16 |
+
#24 NEW cov: 64 ft: 80 corp: 10/151b lim: 4096 exec/s: 0 rss: 32Mb L: 10/44 MS: 2 CrossOver-CopyPart-
|
| 17 |
+
#28 NEW cov: 64 ft: 81 corp: 11/171b lim: 4096 exec/s: 0 rss: 32Mb L: 20/44 MS: 4 InsertByte-PersAutoDict-ShuffleBytes-ManualDict- DE: "foo"-"ouch"-
|
| 18 |
+
#43 NEW cov: 65 ft: 83 corp: 12/175b lim: 4096 exec/s: 0 rss: 32Mb L: 4/44 MS: 5 InsertByte-ChangeBit-ManualDict-ManualDict-EraseBytes- DE: "bar"-"bar"-
|
| 19 |
+
#54 NEW cov: 65 ft: 84 corp: 13/191b lim: 4096 exec/s: 0 rss: 32Mb L: 16/44 MS: 1 CrossOver-
|
| 20 |
+
#64 NEW cov: 65 ft: 86 corp: 14/209b lim: 4096 exec/s: 0 rss: 32Mb L: 18/44 MS: 5 InsertByte-ChangeBinInt-CMP-PersAutoDict-CopyPart- DE: "\000\000"-"foo"-
|
| 21 |
+
#75 REDUCE cov: 65 ft: 86 corp: 14/203b lim: 4096 exec/s: 0 rss: 32Mb L: 35/44 MS: 1 EraseBytes-
|
| 22 |
+
#76 REDUCE cov: 65 ft: 86 corp: 14/195b lim: 4096 exec/s: 0 rss: 32Mb L: 36/36 MS: 1 EraseBytes-
|
| 23 |
+
=================================================================
|
| 24 |
+
==26==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000003114 at pc 0x00000056d1db bp 0x7fffd6a72bf0 sp 0x7fffd6a72be8
|
| 25 |
+
READ of size 4 at 0x603000003114 thread T0
|
| 26 |
+
SCARINESS: 17 (4-byte-read-heap-buffer-overflow)
|
| 27 |
+
#0 0x56d1da in DoStuff(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /src/cifuzz-example/my_api.cpp:26:10
|
| 28 |
+
#1 0x56c5d6 in LLVMFuzzerTestOneInput /src/cifuzz-example/do_stuff_fuzzer.cpp:15:3
|
| 29 |
+
#2 0x43de23 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 30 |
+
#3 0x43d60a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 31 |
+
#4 0x43ecd9 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19
|
| 32 |
+
#5 0x43f9a5 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:895:5
|
| 33 |
+
#6 0x42ed0f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 34 |
+
#7 0x458362 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 35 |
+
#8 0x7fcfaa2aa082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 36 |
+
#9 0x41f74d in _start (build-out/do_stuff_fuzzer+0x41f74d)
|
| 37 |
+
|
| 38 |
+
DEDUP_TOKEN: DoStuff(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)--LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 39 |
+
0x603000003114 is located 0 bytes to the right of 20-byte region [0x603000003100,0x603000003114)
|
| 40 |
+
allocated by thread T0 here:
|
| 41 |
+
#0 0x569dfd in operator new(unsigned long) /src/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:95:3
|
| 42 |
+
#1 0x56c9d4 in __libcpp_operator_new<unsigned long> /usr/local/bin/../include/c++/v1/new:245:10
|
| 43 |
+
#2 0x56c9d4 in __libcpp_allocate /usr/local/bin/../include/c++/v1/new:271:10
|
| 44 |
+
#3 0x56c9d4 in allocate /usr/local/bin/../include/c++/v1/__memory/allocator.h:105:38
|
| 45 |
+
#4 0x56c9d4 in allocate /usr/local/bin/../include/c++/v1/__memory/allocator_traits.h:262:20
|
| 46 |
+
#5 0x56c9d4 in __vallocate /usr/local/bin/../include/c++/v1/vector:931:37
|
| 47 |
+
#6 0x56c9d4 in vector /usr/local/bin/../include/c++/v1/vector:1236:9
|
| 48 |
+
#7 0x56c9d4 in DoStuff(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /src/cifuzz-example/my_api.cpp:14:20
|
| 49 |
+
#8 0x56c5d6 in LLVMFuzzerTestOneInput /src/cifuzz-example/do_stuff_fuzzer.cpp:15:3
|
| 50 |
+
#9 0x43de23 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 51 |
+
#10 0x43d60a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 52 |
+
#11 0x43ecd9 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19
|
| 53 |
+
#12 0x43f9a5 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:895:5
|
| 54 |
+
#13 0x42ed0f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 55 |
+
#14 0x458362 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 56 |
+
#15 0x7fcfaa2aa082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 57 |
+
|
| 58 |
+
DEDUP_TOKEN: operator new(unsigned long)--__libcpp_operator_new<unsigned long>--__libcpp_allocate
|
| 59 |
+
SUMMARY: AddressSanitizer: heap-buffer-overflow /src/cifuzz-example/my_api.cpp:26:10 in DoStuff(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
|
| 60 |
+
Shadow bytes around the buggy address:
|
| 61 |
+
0x0c067fff85d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 62 |
+
0x0c067fff85e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 63 |
+
0x0c067fff85f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 64 |
+
0x0c067fff8600: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fd fd
|
| 65 |
+
0x0c067fff8610: fd fa fa fa fd fd fd fa fa fa 00 00 00 00 fa fa
|
| 66 |
+
=>0x0c067fff8620: 00 00[04]fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 67 |
+
0x0c067fff8630: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 68 |
+
0x0c067fff8640: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 69 |
+
0x0c067fff8650: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 70 |
+
0x0c067fff8660: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 71 |
+
0x0c067fff8670: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 72 |
+
Shadow byte legend (one shadow byte represents 8 application bytes):
|
| 73 |
+
Addressable: 00
|
| 74 |
+
Partially addressable: 01 02 03 04 05 06 07
|
| 75 |
+
Heap left redzone: fa
|
| 76 |
+
Freed heap region: fd
|
| 77 |
+
Stack left redzone: f1
|
| 78 |
+
Stack mid redzone: f2
|
| 79 |
+
Stack right redzone: f3
|
| 80 |
+
Stack after return: f5
|
| 81 |
+
Stack use after scope: f8
|
| 82 |
+
Global redzone: f9
|
| 83 |
+
Global init order: f6
|
| 84 |
+
Poisoned by user: f7
|
| 85 |
+
Container overflow: fc
|
| 86 |
+
Array cookie: ac
|
| 87 |
+
Intra object redzone: bb
|
| 88 |
+
ASan internal: fe
|
| 89 |
+
Left alloca redzone: ca
|
| 90 |
+
Right alloca redzone: cb
|
| 91 |
+
==26==ABORTING
|
| 92 |
+
MS: 4 PersAutoDict-ManualDict-CrossOver-PersAutoDict- DE: "foo"-"ouch"-"bar"-; base unit: 1a25c32303e03f997166aee1c665b5ae9f66ec7d
|
| 93 |
+
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x66,0x6f,0x6f,0xff,0x1,0x62,0x61,0x72,0x63,0x68,0x6f,0x75,0x63,0x68,0x66,0x6f,0x66,0x6e,0x6f,0x6d,0x67,0x6d,
|
| 94 |
+
\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377foo\377\001barchouchfofnomgm
|
| 95 |
+
artifact_prefix='/tmp/tmp9p1w4p8r/'; Test unit written to /tmp/tmp9p1w4p8r/crash-1c750df432fe458b738987ba69cd20a598708775
|
| 96 |
+
Base64: //////////////////////9mb2//AWJhcmNob3VjaGZvZm5vbWdt
|
| 97 |
+
stat::number_of_executed_units: 90
|
| 98 |
+
stat::average_exec_per_sec: 0
|
| 99 |
+
stat::new_units_added: 11
|
| 100 |
+
stat::slowest_unit_time_sec: 0
|
| 101 |
+
stat::peak_rss_mb: 33
|
| 102 |
+
/github/workspace/build-out/do_stuff_fuzzer -timeout=25 -rss_limit_mb=2560 -dict=/github/workspace/build-out/do_stuff_fuzzer.dict -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmp9p1w4p8r/ -max_total_time=600 -print_final_stats=1 /github/workspace/cifuzz-corpus/do_stuff_fuzzer >fuzz-1.log 2>&1
|
| 103 |
+
================== Job 1 exited with exit code 77 ============
|
| 104 |
+
Dictionary: 3 entries
|
| 105 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 106 |
+
INFO: Seed: 1337
|
| 107 |
+
INFO: Loaded 1 modules (86 inline 8-bit counters): 86 [0x6150e0, 0x615136),
|
| 108 |
+
INFO: Loaded 1 PC tables (86 PCs): 86 [0x5c8b08,0x5c9068),
|
| 109 |
+
INFO: 15 files found in /github/workspace/cifuzz-corpus/do_stuff_fuzzer
|
| 110 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
|
| 111 |
+
INFO: seed corpus: files: 15 min: 3b max: 44b total: 239b rss: 31Mb
|
| 112 |
+
#16 INITED cov: 65 ft: 86 corp: 13/159b exec/s: 0 rss: 32Mb
|
| 113 |
+
#38 NEW cov: 65 ft: 88 corp: 14/188b lim: 4096 exec/s: 0 rss: 32Mb L: 29/35 MS: 2 InsertByte-CopyPart-
|
| 114 |
+
#43 REDUCE cov: 65 ft: 88 corp: 14/187b lim: 4096 exec/s: 0 rss: 32Mb L: 2/35 MS: 5 InsertByte-ChangeByte-ChangeBinInt-EraseBytes-EraseBytes-
|
| 115 |
+
#64 NEW cov: 66 ft: 89 corp: 15/191b lim: 4096 exec/s: 0 rss: 32Mb L: 4/35 MS: 1 ChangeByte-
|
| 116 |
+
#78 REDUCE cov: 66 ft: 89 corp: 15/190b lim: 4096 exec/s: 0 rss: 32Mb L: 15/35 MS: 4 ChangeBinInt-CopyPart-EraseBytes-EraseBytes-
|
| 117 |
+
#95 REDUCE cov: 66 ft: 89 corp: 15/188b lim: 4096 exec/s: 0 rss: 32Mb L: 16/35 MS: 2 ChangeBinInt-EraseBytes-
|
| 118 |
+
#110 REDUCE cov: 66 ft: 89 corp: 15/184b lim: 4096 exec/s: 0 rss: 32Mb L: 31/31 MS: 5 CrossOver-ChangeByte-ShuffleBytes-InsertByte-EraseBytes-
|
| 119 |
+
#146 REDUCE cov: 66 ft: 89 corp: 15/183b lim: 4096 exec/s: 0 rss: 32Mb L: 1/31 MS: 1 EraseBytes-
|
| 120 |
+
#157 NEW cov: 66 ft: 90 corp: 16/210b lim: 4096 exec/s: 0 rss: 32Mb L: 27/31 MS: 1 CrossOver-
|
| 121 |
+
#230 REDUCE cov: 66 ft: 92 corp: 17/318b lim: 4096 exec/s: 0 rss: 32Mb L: 108/108 MS: 3 CopyPart-InsertRepeatedBytes-CrossOver-
|
| 122 |
+
#277 NEW cov: 66 ft: 94 corp: 18/429b lim: 4096 exec/s: 0 rss: 32Mb L: 111/111 MS: 2 ManualDict-CMP- DE: "bar"-"\000\000\000\000"-
|
| 123 |
+
#337 NEW cov: 67 ft: 95 corp: 19/439b lim: 4096 exec/s: 0 rss: 32Mb L: 10/111 MS: 5 ChangeByte-ChangeBit-ManualDict-CopyPart-EraseBytes- DE: "bar"-
|
| 124 |
+
=================================================================
|
| 125 |
+
==30==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x603000007d94 at pc 0x00000056d1db bp 0x7ffdb9da4b50 sp 0x7ffdb9da4b48
|
| 126 |
+
READ of size 4 at 0x603000007d94 thread T0
|
| 127 |
+
SCARINESS: 17 (4-byte-read-heap-buffer-overflow)
|
| 128 |
+
#0 0x56d1da in DoStuff(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /src/cifuzz-example/my_api.cpp:26:10
|
| 129 |
+
#1 0x56c5d6 in LLVMFuzzerTestOneInput /src/cifuzz-example/do_stuff_fuzzer.cpp:15:3
|
| 130 |
+
#2 0x43de23 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 131 |
+
#3 0x43d60a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 132 |
+
#4 0x43ecd9 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19
|
| 133 |
+
#5 0x43f9a5 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:895:5
|
| 134 |
+
#6 0x42ed0f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 135 |
+
#7 0x458362 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 136 |
+
#8 0x7fc2c6bd3082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 137 |
+
#9 0x41f74d in _start (build-out/do_stuff_fuzzer+0x41f74d)
|
| 138 |
+
|
| 139 |
+
DEDUP_TOKEN: DoStuff(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)--LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 140 |
+
0x603000007d94 is located 0 bytes to the right of 20-byte region [0x603000007d80,0x603000007d94)
|
| 141 |
+
allocated by thread T0 here:
|
| 142 |
+
#0 0x569dfd in operator new(unsigned long) /src/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:95:3
|
| 143 |
+
#1 0x56c9d4 in __libcpp_operator_new<unsigned long> /usr/local/bin/../include/c++/v1/new:245:10
|
| 144 |
+
#2 0x56c9d4 in __libcpp_allocate /usr/local/bin/../include/c++/v1/new:271:10
|
| 145 |
+
#3 0x56c9d4 in allocate /usr/local/bin/../include/c++/v1/__memory/allocator.h:105:38
|
| 146 |
+
#4 0x56c9d4 in allocate /usr/local/bin/../include/c++/v1/__memory/allocator_traits.h:262:20
|
| 147 |
+
#5 0x56c9d4 in __vallocate /usr/local/bin/../include/c++/v1/vector:931:37
|
| 148 |
+
#6 0x56c9d4 in vector /usr/local/bin/../include/c++/v1/vector:1236:9
|
| 149 |
+
#7 0x56c9d4 in DoStuff(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) /src/cifuzz-example/my_api.cpp:14:20
|
| 150 |
+
#8 0x56c5d6 in LLVMFuzzerTestOneInput /src/cifuzz-example/do_stuff_fuzzer.cpp:15:3
|
| 151 |
+
#9 0x43de23 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 152 |
+
#10 0x43d60a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 153 |
+
#11 0x43ecd9 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:757:19
|
| 154 |
+
#12 0x43f9a5 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:895:5
|
| 155 |
+
#13 0x42ed0f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 156 |
+
#14 0x458362 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 157 |
+
#15 0x7fc2c6bd3082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 158 |
+
|
| 159 |
+
DEDUP_TOKEN: operator new(unsigned long)--__libcpp_operator_new<unsigned long>--__libcpp_allocate
|
| 160 |
+
SUMMARY: AddressSanitizer: heap-buffer-overflow /src/cifuzz-example/my_api.cpp:26:10 in DoStuff(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
|
| 161 |
+
Shadow bytes around the buggy address:
|
| 162 |
+
0x0c067fff8f60: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fd fd
|
| 163 |
+
0x0c067fff8f70: fd fa fa fa fd fd fd fa fa fa fd fd fd fa fa fa
|
| 164 |
+
0x0c067fff8f80: fd fd fd fa fa fa fd fd fd fa fa fa fd fd fd fa
|
| 165 |
+
0x0c067fff8f90: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fd fd
|
| 166 |
+
0x0c067fff8fa0: fd fa fa fa fd fd fd fa fa fa fd fd fd fa fa fa
|
| 167 |
+
=>0x0c067fff8fb0: 00 00[04]fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 168 |
+
0x0c067fff8fc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 169 |
+
0x0c067fff8fd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 170 |
+
0x0c067fff8fe0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 171 |
+
0x0c067fff8ff0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 172 |
+
0x0c067fff9000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 173 |
+
Shadow byte legend (one shadow byte represents 8 application bytes):
|
| 174 |
+
Addressable: 00
|
| 175 |
+
Partially addressable: 01 02 03 04 05 06 07
|
| 176 |
+
Heap left redzone: fa
|
| 177 |
+
Freed heap region: fd
|
| 178 |
+
Stack left redzone: f1
|
| 179 |
+
Stack mid redzone: f2
|
| 180 |
+
Stack right redzone: f3
|
| 181 |
+
Stack after return: f5
|
| 182 |
+
Stack use after scope: f8
|
| 183 |
+
Global redzone: f9
|
| 184 |
+
Global init order: f6
|
| 185 |
+
Poisoned by user: f7
|
| 186 |
+
Container overflow: fc
|
| 187 |
+
Array cookie: ac
|
| 188 |
+
Intra object redzone: bb
|
| 189 |
+
ASan internal: fe
|
| 190 |
+
Left alloca redzone: ca
|
| 191 |
+
Right alloca redzone: cb
|
| 192 |
+
==30==ABORTING
|
| 193 |
+
MS: 4 ShuffleBytes-ManualDict-CrossOver-PersAutoDict- DE: "foo"-"bar"-; base unit: 8fc7da8d952ed1aa5c7415e21b3d52b42402973d
|
| 194 |
+
0x66,0x6f,0x6f,0x63,0x6f,0x75,0x6f,0x75,0x63,0x68,0x63,0x68,0x66,0x62,0x61,0x72,0x6f,0x6f,0x6d,0x67,0x66,0x6f,0x6f,0x2f,0x99,0x6f,0x6f,0x90,0x6f,0x6f,0x6d,0x0,0x0,0x67,0x2f,
|
| 195 |
+
foocououchchfbaroomgfoo/\231oo\220oom\000\000g/
|
| 196 |
+
artifact_prefix='/tmp/tmp9p1w4p8r/'; Test unit written to /tmp/tmp9p1w4p8r/crash-f8a2a1e84f58a2d676e5ad8078119a39b78df901
|
| 197 |
+
Base64: Zm9vY291b3VjaGNoZmJhcm9vbWdmb28vmW9vkG9vbQAAZy8=
|
| 198 |
+
stat::number_of_executed_units: 366
|
| 199 |
+
stat::average_exec_per_sec: 0
|
| 200 |
+
stat::new_units_added: 11
|
| 201 |
+
stat::slowest_unit_time_sec: 0
|
| 202 |
+
stat::peak_rss_mb: 33
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/.clusterfuzzlite/Dockerfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2020 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
#
|
| 15 |
+
################################################################################
|
| 16 |
+
|
| 17 |
+
FROM ghcr.io/aixcc-finals/base-builder
|
| 18 |
+
RUN apt-get update && apt-get install -y make
|
| 19 |
+
|
| 20 |
+
COPY . $SRC/external-project
|
| 21 |
+
WORKDIR $SRC/external-project
|
| 22 |
+
COPY .clusterfuzzlite/build.sh $SRC/
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/.clusterfuzzlite/build.sh
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eu
|
| 2 |
+
# Copyright 2020 Google Inc.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
make clean # Not strictly necessary, since we are building in a fresh dir.
|
| 19 |
+
make -j$(nproc) all # Build the fuzz targets.
|
| 20 |
+
|
| 21 |
+
# Copy the fuzzer executables, zip-ed corpora, option and dictionary files to $OUT
|
| 22 |
+
find . -name '*_fuzzer' -exec cp -v '{}' $OUT ';'
|
| 23 |
+
find . -name '*_fuzzer.dict' -exec cp -v '{}' $OUT ';' # If you have dictionaries.
|
| 24 |
+
find . -name '*_fuzzer.options' -exec cp -v '{}' $OUT ';' # If you have custom options.
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/Makefile
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2017 Google Inc. All Rights Reserved.
|
| 2 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 3 |
+
|
| 4 |
+
# Simple example of a build file that nicely integrates a fuzz target
|
| 5 |
+
# with the rest of the project.
|
| 6 |
+
#
|
| 7 |
+
# We use 'make' as the build system, but these ideas are applicable
|
| 8 |
+
# to any other build system
|
| 9 |
+
|
| 10 |
+
# By default, use our own standalone_fuzz_target_runner.
|
| 11 |
+
# This runner does no fuzzing, but simply executes the inputs
|
| 12 |
+
# provided via parameters.
|
| 13 |
+
# Run e.g. "make all LIB_FUZZING_ENGINE=/path/to/libFuzzer.a"
|
| 14 |
+
# to link the fuzzer(s) against a real fuzzing engine.
|
| 15 |
+
#
|
| 16 |
+
# OSS-Fuzz will define its own value for LIB_FUZZING_ENGINE.
|
| 17 |
+
LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o
|
| 18 |
+
|
| 19 |
+
# Values for CC, CFLAGS, CXX, CXXFLAGS are provided by OSS-Fuzz.
|
| 20 |
+
# Outside of OSS-Fuzz use the ones you prefer or rely on the default values.
|
| 21 |
+
# Do not use the -fsanitize=* flags by default.
|
| 22 |
+
# OSS-Fuzz will use different -fsanitize=* flags for different builds (asan, ubsan, msan, ...)
|
| 23 |
+
|
| 24 |
+
# You may add extra compiler flags like this:
|
| 25 |
+
CXXFLAGS += -std=c++11
|
| 26 |
+
|
| 27 |
+
all: do_stuff_fuzzer
|
| 28 |
+
|
| 29 |
+
clean:
|
| 30 |
+
rm -fv *.a *.o *_fuzzer crash-* *.zip
|
| 31 |
+
|
| 32 |
+
# Fuzz target, links against $LIB_FUZZING_ENGINE, so that
|
| 33 |
+
# you may choose which fuzzing engine to use.
|
| 34 |
+
do_stuff_fuzzer: do_stuff_fuzzer.cpp my_api.a standalone_fuzz_target_runner.o
|
| 35 |
+
${CXX} ${CXXFLAGS} $< my_api.a ${LIB_FUZZING_ENGINE} -o $@
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
# The library itself.
|
| 39 |
+
my_api.a: my_api.cpp my_api.h
|
| 40 |
+
${CXX} ${CXXFLAGS} $< -c
|
| 41 |
+
ar ruv my_api.a my_api.o
|
| 42 |
+
|
| 43 |
+
# The standalone fuzz target runner.
|
| 44 |
+
standalone_fuzz_target_runner.o: standalone_fuzz_target_runner.cpp
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.cpp
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2020 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
#include "my_api.h"
|
| 15 |
+
|
| 16 |
+
#include <string>
|
| 17 |
+
|
| 18 |
+
// Simple fuzz target for DoStuff().
|
| 19 |
+
// See https://llvm.org/docs/LibFuzzer.html for details.
|
| 20 |
+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
| 21 |
+
std::string str(reinterpret_cast<const char *>(data), size);
|
| 22 |
+
DoStuff(str); // Disregard the output.
|
| 23 |
+
return 0;
|
| 24 |
+
}
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.dict
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# A dictionary for more efficient fuzzing of DoStuff().
|
| 2 |
+
# If the inputs contain multi-byte tokens, list them here.
|
| 3 |
+
# See https://llvm.org/docs/LibFuzzer.html#dictionaries
|
| 4 |
+
"foo"
|
| 5 |
+
"bar"
|
| 6 |
+
"ouch"
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.cpp
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2020 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
|
| 15 |
+
// Implementation of "my_api".
|
| 16 |
+
#include "my_api.h"
|
| 17 |
+
|
| 18 |
+
#include <vector>
|
| 19 |
+
|
| 20 |
+
// Do some computations with 'str', return the result.
|
| 21 |
+
// This function contains a bug. Can you spot it?
|
| 22 |
+
size_t DoStuff(const std::string &str) {
|
| 23 |
+
std::vector<int> Vec({0, 1, 2, 3, 4});
|
| 24 |
+
size_t Idx = 0;
|
| 25 |
+
if (str.size() > 5)
|
| 26 |
+
Idx++;
|
| 27 |
+
if (str.find("foo") != std::string::npos)
|
| 28 |
+
Idx++;
|
| 29 |
+
if (str.find("bar") != std::string::npos)
|
| 30 |
+
Idx++;
|
| 31 |
+
if (str.find("ouch") != std::string::npos)
|
| 32 |
+
Idx++;
|
| 33 |
+
if (str.find("omg") != std::string::npos)
|
| 34 |
+
Idx++;
|
| 35 |
+
return Vec[Idx];
|
| 36 |
+
}
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.h
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2020 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
|
| 15 |
+
// A library that does ... stuff.
|
| 16 |
+
// Serves as an example of good fuzz testing and OSS-Fuzz integration.
|
| 17 |
+
#include <string>
|
| 18 |
+
|
| 19 |
+
size_t DoStuff(const std::string &str);
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/external-project/standalone_fuzz_target_runner.cpp
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2020 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
|
| 15 |
+
// Example of a standalone runner for "fuzz targets".
|
| 16 |
+
// It reads all files passed as parameters and feeds their contents
|
| 17 |
+
// one by one into the fuzz target (LLVMFuzzerTestOneInput).
|
| 18 |
+
// This runner does not do any fuzzing, but allows us to run the fuzz target
|
| 19 |
+
// on the test corpus (e.g. "do_stuff_test_data") or on a single file,
|
| 20 |
+
// e.g. the one that comes from a bug report.
|
| 21 |
+
|
| 22 |
+
#include <cassert>
|
| 23 |
+
#include <iostream>
|
| 24 |
+
#include <fstream>
|
| 25 |
+
#include <vector>
|
| 26 |
+
|
| 27 |
+
// Forward declare the "fuzz target" interface.
|
| 28 |
+
// We deliberately keep this inteface simple and header-free.
|
| 29 |
+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
| 30 |
+
|
| 31 |
+
int main(int argc, char **argv) {
|
| 32 |
+
for (int i = 1; i < argc; i++) {
|
| 33 |
+
std::ifstream in(argv[i]);
|
| 34 |
+
in.seekg(0, in.end);
|
| 35 |
+
size_t length = in.tellg();
|
| 36 |
+
in.seekg (0, in.beg);
|
| 37 |
+
std::cout << "Reading " << length << " bytes from " << argv[i] << std::endl;
|
| 38 |
+
// Allocate exactly length bytes so that we reliably catch buffer overflows.
|
| 39 |
+
std::vector<char> bytes(length);
|
| 40 |
+
in.read(bytes.data(), bytes.size());
|
| 41 |
+
assert(in);
|
| 42 |
+
LLVMFuzzerTestOneInput(reinterpret_cast<const uint8_t *>(bytes.data()),
|
| 43 |
+
bytes.size());
|
| 44 |
+
std::cout << "Execution successful" << std::endl;
|
| 45 |
+
}
|
| 46 |
+
return 0;
|
| 47 |
+
}
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/sarif_utils_only_llvmfuzzer_stack.txt
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/github/workspace/build-out/fuzz-bus-label -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpsngf52cy/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-bus-label >fuzz-0.log 2>&1
|
| 2 |
+
================== Job 0 exited with exit code 0 ============
|
| 3 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 4 |
+
INFO: Seed: 1337
|
| 5 |
+
INFO: Loaded 2 modules (82577 inline 8-bit counters): 82573 [0x7fc55e6bedf0, 0x7fc55e6d307d), 4 [0x5e9c28, 0x5e9c2c),
|
| 6 |
+
2023-05-04 01:02:55,065 - root - INFO - Not reporting crash in fuzz-bus-label because process timed out.
|
| 7 |
+
2023-05-04 01:02:55,069 - root - INFO - Deleting corpus and seed corpus of fuzz-bus-label to save disk.
|
| 8 |
+
INFO: Loaded 2 PC tables (82577 PCs): 82573 [0x7fc55e6d3080,0x7fc55e815950), 4 [0x5a6c78,0x5a6cb8),
|
| 9 |
+
INFO: 256 files found in /github/workspace/cifuzz-corpus/fuzz-bus-label
|
| 10 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 1048576 bytes
|
| 11 |
+
INFO: seed corpus: files: 256 min: 1b max: 5242880b total: 30968483b rss: 48Mb
|
| 12 |
+
#257 INITED cov: 41 ft: 230 corp: 111/4360b exec/s: 0 rss: 73Mb
|
| 13 |
+
#131072 pulse cov: 41 ft: 230 corp: 111/4360b lim: 1048576 exec/s: 43690 rss: 76Mb
|
| 14 |
+
#262144 pulse cov: 41 ft: 230 corp: 111/4360b lim: 1048576 exec/s: 43690 rss: 76Mb
|
| 15 |
+
#524288 pulse cov: 41 ft: 230 corp: 111/4360b lim: 1048576 exec/s: 43690 rss: 77Mb
|
| 16 |
+
#609082 DONE cov: 41 ft: 230 corp: 111/4360b lim: 1048576 exec/s: 43505 rss: 77Mb
|
| 17 |
+
Done 609082 runs in 14 second(s)
|
| 18 |
+
stat::number_of_executed_units: 609082
|
| 19 |
+
stat::average_exec_per_sec: 43505
|
| 20 |
+
stat::new_units_added: 0
|
| 21 |
+
stat::slowest_unit_time_sec: 0
|
| 22 |
+
stat::peak_rss_mb: 77
|
| 23 |
+
/github/workspace/build-out/fuzz-bus-label -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpsngf52cy/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-bus-label >fuzz-1.log 2>&1
|
| 24 |
+
2023-05-04 01:02:55,082 - root - INFO - Deleting fuzz target: fuzz-bus-label.
|
| 25 |
+
2023-05-04 01:02:55,083 - root - INFO - Done deleting.
|
| 26 |
+
2023-05-04 01:02:55,084 - root - INFO - Fuzzer fuzz-bus-label finished running without reportable crashes.
|
| 27 |
+
2023-05-04 01:02:55,084 - root - INFO - Running fuzzer: fuzz-dhcp-server.
|
| 28 |
+
2023-05-04 01:02:55,085 - root - INFO - Downloading corpus from OSS-Fuzz: https://storage.googleapis.com/systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-dhcp-server/public.zip
|
| 29 |
+
2023-05-04 01:02:55,088 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): storage.googleapis.com:443
|
| 30 |
+
2023-05-04 01:02:55,145 - urllib3.connectionpool - DEBUG - https://storage.googleapis.com:443 "GET /systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-dhcp-server/public.zip HTTP/1.1" 200 806749
|
| 31 |
+
2023-05-04 01:02:55,350 - root - INFO - Starting fuzzing
|
| 32 |
+
Fuzzing logs:
|
| 33 |
+
/github/workspace/build-out/fuzz-dhcp-server -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpyxgwwsvr/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-dhcp-server >fuzz-0.log 2>&1
|
| 34 |
+
================== Job 0 exited with exit code 0 ============
|
| 35 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 36 |
+
INFO: Seed: 1337
|
| 37 |
+
INFO: Loaded 2 modules (83640 inline 8-bit counters): 82573 [0x7fe86ff70df0, 0x7fe86ff8507d), 1067 [0x60c638, 0x60ca63),
|
| 38 |
+
INFO: Loaded 2 PC tables (83640 PCs): 82573 [0x7fe86ff85080,0x7fe8700c7950), 1067 [0x60ca68,0x610d18),
|
| 39 |
+
INFO: 1153 files found in /github/workspace/cifuzz-corpus/fuzz-dhcp-server
|
| 40 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 1048576 bytes
|
| 41 |
+
INFO: seed corpus: files: 1153 min: 1b max: 5242879b total: 17056071b rss: 50Mb
|
| 42 |
+
#1155 INITED cov: 577 ft: 1116 corp: 203/54Kb exec/s: 0 rss: 86Mb
|
| 43 |
+
#1167 NEW cov: 577 ft: 1117 corp: 204/54Kb lim: 1048576 exec/s: 0 rss: 86Mb L: 243/1071 MS: 2 ChangeASCIIInt-CrossOver-
|
| 44 |
+
#1509 NEW cov: 577 ft: 1118 corp: 205/54Kb lim: 1048576 exec/s: 0 rss: 86Mb L: 243/1071 MS: 2 ChangeBit-CopyPart-
|
| 45 |
+
#63018 NEW cov: 577 ft: 1119 corp: 206/55Kb lim: 1048576 exec/s: 21006 rss: 86Mb L: 245/1071 MS: 4 InsertByte-ChangeByte-CMP-InsertByte- DE: "2\000\000\000\000\000\000\000"-
|
| 46 |
+
#65536 pulse cov: 577 ft: 1119 corp: 206/55Kb lim: 1048576 exec/s: 21845 rss: 86Mb
|
| 47 |
+
Loaded 1024/1155 files from /github/workspace/cifuzz-corpus/fuzz-dhcp-server
|
| 48 |
+
#99784 NEW cov: 577 ft: 1120 corp: 207/55Kb lim: 1048576 exec/s: 19956 rss: 105Mb L: 243/1071 MS: 2 ChangeASCIIInt-ChangeBinInt-
|
| 49 |
+
#131072 pulse cov: 577 ft: 1120 corp: 207/55Kb lim: 1048576 exec/s: 21845 rss: 105Mb
|
| 50 |
+
#262144 pulse cov: 577 ft: 1120 corp: 207/55Kb lim: 1048576 exec/s: 20164 rss: 105Mb
|
| 51 |
+
#275639 DONE cov: 577 ft: 1120 corp: 207/55Kb lim: 1048576 exec/s: 19688 rss: 105Mb
|
| 52 |
+
###### Recommended dictionary. ######
|
| 53 |
+
"2\000\000\000\000\000\000\000" # Uses: 17879
|
| 54 |
+
###### End of recommended dictionary. ######
|
| 55 |
+
Done 275639 runs in 14 second(s)
|
| 56 |
+
stat::number_of_executed_units: 275639
|
| 57 |
+
stat::average_exec_per_sec: 19688
|
| 58 |
+
stat::new_units_added: 4
|
| 59 |
+
stat::slowest_unit_time_sec: 0
|
| 60 |
+
stat::peak_rss_mb: 105
|
| 61 |
+
/github/workspace/build-out/fuzz-dhcp-server -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpyxgwwsvr/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-dhcp-server >fuzz-1.log 2>&1
|
| 62 |
+
2023-05-04 01:03:18,374 - root - INFO - Not reporting crash in fuzz-dhcp-server because process timed out.
|
| 63 |
+
2023-05-04 01:03:18,377 - root - INFO - Deleting corpus and seed corpus of fuzz-dhcp-server to save disk.
|
| 64 |
+
2023-05-04 01:03:18,399 - root - INFO - Deleting fuzz target: fuzz-dhcp-server.
|
| 65 |
+
2023-05-04 01:03:18,400 - root - INFO - Done deleting.
|
| 66 |
+
2023-05-04 01:03:18,400 - root - INFO - Fuzzer fuzz-dhcp-server finished running without reportable crashes.
|
| 67 |
+
2023-05-04 01:03:18,401 - root - INFO - Running fuzzer: fuzz-bcd.
|
| 68 |
+
2023-05-04 01:03:18,401 - root - INFO - Downloading corpus from OSS-Fuzz: https://storage.googleapis.com/systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-bcd/public.zip
|
| 69 |
+
2023-05-04 01:03:18,404 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): storage.googleapis.com:443
|
| 70 |
+
2023-05-04 01:03:18,582 - urllib3.connectionpool - DEBUG - https://storage.googleapis.com:443 "GET /systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-bcd/public.zip HTTP/1.1" 200 2293254
|
| 71 |
+
2023-05-04 01:03:18,804 - root - INFO - Starting fuzzing
|
| 72 |
+
Fuzzing logs:
|
| 73 |
+
/github/workspace/build-out/fuzz-bcd -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpgvqlyr8q/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-bcd >fuzz-0.log 2>&1
|
| 74 |
+
================== Job 0 exited with exit code 0 ============
|
| 75 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 76 |
+
INFO: Seed: 1337
|
| 77 |
+
INFO: Loaded 2 modules (83175 inline 8-bit counters): 82573 [0x7f1b5387edf0, 0x7f1b5389307d), 602 [0x5f8718, 0x5f8972),
|
| 78 |
+
INFO: Loaded 2 PC tables (83175 PCs): 82573 [0x7f1b53893080,0x7f1b539d5950), 602 [0x5f8978,0x5faf18),
|
| 79 |
+
INFO: 1260 files found in /github/workspace/cifuzz-corpus/fuzz-bcd
|
| 80 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 946175 bytes
|
| 81 |
+
INFO: seed corpus: files: 1260 min: 1b max: 946175b total: 10373697b rss: 48Mb
|
| 82 |
+
#1261 INITED cov: 137 ft: 653 corp: 282/1416Kb exec/s: 0 rss: 91Mb
|
| 83 |
+
#65536 pulse cov: 137 ft: 653 corp: 282/1416Kb lim: 946175 exec/s: 32768 rss: 98Mb
|
| 84 |
+
#131072 pulse cov: 137 ft: 653 corp: 282/1416Kb lim: 946175 exec/s: 32768 rss: 98Mb
|
| 85 |
+
#262144 pulse cov: 137 ft: 653 corp: 282/1416Kb lim: 946175 exec/s: 37449 rss: 98Mb
|
| 86 |
+
#475081 DONE cov: 137 ft: 653 corp: 282/1416Kb lim: 946175 exec/s: 33934 rss: 98Mb
|
| 87 |
+
Done 475081 runs in 14 second(s)
|
| 88 |
+
stat::number_of_executed_units: 475081
|
| 89 |
+
stat::average_exec_per_sec: 33934
|
| 90 |
+
stat::new_units_added: 0
|
| 91 |
+
stat::slowest_unit_time_sec: 0
|
| 92 |
+
stat::peak_rss_mb: 98
|
| 93 |
+
/github/workspace/build-out/fuzz-bcd -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpgvqlyr8q/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-bcd >fuzz-1.log 2>&1
|
| 94 |
+
2023-05-04 01:03:41,821 - root - INFO - Not reporting crash in fuzz-bcd because process timed out.
|
| 95 |
+
2023-05-04 01:03:41,822 - root - INFO - Deleting corpus and seed corpus of fuzz-bcd to save disk.
|
| 96 |
+
2023-05-04 01:03:41,848 - root - INFO - Deleting fuzz target: fuzz-bcd.
|
| 97 |
+
2023-05-04 01:03:41,848 - root - INFO - Done deleting.
|
| 98 |
+
2023-05-04 01:03:41,848 - root - INFO - Fuzzer fuzz-bcd finished running without reportable crashes.
|
| 99 |
+
2023-05-04 01:03:41,848 - root - INFO - Running fuzzer: fuzz-varlink.
|
| 100 |
+
2023-05-04 01:03:41,849 - root - INFO - Downloading corpus from OSS-Fuzz: https://storage.googleapis.com/systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-varlink/public.zip
|
| 101 |
+
2023-05-04 01:03:41,852 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): storage.googleapis.com:443
|
| 102 |
+
2023-05-04 01:03:41,906 - urllib3.connectionpool - DEBUG - https://storage.googleapis.com:443 "GET /systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-varlink/public.zip HTTP/1.1" 200 2586434
|
| 103 |
+
2023-05-04 01:03:42,671 - root - INFO - Starting fuzzing
|
| 104 |
+
2023-05-04 01:04:05,709 - root - INFO - Not reporting crash in fuzz-varlink because process timed out.
|
| 105 |
+
Fuzzing logs:
|
| 106 |
+
/github/workspace/build-out/fuzz-varlink -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpbtf4f932/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-varlink >fuzz-0.log 2>&1
|
| 107 |
+
2023-05-04 01:04:05,709 - root - INFO - Deleting corpus and seed corpus of fuzz-varlink to save disk.
|
| 108 |
+
2023-05-04 01:04:05,806 - root - INFO - Deleting fuzz target: fuzz-varlink.
|
| 109 |
+
2023-05-04 01:04:05,806 - root - INFO - Done deleting.
|
| 110 |
+
2023-05-04 01:04:05,806 - root - INFO - Fuzzer fuzz-varlink finished running without reportable crashes.
|
| 111 |
+
2023-05-04 01:04:05,806 - root - INFO - Running fuzzer: fuzz-unit-file.
|
| 112 |
+
2023-05-04 01:04:05,807 - root - INFO - Downloading corpus from OSS-Fuzz: https://storage.googleapis.com/systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-unit-file/public.zip
|
| 113 |
+
2023-05-04 01:04:05,809 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): storage.googleapis.com:443
|
| 114 |
+
2023-05-04 01:04:05,897 - urllib3.connectionpool - DEBUG - https://storage.googleapis.com:443 "GET /systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-unit-file/public.zip HTTP/1.1" 200 4999974
|
| 115 |
+
2023-05-04 01:04:07,869 - root - INFO - Starting fuzzing
|
| 116 |
+
2023-05-04 01:04:09,516 - root - INFO - Fuzzer: fuzz-unit-file. Detected bug.
|
| 117 |
+
Fuzzing logs:
|
| 118 |
+
/github/workspace/build-out/fuzz-unit-file -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpjhswtxiw/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-unit-file >fuzz-0.log 2>&1
|
| 119 |
+
2023-05-04 01:04:09,517 - root - INFO - Trying to reproduce crash using: /tmp/tmpjhswtxiw/crash-7be9e0f3a71d95f8d5e67c5a9d84273d6f4e3c03.
|
| 120 |
+
================== Job 0 exited with exit code 77 ============
|
| 121 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 122 |
+
INFO: Seed: 1337
|
| 123 |
+
INFO: Loaded 2 modules (82576 inline 8-bit counters): 82573 [0x7f3b0de4cdf0, 0x7f3b0de6107d), 3 [0x5e9b28, 0x5e9b2b),
|
| 124 |
+
INFO: Loaded 2 PC tables (82576 PCs): 82573 [0x7f3b0de61080,0x7f3b0dfa3950), 3 [0x5a6af8,0x5a6b28),
|
| 125 |
+
INFO: 20907 files found in /github/workspace/cifuzz-corpus/fuzz-unit-file
|
| 126 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 604973 bytes
|
| 127 |
+
INFO: seed corpus: files: 20907 min: 1b max: 604973b total: 16005340b rss: 61Mb
|
| 128 |
+
=================================================================
|
| 129 |
+
==74==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000005078 at pc 0x0000004ddffa bp 0x7fffeea64fe0 sp 0x7fffeea64fd8
|
| 130 |
+
READ of size 4 at 0x602000005078 thread T0
|
| 131 |
+
SCARINESS: 27 (4-byte-read-heap-buffer-overflow-far-from-bounds)
|
| 132 |
+
#0 0x4ddff9 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:30:16
|
| 133 |
+
#1 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 134 |
+
#2 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 135 |
+
#3 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 136 |
+
#4 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 137 |
+
#5 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 138 |
+
#6 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 139 |
+
#7 0x7f3b0ce20082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 140 |
+
#8 0x41f6ed in _start (build-out/fuzz-unit-file+0x41f6ed)
|
| 141 |
+
|
| 142 |
+
DEDUP_TOKEN: LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)--fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*)
|
| 143 |
+
0x602000005078 is located 38 bytes to the right of 2-byte region [0x602000005050,0x602000005052)
|
| 144 |
+
freed by thread T0 here:
|
| 145 |
+
#0 0x4a0882 in __interceptor_free /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:52:3
|
| 146 |
+
#1 0x4ddfb7 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:29:9
|
| 147 |
+
#2 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 148 |
+
#3 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 149 |
+
#4 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 150 |
+
#5 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 151 |
+
#6 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 152 |
+
#7 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 153 |
+
#8 0x7f3b0ce20082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 154 |
+
|
| 155 |
+
DEDUP_TOKEN: __interceptor_free--LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 156 |
+
previously allocated by thread T0 here:
|
| 157 |
+
#0 0x4a0b26 in malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
|
| 158 |
+
#1 0x4ddfac in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:28:25
|
| 159 |
+
#2 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 160 |
+
#3 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 161 |
+
#4 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 162 |
+
#5 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 163 |
+
#6 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 164 |
+
#7 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 165 |
+
#8 0x7f3b0ce20082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 166 |
+
|
| 167 |
+
DEDUP_TOKEN: malloc--LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 168 |
+
SUMMARY: AddressSanitizer: heap-buffer-overflow /work/build/../../src/systemd/src/core/fuzz-unit-file.c:30:16 in LLVMFuzzerTestOneInput
|
| 169 |
+
Shadow bytes around the buggy address:
|
| 170 |
+
0x0c047fff89b0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 171 |
+
0x0c047fff89c0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 172 |
+
0x0c047fff89d0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 173 |
+
0x0c047fff89e0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 174 |
+
0x0c047fff89f0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 175 |
+
=>0x0c047fff8a00: fa fa 00 02 fa fa 00 02 fa fa fd fa fa fa fa[fa]
|
| 176 |
+
0x0c047fff8a10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 177 |
+
0x0c047fff8a20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 178 |
+
0x0c047fff8a30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 179 |
+
0x0c047fff8a40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 180 |
+
0x0c047fff8a50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 181 |
+
Shadow byte legend (one shadow byte represents 8 application bytes):
|
| 182 |
+
Addressable: 00
|
| 183 |
+
Partially addressable: 01 02 03 04 05 06 07
|
| 184 |
+
Heap left redzone: fa
|
| 185 |
+
Freed heap region: fd
|
| 186 |
+
Stack left redzone: f1
|
| 187 |
+
Stack mid redzone: f2
|
| 188 |
+
Stack right redzone: f3
|
| 189 |
+
Stack after return: f5
|
| 190 |
+
Stack use after scope: f8
|
| 191 |
+
Global redzone: f9
|
| 192 |
+
Global init order: f6
|
| 193 |
+
Poisoned by user: f7
|
| 194 |
+
Container overflow: fc
|
| 195 |
+
Array cookie: ac
|
| 196 |
+
Intra object redzone: bb
|
| 197 |
+
ASan internal: fe
|
| 198 |
+
Left alloca redzone: ca
|
| 199 |
+
Right alloca redzone: cb
|
| 200 |
+
==74==ABORTING
|
| 201 |
+
MS: 0 ; base unit: 0000000000000000000000000000000000000000
|
| 202 |
+
0x61,0x75,0x74,0x6f,0x6d,0x6f,0x75,0x6e,0x74,0x48,
|
| 203 |
+
automountH
|
| 204 |
+
artifact_prefix='/tmp/tmpjhswtxiw/'; Test unit written to /tmp/tmpjhswtxiw/crash-7be9e0f3a71d95f8d5e67c5a9d84273d6f4e3c03
|
| 205 |
+
Base64: YXV0b21vdW50SA==
|
| 206 |
+
stat::number_of_executed_units: 314
|
| 207 |
+
stat::average_exec_per_sec: 0
|
| 208 |
+
stat::new_units_added: 0
|
| 209 |
+
stat::slowest_unit_time_sec: 0
|
| 210 |
+
stat::peak_rss_mb: 67
|
| 211 |
+
/github/workspace/build-out/fuzz-unit-file -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpjhswtxiw/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-unit-file >fuzz-1.log 2>&1
|
| 212 |
+
================== Job 1 exited with exit code 77 ============
|
| 213 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 214 |
+
INFO: Seed: 1337
|
| 215 |
+
INFO: Loaded 2 modules (82576 inline 8-bit counters): 82573 [0x7ff1ba038df0, 0x7ff1ba04d07d), 3 [0x5e9b28, 0x5e9b2b),
|
| 216 |
+
INFO: Loaded 2 PC tables (82576 PCs): 82573 [0x7ff1ba04d080,0x7ff1ba18f950), 3 [0x5a6af8,0x5a6b28),
|
| 217 |
+
INFO: 20907 files found in /github/workspace/cifuzz-corpus/fuzz-unit-file
|
| 218 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 604973 bytes
|
| 219 |
+
INFO: seed corpus: files: 20907 min: 1b max: 604973b total: 16005340b rss: 61Mb
|
| 220 |
+
=================================================================
|
| 221 |
+
==78==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000005078 at pc 0x0000004ddffa bp 0x7ffc2e6825c0 sp 0x7ffc2e6825b8
|
| 222 |
+
READ of size 4 at 0x602000005078 thread T0
|
| 223 |
+
SCARINESS: 27 (4-byte-read-heap-buffer-overflow-far-from-bounds)
|
| 224 |
+
#0 0x4ddff9 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:30:16
|
| 225 |
+
#1 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 226 |
+
#2 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 227 |
+
#3 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 228 |
+
#4 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 229 |
+
#5 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 230 |
+
#6 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 231 |
+
#7 0x7ff1b900c082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 232 |
+
#8 0x41f6ed in _start (build-out/fuzz-unit-file+0x41f6ed)
|
| 233 |
+
|
| 234 |
+
DEDUP_TOKEN: LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)--fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*)
|
| 235 |
+
0x602000005078 is located 38 bytes to the right of 2-byte region [0x602000005050,0x602000005052)
|
| 236 |
+
freed by thread T0 here:
|
| 237 |
+
#0 0x4a0882 in __interceptor_free /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:52:3
|
| 238 |
+
#1 0x4ddfb7 in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:29:9
|
| 239 |
+
#2 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 240 |
+
#3 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 241 |
+
#4 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 242 |
+
#5 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 243 |
+
#6 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 244 |
+
#7 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 245 |
+
#8 0x7ff1b900c082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 246 |
+
|
| 247 |
+
DEDUP_TOKEN: __interceptor_free--LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 248 |
+
previously allocated by thread T0 here:
|
| 249 |
+
#0 0x4a0b26 in malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
|
| 250 |
+
#1 0x4ddfac in LLVMFuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:28:25
|
| 251 |
+
#2 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 252 |
+
#3 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 253 |
+
#4 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 254 |
+
#5 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 255 |
+
#6 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 256 |
+
#7 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 257 |
+
#8 0x7ff1b900c082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 258 |
+
|
| 259 |
+
DEDUP_TOKEN: malloc--samLLVM2FuzzerTestOneInput --fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 260 |
+
SUMMARY: AddressSanitizer: heap-buffer-overflow /work/build/../../src/systemd/src/core/fuzz-unit-file.c:30:16 in samsamLLVM2FuzzerTestOneInput
|
| 261 |
+
Shadow bytes around the buggy address:
|
| 262 |
+
0x0c047fff89b0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 263 |
+
0x0c047fff89c0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 264 |
+
0x0c047fff89d0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 265 |
+
0x0c047fff89e0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 266 |
+
0x0c047fff89f0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 267 |
+
=>0x0c047fff8a00: fa fa 00 02 fa fa 00 02 fa fa fd fa fa fa fa[fa]
|
| 268 |
+
0x0c047fff8a10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 269 |
+
0x0c047fff8a20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 270 |
+
0x0c047fff8a30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 271 |
+
0x0c047fff8a40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 272 |
+
0x0c047fff8a50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 273 |
+
Shadow byte legend (one shadow byte represents 8 application bytes):
|
| 274 |
+
Addressable: 00
|
| 275 |
+
Partially addressable: 01 02 03 04 05 06 07
|
| 276 |
+
Heap left redzone: fa
|
| 277 |
+
Freed heap region: fd
|
| 278 |
+
Stack left redzone: f1
|
| 279 |
+
Stack mid redzone: f2
|
| 280 |
+
Stack right redzone: f3
|
| 281 |
+
Stack after return: f5
|
| 282 |
+
Stack use after scope: f8
|
| 283 |
+
Global redzone: f9
|
| 284 |
+
Global init order: f6
|
| 285 |
+
Poisoned by user: f7
|
| 286 |
+
Container overflow: fc
|
| 287 |
+
Array cookie: ac
|
| 288 |
+
Intra object redzone: bb
|
| 289 |
+
ASan internal: fe
|
| 290 |
+
Left alloca redzone: ca
|
| 291 |
+
Right alloca redzone: cb
|
| 292 |
+
==78==ABORTING
|
| 293 |
+
MS: 0 ; base unit: 0000000000000000000000000000000000000000
|
| 294 |
+
0x61,0x75,0x74,0x6f,0x6d,0x6f,0x75,0x6e,0x74,0x48,
|
| 295 |
+
automountH
|
| 296 |
+
artifact_prefix='/tmp/tmpjhswtxiw/'; Test unit written to /tmp/tmpjhswtxiw/crash-7be9e0f3a71d95f8d5e67c5a9d84273d6f4e3c03
|
| 297 |
+
Base64: YXV0b21vdW50SA==
|
| 298 |
+
stat::number_of_executed_units: 314
|
| 299 |
+
stat::average_exec_per_sec: 0
|
| 300 |
+
stat::new_units_added: 0
|
| 301 |
+
stat::slowest_unit_time_sec: 0
|
| 302 |
+
stat::peak_rss_mb: 68
|
local-test-tika-delta-04/fuzz-tooling/infra/cifuzz/test_data/sarif_utils_systemd_stack.txt
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/github/workspace/build-out/fuzz-bus-label -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpsngf52cy/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-bus-label >fuzz-0.log 2>&1
|
| 2 |
+
================== Job 0 exited with exit code 0 ============
|
| 3 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 4 |
+
INFO: Seed: 1337
|
| 5 |
+
INFO: Loaded 2 modules (82577 inline 8-bit counters): 82573 [0x7fc55e6bedf0, 0x7fc55e6d307d), 4 [0x5e9c28, 0x5e9c2c),
|
| 6 |
+
2023-05-04 01:02:55,065 - root - INFO - Not reporting crash in fuzz-bus-label because process timed out.
|
| 7 |
+
2023-05-04 01:02:55,069 - root - INFO - Deleting corpus and seed corpus of fuzz-bus-label to save disk.
|
| 8 |
+
INFO: Loaded 2 PC tables (82577 PCs): 82573 [0x7fc55e6d3080,0x7fc55e815950), 4 [0x5a6c78,0x5a6cb8),
|
| 9 |
+
INFO: 256 files found in /github/workspace/cifuzz-corpus/fuzz-bus-label
|
| 10 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 1048576 bytes
|
| 11 |
+
INFO: seed corpus: files: 256 min: 1b max: 5242880b total: 30968483b rss: 48Mb
|
| 12 |
+
#257 INITED cov: 41 ft: 230 corp: 111/4360b exec/s: 0 rss: 73Mb
|
| 13 |
+
#131072 pulse cov: 41 ft: 230 corp: 111/4360b lim: 1048576 exec/s: 43690 rss: 76Mb
|
| 14 |
+
#262144 pulse cov: 41 ft: 230 corp: 111/4360b lim: 1048576 exec/s: 43690 rss: 76Mb
|
| 15 |
+
#524288 pulse cov: 41 ft: 230 corp: 111/4360b lim: 1048576 exec/s: 43690 rss: 77Mb
|
| 16 |
+
#609082 DONE cov: 41 ft: 230 corp: 111/4360b lim: 1048576 exec/s: 43505 rss: 77Mb
|
| 17 |
+
Done 609082 runs in 14 second(s)
|
| 18 |
+
stat::number_of_executed_units: 609082
|
| 19 |
+
stat::average_exec_per_sec: 43505
|
| 20 |
+
stat::new_units_added: 0
|
| 21 |
+
stat::slowest_unit_time_sec: 0
|
| 22 |
+
stat::peak_rss_mb: 77
|
| 23 |
+
/github/workspace/build-out/fuzz-bus-label -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpsngf52cy/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-bus-label >fuzz-1.log 2>&1
|
| 24 |
+
2023-05-04 01:02:55,082 - root - INFO - Deleting fuzz target: fuzz-bus-label.
|
| 25 |
+
2023-05-04 01:02:55,083 - root - INFO - Done deleting.
|
| 26 |
+
2023-05-04 01:02:55,084 - root - INFO - Fuzzer fuzz-bus-label finished running without reportable crashes.
|
| 27 |
+
2023-05-04 01:02:55,084 - root - INFO - Running fuzzer: fuzz-dhcp-server.
|
| 28 |
+
2023-05-04 01:02:55,085 - root - INFO - Downloading corpus from OSS-Fuzz: https://storage.googleapis.com/systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-dhcp-server/public.zip
|
| 29 |
+
2023-05-04 01:02:55,088 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): storage.googleapis.com:443
|
| 30 |
+
2023-05-04 01:02:55,145 - urllib3.connectionpool - DEBUG - https://storage.googleapis.com:443 "GET /systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-dhcp-server/public.zip HTTP/1.1" 200 806749
|
| 31 |
+
2023-05-04 01:02:55,350 - root - INFO - Starting fuzzing
|
| 32 |
+
Fuzzing logs:
|
| 33 |
+
/github/workspace/build-out/fuzz-dhcp-server -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpyxgwwsvr/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-dhcp-server >fuzz-0.log 2>&1
|
| 34 |
+
================== Job 0 exited with exit code 0 ============
|
| 35 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 36 |
+
INFO: Seed: 1337
|
| 37 |
+
INFO: Loaded 2 modules (83640 inline 8-bit counters): 82573 [0x7fe86ff70df0, 0x7fe86ff8507d), 1067 [0x60c638, 0x60ca63),
|
| 38 |
+
INFO: Loaded 2 PC tables (83640 PCs): 82573 [0x7fe86ff85080,0x7fe8700c7950), 1067 [0x60ca68,0x610d18),
|
| 39 |
+
INFO: 1153 files found in /github/workspace/cifuzz-corpus/fuzz-dhcp-server
|
| 40 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 1048576 bytes
|
| 41 |
+
INFO: seed corpus: files: 1153 min: 1b max: 5242879b total: 17056071b rss: 50Mb
|
| 42 |
+
#1155 INITED cov: 577 ft: 1116 corp: 203/54Kb exec/s: 0 rss: 86Mb
|
| 43 |
+
#1167 NEW cov: 577 ft: 1117 corp: 204/54Kb lim: 1048576 exec/s: 0 rss: 86Mb L: 243/1071 MS: 2 ChangeASCIIInt-CrossOver-
|
| 44 |
+
#1509 NEW cov: 577 ft: 1118 corp: 205/54Kb lim: 1048576 exec/s: 0 rss: 86Mb L: 243/1071 MS: 2 ChangeBit-CopyPart-
|
| 45 |
+
#63018 NEW cov: 577 ft: 1119 corp: 206/55Kb lim: 1048576 exec/s: 21006 rss: 86Mb L: 245/1071 MS: 4 InsertByte-ChangeByte-CMP-InsertByte- DE: "2\000\000\000\000\000\000\000"-
|
| 46 |
+
#65536 pulse cov: 577 ft: 1119 corp: 206/55Kb lim: 1048576 exec/s: 21845 rss: 86Mb
|
| 47 |
+
Loaded 1024/1155 files from /github/workspace/cifuzz-corpus/fuzz-dhcp-server
|
| 48 |
+
#99784 NEW cov: 577 ft: 1120 corp: 207/55Kb lim: 1048576 exec/s: 19956 rss: 105Mb L: 243/1071 MS: 2 ChangeASCIIInt-ChangeBinInt-
|
| 49 |
+
#131072 pulse cov: 577 ft: 1120 corp: 207/55Kb lim: 1048576 exec/s: 21845 rss: 105Mb
|
| 50 |
+
#262144 pulse cov: 577 ft: 1120 corp: 207/55Kb lim: 1048576 exec/s: 20164 rss: 105Mb
|
| 51 |
+
#275639 DONE cov: 577 ft: 1120 corp: 207/55Kb lim: 1048576 exec/s: 19688 rss: 105Mb
|
| 52 |
+
###### Recommended dictionary. ######
|
| 53 |
+
"2\000\000\000\000\000\000\000" # Uses: 17879
|
| 54 |
+
###### End of recommended dictionary. ######
|
| 55 |
+
Done 275639 runs in 14 second(s)
|
| 56 |
+
stat::number_of_executed_units: 275639
|
| 57 |
+
stat::average_exec_per_sec: 19688
|
| 58 |
+
stat::new_units_added: 4
|
| 59 |
+
stat::slowest_unit_time_sec: 0
|
| 60 |
+
stat::peak_rss_mb: 105
|
| 61 |
+
/github/workspace/build-out/fuzz-dhcp-server -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpyxgwwsvr/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-dhcp-server >fuzz-1.log 2>&1
|
| 62 |
+
2023-05-04 01:03:18,374 - root - INFO - Not reporting crash in fuzz-dhcp-server because process timed out.
|
| 63 |
+
2023-05-04 01:03:18,377 - root - INFO - Deleting corpus and seed corpus of fuzz-dhcp-server to save disk.
|
| 64 |
+
2023-05-04 01:03:18,399 - root - INFO - Deleting fuzz target: fuzz-dhcp-server.
|
| 65 |
+
2023-05-04 01:03:18,400 - root - INFO - Done deleting.
|
| 66 |
+
2023-05-04 01:03:18,400 - root - INFO - Fuzzer fuzz-dhcp-server finished running without reportable crashes.
|
| 67 |
+
2023-05-04 01:03:18,401 - root - INFO - Running fuzzer: fuzz-bcd.
|
| 68 |
+
2023-05-04 01:03:18,401 - root - INFO - Downloading corpus from OSS-Fuzz: https://storage.googleapis.com/systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-bcd/public.zip
|
| 69 |
+
2023-05-04 01:03:18,404 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): storage.googleapis.com:443
|
| 70 |
+
2023-05-04 01:03:18,582 - urllib3.connectionpool - DEBUG - https://storage.googleapis.com:443 "GET /systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-bcd/public.zip HTTP/1.1" 200 2293254
|
| 71 |
+
2023-05-04 01:03:18,804 - root - INFO - Starting fuzzing
|
| 72 |
+
Fuzzing logs:
|
| 73 |
+
/github/workspace/build-out/fuzz-bcd -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpgvqlyr8q/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-bcd >fuzz-0.log 2>&1
|
| 74 |
+
================== Job 0 exited with exit code 0 ============
|
| 75 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 76 |
+
INFO: Seed: 1337
|
| 77 |
+
INFO: Loaded 2 modules (83175 inline 8-bit counters): 82573 [0x7f1b5387edf0, 0x7f1b5389307d), 602 [0x5f8718, 0x5f8972),
|
| 78 |
+
INFO: Loaded 2 PC tables (83175 PCs): 82573 [0x7f1b53893080,0x7f1b539d5950), 602 [0x5f8978,0x5faf18),
|
| 79 |
+
INFO: 1260 files found in /github/workspace/cifuzz-corpus/fuzz-bcd
|
| 80 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 946175 bytes
|
| 81 |
+
INFO: seed corpus: files: 1260 min: 1b max: 946175b total: 10373697b rss: 48Mb
|
| 82 |
+
#1261 INITED cov: 137 ft: 653 corp: 282/1416Kb exec/s: 0 rss: 91Mb
|
| 83 |
+
#65536 pulse cov: 137 ft: 653 corp: 282/1416Kb lim: 946175 exec/s: 32768 rss: 98Mb
|
| 84 |
+
#131072 pulse cov: 137 ft: 653 corp: 282/1416Kb lim: 946175 exec/s: 32768 rss: 98Mb
|
| 85 |
+
#262144 pulse cov: 137 ft: 653 corp: 282/1416Kb lim: 946175 exec/s: 37449 rss: 98Mb
|
| 86 |
+
#475081 DONE cov: 137 ft: 653 corp: 282/1416Kb lim: 946175 exec/s: 33934 rss: 98Mb
|
| 87 |
+
Done 475081 runs in 14 second(s)
|
| 88 |
+
stat::number_of_executed_units: 475081
|
| 89 |
+
stat::average_exec_per_sec: 33934
|
| 90 |
+
stat::new_units_added: 0
|
| 91 |
+
stat::slowest_unit_time_sec: 0
|
| 92 |
+
stat::peak_rss_mb: 98
|
| 93 |
+
/github/workspace/build-out/fuzz-bcd -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpgvqlyr8q/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-bcd >fuzz-1.log 2>&1
|
| 94 |
+
2023-05-04 01:03:41,821 - root - INFO - Not reporting crash in fuzz-bcd because process timed out.
|
| 95 |
+
2023-05-04 01:03:41,822 - root - INFO - Deleting corpus and seed corpus of fuzz-bcd to save disk.
|
| 96 |
+
2023-05-04 01:03:41,848 - root - INFO - Deleting fuzz target: fuzz-bcd.
|
| 97 |
+
2023-05-04 01:03:41,848 - root - INFO - Done deleting.
|
| 98 |
+
2023-05-04 01:03:41,848 - root - INFO - Fuzzer fuzz-bcd finished running without reportable crashes.
|
| 99 |
+
2023-05-04 01:03:41,848 - root - INFO - Running fuzzer: fuzz-varlink.
|
| 100 |
+
2023-05-04 01:03:41,849 - root - INFO - Downloading corpus from OSS-Fuzz: https://storage.googleapis.com/systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-varlink/public.zip
|
| 101 |
+
2023-05-04 01:03:41,852 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): storage.googleapis.com:443
|
| 102 |
+
2023-05-04 01:03:41,906 - urllib3.connectionpool - DEBUG - https://storage.googleapis.com:443 "GET /systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-varlink/public.zip HTTP/1.1" 200 2586434
|
| 103 |
+
2023-05-04 01:03:42,671 - root - INFO - Starting fuzzing
|
| 104 |
+
2023-05-04 01:04:05,709 - root - INFO - Not reporting crash in fuzz-varlink because process timed out.
|
| 105 |
+
Fuzzing logs:
|
| 106 |
+
/github/workspace/build-out/fuzz-varlink -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpbtf4f932/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-varlink >fuzz-0.log 2>&1
|
| 107 |
+
2023-05-04 01:04:05,709 - root - INFO - Deleting corpus and seed corpus of fuzz-varlink to save disk.
|
| 108 |
+
2023-05-04 01:04:05,806 - root - INFO - Deleting fuzz target: fuzz-varlink.
|
| 109 |
+
2023-05-04 01:04:05,806 - root - INFO - Done deleting.
|
| 110 |
+
2023-05-04 01:04:05,806 - root - INFO - Fuzzer fuzz-varlink finished running without reportable crashes.
|
| 111 |
+
2023-05-04 01:04:05,806 - root - INFO - Running fuzzer: fuzz-unit-file.
|
| 112 |
+
2023-05-04 01:04:05,807 - root - INFO - Downloading corpus from OSS-Fuzz: https://storage.googleapis.com/systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-unit-file/public.zip
|
| 113 |
+
2023-05-04 01:04:05,809 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): storage.googleapis.com:443
|
| 114 |
+
2023-05-04 01:04:05,897 - urllib3.connectionpool - DEBUG - https://storage.googleapis.com:443 "GET /systemd-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/systemd_fuzz-unit-file/public.zip HTTP/1.1" 200 4999974
|
| 115 |
+
2023-05-04 01:04:07,869 - root - INFO - Starting fuzzing
|
| 116 |
+
2023-05-04 01:04:09,516 - root - INFO - Fuzzer: fuzz-unit-file. Detected bug.
|
| 117 |
+
Fuzzing logs:
|
| 118 |
+
/github/workspace/build-out/fuzz-unit-file -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpjhswtxiw/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-unit-file >fuzz-0.log 2>&1
|
| 119 |
+
2023-05-04 01:04:09,517 - root - INFO - Trying to reproduce crash using: /tmp/tmpjhswtxiw/crash-7be9e0f3a71d95f8d5e67c5a9d84273d6f4e3c03.
|
| 120 |
+
================== Job 0 exited with exit code 77 ============
|
| 121 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 122 |
+
INFO: Seed: 1337
|
| 123 |
+
INFO: Loaded 2 modules (82576 inline 8-bit counters): 82573 [0x7f3b0de4cdf0, 0x7f3b0de6107d), 3 [0x5e9b28, 0x5e9b2b),
|
| 124 |
+
INFO: Loaded 2 PC tables (82576 PCs): 82573 [0x7f3b0de61080,0x7f3b0dfa3950), 3 [0x5a6af8,0x5a6b28),
|
| 125 |
+
INFO: 20907 files found in /github/workspace/cifuzz-corpus/fuzz-unit-file
|
| 126 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 604973 bytes
|
| 127 |
+
INFO: seed corpus: files: 20907 min: 1b max: 604973b total: 16005340b rss: 61Mb
|
| 128 |
+
=================================================================
|
| 129 |
+
==74==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000005078 at pc 0x0000004ddffa bp 0x7fffeea64fe0 sp 0x7fffeea64fd8
|
| 130 |
+
READ of size 4 at 0x602000005078 thread T0
|
| 131 |
+
SCARINESS: 27 (4-byte-read-heap-buffer-overflow-far-from-bounds)
|
| 132 |
+
#0 0x4ddff9 in samLLVM2FuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:30:16
|
| 133 |
+
#1 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 134 |
+
#2 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 135 |
+
#3 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 136 |
+
#4 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 137 |
+
#5 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 138 |
+
#6 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 139 |
+
#7 0x7f3b0ce20082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 140 |
+
#8 0x41f6ed in _start (build-out/fuzz-unit-file+0x41f6ed)
|
| 141 |
+
|
| 142 |
+
DEDUP_TOKEN: samLLVM2FuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)--fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*)
|
| 143 |
+
0x602000005078 is located 38 bytes to the right of 2-byte region [0x602000005050,0x602000005052)
|
| 144 |
+
freed by thread T0 here:
|
| 145 |
+
#0 0x4a0882 in __interceptor_free /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:52:3
|
| 146 |
+
#1 0x4ddfb7 in samLLVM2FuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:29:9
|
| 147 |
+
#2 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 148 |
+
#3 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 149 |
+
#4 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 150 |
+
#5 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 151 |
+
#6 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 152 |
+
#7 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 153 |
+
#8 0x7f3b0ce20082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 154 |
+
|
| 155 |
+
DEDUP_TOKEN: __interceptor_free--samLLVM2FuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 156 |
+
previously allocated by thread T0 here:
|
| 157 |
+
#0 0x4a0b26 in malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
|
| 158 |
+
#1 0x4ddfac in samLLVM2FuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:28:25
|
| 159 |
+
#2 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 160 |
+
#3 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 161 |
+
#4 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 162 |
+
#5 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 163 |
+
#6 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 164 |
+
#7 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 165 |
+
#8 0x7f3b0ce20082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 166 |
+
|
| 167 |
+
DEDUP_TOKEN: malloc--samLLVM2FuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 168 |
+
SUMMARY: AddressSanitizer: heap-buffer-overflow /work/build/../../src/systemd/src/core/fuzz-unit-file.c:30:16 in samLLVM2FuzzerTestOneInput
|
| 169 |
+
Shadow bytes around the buggy address:
|
| 170 |
+
0x0c047fff89b0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 171 |
+
0x0c047fff89c0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 172 |
+
0x0c047fff89d0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 173 |
+
0x0c047fff89e0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 174 |
+
0x0c047fff89f0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 175 |
+
=>0x0c047fff8a00: fa fa 00 02 fa fa 00 02 fa fa fd fa fa fa fa[fa]
|
| 176 |
+
0x0c047fff8a10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 177 |
+
0x0c047fff8a20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 178 |
+
0x0c047fff8a30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 179 |
+
0x0c047fff8a40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 180 |
+
0x0c047fff8a50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 181 |
+
Shadow byte legend (one shadow byte represents 8 application bytes):
|
| 182 |
+
Addressable: 00
|
| 183 |
+
Partially addressable: 01 02 03 04 05 06 07
|
| 184 |
+
Heap left redzone: fa
|
| 185 |
+
Freed heap region: fd
|
| 186 |
+
Stack left redzone: f1
|
| 187 |
+
Stack mid redzone: f2
|
| 188 |
+
Stack right redzone: f3
|
| 189 |
+
Stack after return: f5
|
| 190 |
+
Stack use after scope: f8
|
| 191 |
+
Global redzone: f9
|
| 192 |
+
Global init order: f6
|
| 193 |
+
Poisoned by user: f7
|
| 194 |
+
Container overflow: fc
|
| 195 |
+
Array cookie: ac
|
| 196 |
+
Intra object redzone: bb
|
| 197 |
+
ASan internal: fe
|
| 198 |
+
Left alloca redzone: ca
|
| 199 |
+
Right alloca redzone: cb
|
| 200 |
+
==74==ABORTING
|
| 201 |
+
MS: 0 ; base unit: 0000000000000000000000000000000000000000
|
| 202 |
+
0x61,0x75,0x74,0x6f,0x6d,0x6f,0x75,0x6e,0x74,0x48,
|
| 203 |
+
automountH
|
| 204 |
+
artifact_prefix='/tmp/tmpjhswtxiw/'; Test unit written to /tmp/tmpjhswtxiw/crash-7be9e0f3a71d95f8d5e67c5a9d84273d6f4e3c03
|
| 205 |
+
Base64: YXV0b21vdW50SA==
|
| 206 |
+
stat::number_of_executed_units: 314
|
| 207 |
+
stat::average_exec_per_sec: 0
|
| 208 |
+
stat::new_units_added: 0
|
| 209 |
+
stat::slowest_unit_time_sec: 0
|
| 210 |
+
stat::peak_rss_mb: 67
|
| 211 |
+
/github/workspace/build-out/fuzz-unit-file -timeout=25 -rss_limit_mb=2560 -len_control=0 -seed=1337 -artifact_prefix=/tmp/tmpjhswtxiw/ -max_total_time=13 -print_final_stats=1 /github/workspace/cifuzz-corpus/fuzz-unit-file >fuzz-1.log 2>&1
|
| 212 |
+
================== Job 1 exited with exit code 77 ============
|
| 213 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 214 |
+
INFO: Seed: 1337
|
| 215 |
+
INFO: Loaded 2 modules (82576 inline 8-bit counters): 82573 [0x7ff1ba038df0, 0x7ff1ba04d07d), 3 [0x5e9b28, 0x5e9b2b),
|
| 216 |
+
INFO: Loaded 2 PC tables (82576 PCs): 82573 [0x7ff1ba04d080,0x7ff1ba18f950), 3 [0x5a6af8,0x5a6b28),
|
| 217 |
+
INFO: 20907 files found in /github/workspace/cifuzz-corpus/fuzz-unit-file
|
| 218 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 604973 bytes
|
| 219 |
+
INFO: seed corpus: files: 20907 min: 1b max: 604973b total: 16005340b rss: 61Mb
|
| 220 |
+
=================================================================
|
| 221 |
+
==78==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000005078 at pc 0x0000004ddffa bp 0x7ffc2e6825c0 sp 0x7ffc2e6825b8
|
| 222 |
+
READ of size 4 at 0x602000005078 thread T0
|
| 223 |
+
SCARINESS: 27 (4-byte-read-heap-buffer-overflow-far-from-bounds)
|
| 224 |
+
#0 0x4ddff9 in samLLVM2FuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:30:16
|
| 225 |
+
#1 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 226 |
+
#2 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 227 |
+
#3 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 228 |
+
#4 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 229 |
+
#5 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 230 |
+
#6 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 231 |
+
#7 0x7ff1b900c082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 232 |
+
#8 0x41f6ed in _start (build-out/fuzz-unit-file+0x41f6ed)
|
| 233 |
+
|
| 234 |
+
DEDUP_TOKEN: samLLVM2FuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)--fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*)
|
| 235 |
+
0x602000005078 is located 38 bytes to the right of 2-byte region [0x602000005050,0x602000005052)
|
| 236 |
+
freed by thread T0 here:
|
| 237 |
+
#0 0x4a0882 in __interceptor_free /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:52:3
|
| 238 |
+
#1 0x4ddfb7 in samLLVM2FuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:29:9
|
| 239 |
+
#2 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 240 |
+
#3 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 241 |
+
#4 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 242 |
+
#5 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 243 |
+
#6 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 244 |
+
#7 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 245 |
+
#8 0x7ff1b900c082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 246 |
+
|
| 247 |
+
DEDUP_TOKEN: __interceptor_free--samLLVM2FuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 248 |
+
previously allocated by thread T0 here:
|
| 249 |
+
#0 0x4a0b26 in malloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
|
| 250 |
+
#1 0x4ddfac in samLLVM2FuzzerTestOneInput /work/build/../../src/systemd/src/core/fuzz-unit-file.c:28:25
|
| 251 |
+
#2 0x4fc653 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:611:15
|
| 252 |
+
#3 0x4fbe3a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:514:3
|
| 253 |
+
#4 0x4fdca4 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:826:7
|
| 254 |
+
#5 0x4fded9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:857:3
|
| 255 |
+
#6 0x4ed53f in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:912:6
|
| 256 |
+
#7 0x516b92 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 257 |
+
#8 0x7ff1b900c082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 1878e6b475720c7c51969e69ab2d276fae6d1dee)
|
| 258 |
+
|
| 259 |
+
DEDUP_TOKEN: malloc--samLLVM2FuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 260 |
+
SUMMARY: AddressSanitizer: heap-buffer-overflow /work/build/../../src/systemd/src/core/fuzz-unit-file.c:30:16 in samsamLLVM2FuzzerTestOneInput
|
| 261 |
+
Shadow bytes around the buggy address:
|
| 262 |
+
0x0c047fff89b0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 263 |
+
0x0c047fff89c0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 264 |
+
0x0c047fff89d0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 265 |
+
0x0c047fff89e0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 266 |
+
0x0c047fff89f0: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fd
|
| 267 |
+
=>0x0c047fff8a00: fa fa 00 02 fa fa 00 02 fa fa fd fa fa fa fa[fa]
|
| 268 |
+
0x0c047fff8a10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 269 |
+
0x0c047fff8a20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 270 |
+
0x0c047fff8a30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 271 |
+
0x0c047fff8a40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 272 |
+
0x0c047fff8a50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
|
| 273 |
+
Shadow byte legend (one shadow byte represents 8 application bytes):
|
| 274 |
+
Addressable: 00
|
| 275 |
+
Partially addressable: 01 02 03 04 05 06 07
|
| 276 |
+
Heap left redzone: fa
|
| 277 |
+
Freed heap region: fd
|
| 278 |
+
Stack left redzone: f1
|
| 279 |
+
Stack mid redzone: f2
|
| 280 |
+
Stack right redzone: f3
|
| 281 |
+
Stack after return: f5
|
| 282 |
+
Stack use after scope: f8
|
| 283 |
+
Global redzone: f9
|
| 284 |
+
Global init order: f6
|
| 285 |
+
Poisoned by user: f7
|
| 286 |
+
Container overflow: fc
|
| 287 |
+
Array cookie: ac
|
| 288 |
+
Intra object redzone: bb
|
| 289 |
+
ASan internal: fe
|
| 290 |
+
Left alloca redzone: ca
|
| 291 |
+
Right alloca redzone: cb
|
| 292 |
+
==78==ABORTING
|
| 293 |
+
MS: 0 ; base unit: 0000000000000000000000000000000000000000
|
| 294 |
+
0x61,0x75,0x74,0x6f,0x6d,0x6f,0x75,0x6e,0x74,0x48,
|
| 295 |
+
automountH
|
| 296 |
+
artifact_prefix='/tmp/tmpjhswtxiw/'; Test unit written to /tmp/tmpjhswtxiw/crash-7be9e0f3a71d95f8d5e67c5a9d84273d6f4e3c03
|
| 297 |
+
Base64: YXV0b21vdW50SA==
|
| 298 |
+
stat::number_of_executed_units: 314
|
| 299 |
+
stat::average_exec_per_sec: 0
|
| 300 |
+
stat::new_units_added: 0
|
| 301 |
+
stat::slowest_unit_time_sec: 0
|
| 302 |
+
stat::peak_rss_mb: 68
|
local-test-tika-delta-04/fuzz-tooling/infra/tools/wycheproof/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
wycheproof.zip
|
local-test-tika-delta-04/fuzz-tooling/infra/tools/wycheproof/generate_job.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
"""Script for generating an OSS-Fuzz job for a wycheproof project."""
|
| 18 |
+
import sys
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def main():
|
| 22 |
+
"""Usage generate_job.py <project>."""
|
| 23 |
+
project = sys.argv[1]
|
| 24 |
+
print(f'Name: wycheproof_nosanitizer_{project}')
|
| 25 |
+
job_definition = f"""CUSTOM_BINARY = False
|
| 26 |
+
BAD_BUILD_CHECK = False
|
| 27 |
+
APP_NAME = WycheproofTarget.bash
|
| 28 |
+
THREAD_ALIVE_CHECK_INTERVAL = 10
|
| 29 |
+
TEST_TIMEOUT = 3600
|
| 30 |
+
CRASH_RETRIES = 1
|
| 31 |
+
AGGREGATE_COVERAGE = False
|
| 32 |
+
TESTCASE_COVERAGE = False
|
| 33 |
+
FILE_GITHUB_ISSUE = False
|
| 34 |
+
MANAGED = False
|
| 35 |
+
MAX_FUZZ_THREADS = 1
|
| 36 |
+
RELEASE_BUILD_BUCKET_PATH = gs://clusterfuzz-builds-wycheproof/{project}/{project}-none-([0-9]+).zip
|
| 37 |
+
PROJECT_NAME = {project}
|
| 38 |
+
SUMMARY_PREFIX = {project}
|
| 39 |
+
REVISION_VARS_URL = https://commondatastorage.googleapis.com/clusterfuzz-builds-wycheproof/{project}/{project}-none-%s.srcmap.json
|
| 40 |
+
FUZZ_LOGS_BUCKET = {project}-logs.clusterfuzz-external.appspot.com
|
| 41 |
+
CORPUS_BUCKET = {project}-corpus.clusterfuzz-external.appspot.com
|
| 42 |
+
QUARANTINE_BUCKET = {project}-quarantine.clusterfuzz-external.appspot.com
|
| 43 |
+
BACKUP_BUCKET = {project}-backup.clusterfuzz-external.appspot.com
|
| 44 |
+
AUTOMATIC_LABELS = Proj-{project},Engine-wycheproof
|
| 45 |
+
"""
|
| 46 |
+
print(job_definition)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
if __name__ == '__main__':
|
| 50 |
+
main()
|
local-test-tika-delta-04/fuzz-tooling/infra/tools/wycheproof/launcher.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
"""Script for running wycheproof."""
|
| 18 |
+
|
| 19 |
+
import logging
|
| 20 |
+
import sys
|
| 21 |
+
import subprocess
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def main():
|
| 25 |
+
"""Runs wycheproof."""
|
| 26 |
+
if len(sys.argv) < 3:
|
| 27 |
+
logging.error('Usage: %s <test_app> <testcase>.', sys.argv[0])
|
| 28 |
+
return 1
|
| 29 |
+
|
| 30 |
+
return subprocess.run(sys.argv[1:], check=False).returncode
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
if __name__ == '__main__':
|
| 34 |
+
sys.exit(main())
|
local-test-tika-delta-04/fuzz-tooling/infra/tools/wycheproof/package.bash
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
# Script for zipping ClusterFuzz's blackbox fuzzer for wycheproof.
|
| 18 |
+
zip wycheproof.zip run.py launcher.py
|
local-test-tika-delta-04/fuzz-tooling/infra/tools/wycheproof/run.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# Copyright 2022 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
"""Script for creating "testcases" to run wycheproof on."""
|
| 18 |
+
|
| 19 |
+
import argparse
|
| 20 |
+
import os
|
| 21 |
+
import sys
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def get_args():
|
| 25 |
+
"""Returns parsed program arguments."""
|
| 26 |
+
parser = argparse.ArgumentParser()
|
| 27 |
+
parser.add_argument(
|
| 28 |
+
'--input_dir',
|
| 29 |
+
help='Ignored.',
|
| 30 |
+
)
|
| 31 |
+
parser.add_argument('--output_dir',
|
| 32 |
+
help='Directory for writing testcases.',
|
| 33 |
+
required=True)
|
| 34 |
+
parser.add_argument('--no_of_files', type=int, help='Ignored.')
|
| 35 |
+
return parser.parse_args()
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def main():
|
| 39 |
+
"""Generates a dummy testcase for use by a ClusterFuzz blackbox fuzzer."""
|
| 40 |
+
args = get_args()
|
| 41 |
+
if not os.path.exists(args.output_dir):
|
| 42 |
+
os.mkdir(args.output_dir)
|
| 43 |
+
testcase = os.path.join(args.output_dir, 'fuzz-0')
|
| 44 |
+
with open(testcase, 'w') as file_handle:
|
| 45 |
+
file_handle.write(' ')
|
| 46 |
+
return 0
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
if __name__ == '__main__':
|
| 50 |
+
sys.exit(main())
|