Add files using upload-large-folder tool
Browse files- local-test-tika-delta-05/fuzz-tooling/infra/base-images/base-builder-swift/Dockerfile +22 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/actions/run_fuzzers/action.yml +82 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/external-actions/build_fuzzers/action.yml +75 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/external-actions/run_fuzzers/action.yml +97 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/filestore/git/git_test.py +122 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_actions_test.py +283 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_api_test.py +41 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/filestore/github_actions/upload.js +45 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/filestore/gitlab/__init__.py +133 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/filestore/gsutil/__init__.py +109 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/filestore/no_filestore/__init__.py +51 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/platform_config/__init__.py +124 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/platform_config/prow.py +64 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/test_data/external-project/.clusterfuzzlite/build.sh +24 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.cpp +24 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.dict +6 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.h +19 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/test_data/sarif_utils_msan_stack.txt +62 -0
- local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/test_data/sarif_utils_systemd_stack.txt +302 -0
- local-test-tika-delta-05/fuzz-tooling/infra/tools/wycheproof/launcher.py +34 -0
local-test-tika-delta-05/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-05/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-05/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-05/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-05/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-05/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-05/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_api_test.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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_api."""
|
| 15 |
+
import os
|
| 16 |
+
import sys
|
| 17 |
+
import unittest
|
| 18 |
+
|
| 19 |
+
# pylint: disable=wrong-import-position,import-error
|
| 20 |
+
sys.path.append(
|
| 21 |
+
os.path.abspath(
|
| 22 |
+
os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir,
|
| 23 |
+
os.path.pardir)))
|
| 24 |
+
|
| 25 |
+
from filestore.github_actions import github_api
|
| 26 |
+
import test_helpers
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
class GetHttpAuthHeaders(unittest.TestCase):
|
| 30 |
+
"""Tests for get_http_auth_headers."""
|
| 31 |
+
|
| 32 |
+
def test_get_http_auth_headers(self):
|
| 33 |
+
"""Tests that get_http_auth_headers returns the correct result."""
|
| 34 |
+
token = 'example githubtoken'
|
| 35 |
+
run_config = test_helpers.create_run_config(token=token)
|
| 36 |
+
expected_headers = {
|
| 37 |
+
'Authorization': f'token {token}',
|
| 38 |
+
'Accept': 'application/vnd.github.v3+json',
|
| 39 |
+
}
|
| 40 |
+
self.assertEqual(expected_headers,
|
| 41 |
+
github_api.get_http_auth_headers(run_config))
|
local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/filestore/github_actions/upload.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 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 |
+
// Script for uploading an artifact. Returns 0 on success.
|
| 16 |
+
// Usage: upload.js <artifactName> <rootDirectory> <file 1>...<file N>
|
| 17 |
+
|
| 18 |
+
const fs = require('fs');
|
| 19 |
+
const { DefaultArtifactClient } = require('@actions/artifact');
|
| 20 |
+
|
| 21 |
+
const artifactClient = new DefaultArtifactClient();
|
| 22 |
+
const artifactName = process.argv[2];
|
| 23 |
+
const rootDirectory = process.argv[3]
|
| 24 |
+
const files = process.argv.slice(4);
|
| 25 |
+
const options = {
|
| 26 |
+
continueOnError: true
|
| 27 |
+
};
|
| 28 |
+
|
| 29 |
+
async function uploadArtifact() {
|
| 30 |
+
try {
|
| 31 |
+
const uploadResult = await artifactClient.uploadArtifact(artifactName, files, rootDirectory, options);
|
| 32 |
+
console.log(uploadResult);
|
| 33 |
+
if (uploadResult.failedItems.length > 0) {
|
| 34 |
+
return 1;
|
| 35 |
+
}
|
| 36 |
+
return 0;
|
| 37 |
+
} catch (error) {
|
| 38 |
+
console.error('Error uploading artifact:', error);
|
| 39 |
+
return 1;
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
uploadArtifact().then(exitCode => {
|
| 44 |
+
process.exit(exitCode);
|
| 45 |
+
});
|
local-test-tika-delta-05/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-05/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-05/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-05/fuzz-tooling/infra/cifuzz/platform_config/__init__.py
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 getting the configuration CIFuzz needs to run."""
|
| 15 |
+
import logging
|
| 16 |
+
import os
|
| 17 |
+
|
| 18 |
+
import environment
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class BasePlatformConfig:
|
| 22 |
+
"""Base class for PlatformConfig subclasses."""
|
| 23 |
+
|
| 24 |
+
@property
|
| 25 |
+
def project_src_path(self):
|
| 26 |
+
"""Returns the manually checked out path of the project's source if
|
| 27 |
+
specified or None."""
|
| 28 |
+
path = os.getenv('PROJECT_SRC_PATH')
|
| 29 |
+
if not path:
|
| 30 |
+
logging.debug('No PROJECT_SRC_PATH.')
|
| 31 |
+
return path
|
| 32 |
+
|
| 33 |
+
logging.debug('PROJECT_SRC_PATH: %s.', path)
|
| 34 |
+
return path
|
| 35 |
+
|
| 36 |
+
@property
|
| 37 |
+
def workspace(self):
|
| 38 |
+
"""Returns the workspace."""
|
| 39 |
+
return os.getenv('WORKSPACE')
|
| 40 |
+
|
| 41 |
+
# Optional config variables.
|
| 42 |
+
|
| 43 |
+
@property
|
| 44 |
+
def git_sha(self):
|
| 45 |
+
"""Returns the Git SHA to checkout and fuzz. This is used only by GitHub
|
| 46 |
+
projects when commit fuzzing. It is not used when PR fuzzing. It is
|
| 47 |
+
definitely needed by OSS-Fuzz on GitHub since they have no copy of the repo
|
| 48 |
+
on the host and the repo on the builder image is a clone from main/master.
|
| 49 |
+
Right now it is needed by external on GitHub because we need to clone a new
|
| 50 |
+
repo because the copy they give us doesn't work for diffing.
|
| 51 |
+
|
| 52 |
+
TODO(metzman): Try to eliminate the need for this by 1. Making the clone
|
| 53 |
+
from external github projects usable. 2. Forcing OSS-Fuzz on Github to clone
|
| 54 |
+
before starting CIFuzz."""
|
| 55 |
+
return None
|
| 56 |
+
|
| 57 |
+
@property
|
| 58 |
+
def base_commit(self):
|
| 59 |
+
"""Returns the base commit to diff against (commit fuzzing)."""
|
| 60 |
+
# TODO(metzman) Rename base_commit to git_base_commit.
|
| 61 |
+
return os.getenv('GIT_BASE_COMMIT')
|
| 62 |
+
|
| 63 |
+
@property
|
| 64 |
+
def base_ref(self):
|
| 65 |
+
"""Returns the base branch to diff against (pr fuzzing)."""
|
| 66 |
+
# TODO(metzman) Rename base_ref to git_base_ref.
|
| 67 |
+
return os.getenv('GIT_BASE_REF')
|
| 68 |
+
|
| 69 |
+
@property
|
| 70 |
+
def pr_ref(self):
|
| 71 |
+
"""Returns the pull request to checkout and fuzz. This is used only by
|
| 72 |
+
GitHub projects when PR fuzzing. It is not used when commit fuzzing. It is
|
| 73 |
+
definitely needed by OSS-Fuzz on GitHub since they have no copy of the repo
|
| 74 |
+
on the host and the repo on the builder image is a clone from main/master.
|
| 75 |
+
Right now it is needed by external on GitHub because we need to clone a new
|
| 76 |
+
repo because the copy they give us doesn't work for diffing.
|
| 77 |
+
|
| 78 |
+
TODO(metzman): Try to eliminate the need for this by 1. Making the clone
|
| 79 |
+
from external github projects usable. 2. Forcing OSS-Fuzz on Github to clone
|
| 80 |
+
before starting CIFuzz."""
|
| 81 |
+
return None
|
| 82 |
+
|
| 83 |
+
@property
|
| 84 |
+
def project_repo_owner(self):
|
| 85 |
+
"""Returns the project repo owner (githubism)."""
|
| 86 |
+
return None
|
| 87 |
+
|
| 88 |
+
@property
|
| 89 |
+
def project_repo_name(self):
|
| 90 |
+
"""Returns the project repo name."""
|
| 91 |
+
return os.environ.get('REPOSITORY')
|
| 92 |
+
|
| 93 |
+
@property
|
| 94 |
+
def actor(self):
|
| 95 |
+
"""Name of the actor for the CI."""
|
| 96 |
+
return None
|
| 97 |
+
|
| 98 |
+
@property
|
| 99 |
+
def token(self):
|
| 100 |
+
"""Returns the CI API token."""
|
| 101 |
+
return None
|
| 102 |
+
|
| 103 |
+
@property
|
| 104 |
+
def docker_in_docker(self):
|
| 105 |
+
"""Returns whether or not CFL is running using Docker in Docker."""
|
| 106 |
+
return environment.get_bool('DOCKER_IN_DOCKER', False)
|
| 107 |
+
|
| 108 |
+
@property
|
| 109 |
+
def filestore(self):
|
| 110 |
+
"""Returns the filestore used to store persistent data."""
|
| 111 |
+
return os.environ.get('FILESTORE')
|
| 112 |
+
|
| 113 |
+
@property
|
| 114 |
+
def git_url(self):
|
| 115 |
+
"""Returns the repo URL. This is only used by GitHub users. Right now it is
|
| 116 |
+
needed by external on GitHub because we need to clone a new repo because the
|
| 117 |
+
copy they give us doesn't work for diffing. It isn't used by OSS-Fuzz on
|
| 118 |
+
github users since the Git URL is determined using repo detection.
|
| 119 |
+
|
| 120 |
+
TODO(metzman): Try to eliminate the need for this by making the clone
|
| 121 |
+
from external github projects usable.
|
| 122 |
+
TODO(metzman): As an easier goal, maybe make OSS-Fuzz GitHub use this too
|
| 123 |
+
for: 1. Consistency 2. Maybe it will allow use on forks."""
|
| 124 |
+
return None
|
local-test-tika-delta-05/fuzz-tooling/infra/cifuzz/platform_config/prow.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 getting the configuration CIFuzz needs to run on prow."""
|
| 15 |
+
import logging
|
| 16 |
+
import os
|
| 17 |
+
|
| 18 |
+
import platform_config
|
| 19 |
+
|
| 20 |
+
# pylint: disable=too-few-public-methods
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class PlatformConfig(platform_config.BasePlatformConfig):
|
| 24 |
+
"""CI environment for Prow."""
|
| 25 |
+
|
| 26 |
+
@property
|
| 27 |
+
def project_src_path(self):
|
| 28 |
+
"""Returns the manually checked out path of the project's source if
|
| 29 |
+
specified or the current directory if not. Prow will run ClusterfuzzLite
|
| 30 |
+
at the directory head for the repo."""
|
| 31 |
+
project_src_path = os.getenv('PROJECT_SRC_PATH', os.getcwd())
|
| 32 |
+
logging.debug('PROJECT_SRC_PATH: %s.', project_src_path)
|
| 33 |
+
return project_src_path
|
| 34 |
+
|
| 35 |
+
@property
|
| 36 |
+
def workspace(self):
|
| 37 |
+
"""Returns the workspace."""
|
| 38 |
+
# Let Prow user override workspace, but default to using artifacts dir
|
| 39 |
+
return os.getenv('WORKSPACE', os.getenv('ARTIFACTS'))
|
| 40 |
+
|
| 41 |
+
@property
|
| 42 |
+
def base_ref(self):
|
| 43 |
+
"""Returns the base branch to diff against (pr fuzzing)."""
|
| 44 |
+
return os.getenv('PULL_BASE_REF')
|
| 45 |
+
|
| 46 |
+
@property
|
| 47 |
+
def project_repo_name(self):
|
| 48 |
+
"""Returns the project repo name."""
|
| 49 |
+
return os.getenv('REPO_NAME')
|
| 50 |
+
|
| 51 |
+
@property
|
| 52 |
+
def base_commit(self):
|
| 53 |
+
"""Returns the base commit to diff against (commit fuzzing)."""
|
| 54 |
+
return os.getenv('PULL_BASE_SHA')
|
| 55 |
+
|
| 56 |
+
@property
|
| 57 |
+
def docker_in_docker(self):
|
| 58 |
+
"""Returns True if using Docker in Docker."""
|
| 59 |
+
return True
|
| 60 |
+
|
| 61 |
+
@property
|
| 62 |
+
def filestore(self):
|
| 63 |
+
"""Returns the filestore used to store persistent data."""
|
| 64 |
+
return os.environ.get('FILESTORE', 'gsutil')
|
local-test-tika-delta-05/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-05/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-05/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-05/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-05/fuzz-tooling/infra/cifuzz/test_data/sarif_utils_msan_stack.txt
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Dictionary: 3 entries
|
| 2 |
+
2024-05-07 18:49:02,343 - root - INFO - Fuzzer: do_stuff_fuzzer. Detected bug.
|
| 3 |
+
INFO: Running with entropic power schedule (0xFF, 100).
|
| 4 |
+
INFO: Seed: 1337
|
| 5 |
+
INFO: Loaded 1 modules (83 inline 8-bit counters): 83 [0x563ff0e03e98, 0x563ff0e03eeb),
|
| 6 |
+
INFO: Loaded 1 PC tables (83 PCs): 83 [0x563ff0e03ef0,0x563ff0e04420),
|
| 7 |
+
INFO: 0 files found in /github/workspace/cifuzz-corpus/do_stuff_fuzzer
|
| 8 |
+
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
|
| 9 |
+
INFO: A corpus is not provided, starting from an empty corpus
|
| 10 |
+
#2 INITED cov: 2 ft: 2 corp: 1/1b exec/s: 0 rss: 69Mb
|
| 11 |
+
#4 NEW cov: 3 ft: 3 corp: 2/3b lim: 4096 exec/s: 0 rss: 69Mb L: 2/2 MS: 2 ChangeBit-InsertByte-
|
| 12 |
+
==23==WARNING: MemorySanitizer: use-of-uninitialized-value
|
| 13 |
+
#0 0x563ff0d278f0 in LLVMFuzzerTestOneInput /src/cifuzz-external-example/do_stuff_fuzzer.cpp:24:1
|
| 14 |
+
#1 0x563ff0c24340 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13
|
| 15 |
+
#2 0x563ff0c23b65 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:516:7
|
| 16 |
+
#3 0x563ff0c25335 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:760:19
|
| 17 |
+
#4 0x563ff0c26125 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:905:5
|
| 18 |
+
#5 0x563ff0c14436 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:914:6
|
| 19 |
+
#6 0x563ff0c40962 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 20 |
+
#7 0x7f4c156ed082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 87b331c034a6458c64ce09c03939e947212e18ce)
|
| 21 |
+
#8 0x563ff0c055ad in _start (build-out/do_stuff_fuzzer+0x4a5ad)
|
| 22 |
+
|
| 23 |
+
DEDUP_TOKEN: LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)--fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*)
|
| 24 |
+
Uninitialized value was stored to memory at
|
| 25 |
+
#0 0x563ff0d278e9 in LLVMFuzzerTestOneInput /src/cifuzz-external-example/do_stuff_fuzzer.cpp
|
| 26 |
+
#1 0x563ff0c24340 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13
|
| 27 |
+
#2 0x563ff0c23b65 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:516:7
|
| 28 |
+
#3 0x563ff0c25335 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:760:19
|
| 29 |
+
#4 0x563ff0c26125 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:905:5
|
| 30 |
+
#5 0x563ff0c14436 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:914:6
|
| 31 |
+
#6 0x563ff0c40962 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 32 |
+
#7 0x7f4c156ed082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 87b331c034a6458c64ce09c03939e947212e18ce)
|
| 33 |
+
|
| 34 |
+
DEDUP_TOKEN: LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)--fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*)
|
| 35 |
+
Uninitialized value was created by a heap deallocation
|
| 36 |
+
#0 0x563ff0cc7480 in free /src/llvm-project/compiler-rt/lib/msan/msan_interceptors.cpp:218:3
|
| 37 |
+
#1 0x563ff0d27800 in LLVMFuzzerTestOneInput /src/cifuzz-external-example/do_stuff_fuzzer.cpp:21:5
|
| 38 |
+
#2 0x563ff0c24340 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13
|
| 39 |
+
#3 0x563ff0c23b65 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:516:7
|
| 40 |
+
#4 0x563ff0c25335 in fuzzer::Fuzzer::MutateAndTestOne() /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:760:19
|
| 41 |
+
#5 0x563ff0c26125 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, std::__Fuzzer::allocator<fuzzer::SizedFile>>&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:905:5
|
| 42 |
+
#6 0x563ff0c14436 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:914:6
|
| 43 |
+
#7 0x563ff0c40962 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
|
| 44 |
+
#8 0x7f4c156ed082 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24082) (BuildId: 87b331c034a6458c64ce09c03939e947212e18ce)
|
| 45 |
+
|
| 46 |
+
DEDUP_TOKEN: __interceptor_free--LLVMFuzzerTestOneInput--fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long)
|
| 47 |
+
SUMMARY: MemorySanitizer: use-of-uninitialized-value /src/cifuzz-external-example/do_stuff_fuzzer.cpp:24:1 in LLVMFuzzerTestOneInput
|
| 48 |
+
Unique heap origins: 201
|
| 49 |
+
Stack depot allocated bytes: 9764880
|
| 50 |
+
Unique origin histories: 181
|
| 51 |
+
History depot allocated bytes: 196608
|
| 52 |
+
Exiting
|
| 53 |
+
MS: 5 ShuffleBytes-CopyPart-InsertByte-CopyPart-ManualDict- DE: "bar"-; base unit: adc83b19e793491b1c6ea0fd8b46cd9f32e592fc
|
| 54 |
+
0xa,0x62,0x61,0x72,0xa,
|
| 55 |
+
\012bar\012
|
| 56 |
+
artifact_prefix='/tmp/tmp1tc5b3m2/'; Test unit written to /tmp/tmp1tc5b3m2/crash-c935b6724d7e27401ac9af3773700ca86ac38dea
|
| 57 |
+
Base64: CmJhcgo=
|
| 58 |
+
stat::number_of_executed_units: 159
|
| 59 |
+
stat::average_exec_per_sec: 0
|
| 60 |
+
stat::new_units_added: 1
|
| 61 |
+
stat::slowest_unit_time_sec: 0
|
| 62 |
+
stat::peak_rss_mb: 69
|
local-test-tika-delta-05/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-05/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())
|