diff options
author | Leo Neat <lneat@google.com> | 2020-04-28 12:31:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-28 12:31:36 -0700 |
commit | 9b30127675b0bf295648e2f907df0d756ff5a2eb (patch) | |
tree | 0320224a9e998988d2eea563aa4fcda1d1291964 /infra/cifuzz/actions | |
parent | f52c9385c04a0a22057b7f6f104573d6e97ca2af (diff) | |
download | oss-fuzz-9b30127675b0bf295648e2f907df0d756ff5a2eb.tar.gz |
[CIFuzz] Add support for different sanitizers (#3516)
Diffstat (limited to 'infra/cifuzz/actions')
4 files changed, 28 insertions, 8 deletions
diff --git a/infra/cifuzz/actions/build_fuzzers/action.yml b/infra/cifuzz/actions/build_fuzzers/action.yml index e9fb31eaa..35c50f658 100644 --- a/infra/cifuzz/actions/build_fuzzers/action.yml +++ b/infra/cifuzz/actions/build_fuzzers/action.yml @@ -8,9 +8,13 @@ inputs: dry-run: description: 'If set, run the action without actually reporting a failure.' default: false + sanitizer: + description: 'The sanitizer to build the fuzzers with.' + default: 'address' runs: using: 'docker' image: 'Dockerfile' env: OSS_FUZZ_PROJECT_NAME: ${{ inputs.oss-fuzz-project-name }} DRY_RUN: ${{ inputs.dry-run}} + SANITIZER: $${{ inputs.sanitizer }} diff --git a/infra/cifuzz/actions/build_fuzzers/build_fuzzers_entrypoint.py b/infra/cifuzz/actions/build_fuzzers/build_fuzzers_entrypoint.py index 3c84e64a8..9ae83fbfe 100644 --- a/infra/cifuzz/actions/build_fuzzers/build_fuzzers_entrypoint.py +++ b/infra/cifuzz/actions/build_fuzzers/build_fuzzers_entrypoint.py @@ -43,6 +43,8 @@ def main(): GITHUB_REF: The pull request reference that triggered this script. GITHUB_EVENT_NAME: The name of the hook event that triggered this script. GITHUB_WORKSPACE: The shared volume directory where input artifacts are. + DRY_RUN: If true, no failures will surface. + SANITIZER: The sanitizer to use when running fuzzers. Returns: 0 on success or 1 on Failure. @@ -53,6 +55,7 @@ def main(): commit_sha = os.environ.get('GITHUB_SHA') event = os.environ.get('GITHUB_EVENT_NAME') workspace = os.environ.get('GITHUB_WORKSPACE') + sanitizer = os.environ.get('SANITIZER').lower() # Check if failures should not be reported. dry_run = (os.environ.get('DRY_RUN').lower() == 'true') @@ -67,19 +70,24 @@ def main(): logging.error('This script needs to be run in the Github action context.') return returncode - if event == 'push' and not cifuzz.build_fuzzers( - oss_fuzz_project_name, github_repo_name, workspace, - commit_sha=commit_sha): + if event == 'push' and not cifuzz.build_fuzzers(oss_fuzz_project_name, + github_repo_name, + workspace, + commit_sha=commit_sha, + sanitizer=sanitizer): logging.error('Error building fuzzers for project %s with commit %s.', oss_fuzz_project_name, commit_sha) return returncode - if event == 'pull_request' and not cifuzz.build_fuzzers( - oss_fuzz_project_name, github_repo_name, workspace, pr_ref=pr_ref): + if event == 'pull_request' and not cifuzz.build_fuzzers(oss_fuzz_project_name, + github_repo_name, + workspace, + pr_ref=pr_ref, + sanitizer=sanitizer): logging.error('Error building fuzzers for project %s with pull request %s.', oss_fuzz_project_name, pr_ref) return returncode out_dir = os.path.join(workspace, 'out') - if cifuzz.check_fuzzer_build(out_dir): + if cifuzz.check_fuzzer_build(out_dir, sanitizer=sanitizer): return 0 return returncode diff --git a/infra/cifuzz/actions/run_fuzzers/action.yml b/infra/cifuzz/actions/run_fuzzers/action.yml index ca40c4fec..b66140237 100644 --- a/infra/cifuzz/actions/run_fuzzers/action.yml +++ b/infra/cifuzz/actions/run_fuzzers/action.yml @@ -12,6 +12,9 @@ inputs: dry-run: description: 'If set, run the action without actually reporting a failure.' default: false + sanitizer: + description: 'The sanitizer to run the fuzzers with.' + default: 'address' runs: using: 'docker' image: 'Dockerfile' diff --git a/infra/cifuzz/actions/run_fuzzers/run_fuzzers_entrypoint.py b/infra/cifuzz/actions/run_fuzzers/run_fuzzers_entrypoint.py index 4d80e5e7d..7f39388f6 100644 --- a/infra/cifuzz/actions/run_fuzzers/run_fuzzers_entrypoint.py +++ b/infra/cifuzz/actions/run_fuzzers/run_fuzzers_entrypoint.py @@ -47,6 +47,7 @@ def main(): GITHUB_WORKSPACE: The shared volume directory where input artifacts are. DRY_RUN: If true, no failures will surface. OSS_FUZZ_PROJECT_NAME: The name of the relevant OSS-Fuzz project. + SANITIZER: The sanitizer to use when running fuzzers. Returns: 0 on success or 1 on Failure. @@ -54,6 +55,8 @@ def main(): fuzz_seconds = int(os.environ.get('FUZZ_SECONDS', 600)) workspace = os.environ.get('GITHUB_WORKSPACE') oss_fuzz_project_name = os.environ.get('OSS_FUZZ_PROJECT_NAME') + sanitizer = os.environ.get('SANITIZER').lower() + # Check if failures should not be reported. dry_run = (os.environ.get('DRY_RUN').lower() == 'true') @@ -74,8 +77,10 @@ def main(): logging.error('This script needs to be run in the Github action context.') return returncode # Run the specified project's fuzzers from the build. - run_status, bug_found = cifuzz.run_fuzzers(fuzz_seconds, workspace, - oss_fuzz_project_name) + run_status, bug_found = cifuzz.run_fuzzers(fuzz_seconds, + workspace, + oss_fuzz_project_name, + sanitizer=sanitizer) if not run_status: logging.error('Error occured while running in workspace %s.', workspace) return returncode |