author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
258,388 | 01.03.2020 12:47:47 | 28,800 | 5475cee562344e93905e8a26183428dd08367f09 | Rename running-your-own-experiment.md to running_your_own_experiment.md
Do this for consistency.
* Don't set two pages as first.
* Fix spelling and don't duplicate order again | [
{
"change_type": "MODIFY",
"old_path": "docs/developing-fuzzbench/custom_analysis_and_reports.md",
"new_path": "docs/developing-fuzzbench/custom_analysis_and_reports.md",
"diff": "layout: default\ntitle: Custom analysis and reports\nparent: Developing FuzzBench\n-nav_order: 1\n+nav_order: 2\npermalink: /developing-fuzzbench/custom_analysis_and_reports\n---\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/reference/report.md",
"new_path": "docs/reference/report.md",
"diff": "@@ -46,7 +46,7 @@ on a post-hoc [Nemenyi test](https://en.wikipedia.org/wiki/Nemenyi_test)\nperformed after the [Friedman\ntest](https://en.wikipedia.org/wiki/Friedman_test).\n-The pivot table under the critifical difference diagram shows the median reached\n+The pivot table under the critical difference diagram shows the median reached\ncoverage numbers.\n### Per-benchmark summary\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/reference/useful_links.md",
"new_path": "docs/reference/useful_links.md",
"diff": "---\nlayout: default\ntitle: Useful links\n-nav_order: 2\n+nav_order: 3\npermalink: /reference/useful-links/\nparent: Reference\n---\n"
},
{
"change_type": "RENAME",
"old_path": "docs/running-your-own-experiment/running-your-own-experiment.md",
"new_path": "docs/running-your-own-experiment/running_your_own_experiment.md",
"diff": ""
}
] | Python | Apache License 2.0 | google/fuzzbench | Rename running-your-own-experiment.md to running_your_own_experiment.md (#28)
Do this for consistency.
* Don't set two pages as first.
* Fix spelling and don't duplicate order again |
258,388 | 02.03.2020 08:44:13 | 28,800 | cf1cd40294f8a31c14eb10bab4e6f6446bfeab92 | [docs] Add doc on how FuzzBench works. | [
{
"change_type": "ADD",
"old_path": "docs/images/FuzzBench-architecture.png",
"new_path": "docs/images/FuzzBench-architecture.png",
"diff": "Binary files /dev/null and b/docs/images/FuzzBench-architecture.png differ\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "docs/reference/how_it_works.md",
"diff": "+---\n+layout: default\n+title: How it works\n+parent: Reference\n+nav_order: 3\n+permalink: /reference/how-it-works/\n+---\n+\n+# How it works\n+{: .no_toc}\n+\n+This document provides a high-level description of how FuzzBench works\n+end-to-end. It isn't necessary for users of the FuzzBench service to know\n+most of these details.\n+\n+- TOC\n+{:toc}\n+\n+---\n+\n+## Overview\n+\n+\n+![FuzzBench architecture]({{site.baseurl}}/images/FuzzBench-architecture.png)\n+\n+## Dispatcher\n+\n+As mentioned in the [guide to running an experiment]({{\n+site.baseurl}}/running-your-own-experiment/running-an-experiment/),\n+`run_experiment.py` creates a [Google Compute Engine (GCE)\n+instance](https://cloud.google.com/compute) called the dispatcher to run an\n+experiment. In addition to referring to the instance, \"dispatcher\" can also\n+refer to the [script/process the instance\n+runs](https://github.com/google/fuzzbench/blob/master/experiment/dispatcher.py).\n+The dispatcher (script) doesn't actually do much on its own. It does some\n+basic initialization like saving details about the experiment to the database\n+and then starts four other major components - the builder, the scheduler, the\n+measurer, and the reporter. All of these components run on the dispatcher\n+instance (note that we don't include it in the architecture diagram because of\n+its unique role).\n+\n+## Builder\n+\n+The\n+[builder](https://github.com/google/fuzzbench/blob/master/experiment/builder.py)\n+produces a build for each fuzzer-benchmark\n+pair needed by the experiment and does a coverage build for each benchmark.\n+The builder uses the [Google Cloud Build](https://cloud.google.com/cloud-build)\n+service for building the docker images needed by the experiment since it is\n+faster and simpler than building them on GCE instances. When the builder\n+finishes doing the needed builds, it terminates. Thus, unlike other components,\n+it isn't running for the duration of an experiment.\n+\n+### Builds\n+\n+Details on how builds work are provided in the [guide to adding a new fuzzer]({{\n+site.baseurl}}/getting-started/adding-a-new-fuzzer/) and the [guide to adding a\n+new benchmark]({{ site.baseurl}}/developing-fuzzbench/adding-a-new-benchmark/).\n+Note that we use AddressSanitizer for the benchmark builds of most fuzzers\n+(i.e. all of them support it) so that it will be easier to add support for\n+measuring performance based on crashes.\n+\n+## Scheduler\n+\n+Once the builder has finished, the dispatcher starts the scheduler. The\n+scheduler is responsible for starting and stopping trial runners, which are\n+instances on GCE. The scheduler will continuously try to create instances for\n+trials that haven't run yet. This means that if an experiment requires too many\n+resources from Google Cloud to complete at once, it can still be run anyway\n+after some resources are freed up by trials that have finished running. The\n+scheduler stops trials after they have run for the amount of time specified when\n+[starting the experiment]({{\n+site.baseurl}}/running-your-own-experiment/running-an-experiment/#experiment-configuration-file).\n+The scheduler stops running after all trials finish running.\n+\n+## Trial runners\n+\n+Trial runners are GCE instances that fuzz benchmarks. They start by pulling the\n+docker images that were produced by the [builder](/#Builder) and uploaded to the\n+container registry. Then, from within the container, they run\n+[runner.py](https://github.com/google/fuzzbench/blob/master/experiment/runner.py)\n+which calls the `fuzz` function from the `fuzzer.py` file for the specified\n+fuzzer\n+([example](https://github.com/google/fuzzbench/blob/master/fuzzers/fairfuzz/fuzzer.py)).\n+The runner will also periodically archive the current `output_corpus` and sync\n+it to [Google Cloud Storage](https://cloud.google.com/storage) (this is\n+sometimes referred to as a \"corpus snapshot\"). The runner terminates when it has\n+run the `fuzz` function for the time specified for each trial when [starting the\n+experiment]({{\n+site.baseurl}}/running-your-own-experiment/running-an-experiment/#experiment-configuration-file).\n+\n+## Measurer\n+\n+The role of the\n+[measurer](https://github.com/google/fuzzbench/blob/master/experiment/measurer.py)\n+is to take the output of the trial runners and make it usable for generating\n+reports. To do this, the measurer downloads coverage builds for each benchmark\n+and then continuously downloads corpus snapshots, measures their coverage, and\n+saves the result to the database, a [PostgreSQL](https://www.postgresql.org/)\n+instance running on [Google Cloud SQL](https://cloud.google.com/sql). The\n+measurer terminates when there is no corpus snapshot for this experiment that\n+hasn't been measured. Because the measurer is run on the dispatcher instance, it\n+can't scale with the size of an experiment, so it can actually finish after the\n+experiment is done (usually a few hours after the end of an experiment). The\n+dispatcher instance terminates after the measurer terminates itself.\n+\n+### Coverage builds\n+\n+Running coverage builds does not require any dependencies that aren't available\n+on the dispatcher. One reason for this is because OSS-Fuzz only allows projects\n+(which are used as benchmarks) to install dependencies in the docker container\n+they use for building, and not in the one they use for fuzzing. Therefore, the\n+measurer, doesn't actually use the images from coverage builds, it simply runs\n+the binaries directly on the dispatcher.\n+\n+## Reporter\n+\n+The role of the reporter is to convert coverage (and other data in the future)\n+data output by the measurer into a human consumable report. It runs continuously\n+in a loop while the dispatcher is alive, consuming the coverage data from the\n+SQL database and then outputting an HTML report which it saves to a Google Cloud\n+Storage bucket (which you can access by going to\n+[fuzzbench.com/reports/](https://fuzzbench.com/reports/)).\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/reference/useful_links.md",
"new_path": "docs/reference/useful_links.md",
"diff": "---\nlayout: default\ntitle: Useful links\n-nav_order: 3\n+nav_order: 4\npermalink: /reference/useful-links/\nparent: Reference\n---\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [docs] Add doc on how FuzzBench works. (#32) |
258,388 | 02.03.2020 09:27:07 | 28,800 | 1bb0f18f22a978791ee52c812cf295c9f4c7a7a9 | [docs] Always call it 'sample' report for consistency | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -20,14 +20,14 @@ To participate, submit your fuzzer to run on the FuzzBench platform by following\nhttps://google.github.io/fuzzbench/getting-started/).\nAfter your integration is accepted, we will run a large-scale experiment using\nyour fuzzer and generate a report comparing your fuzzer to others.\n-See [an example report](https://www.fuzzbench.com/reports/sample/index.html).\n+See [a sample report](https://www.fuzzbench.com/reports/sample/index.html).\n## Overview\n![FuzzBench Service diagram](docs/images/FuzzBench-service.png)\n## Sample Report\n-You can view an example report\n+You can view a sample report\n[here](https://www.fuzzbench.com/reports/sample/index.html).\nThis report is generated using 10 fuzzers against 24 real-world benchmarks,\nwith 20 trials each and over a duration of 24 hours.\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/index.md",
"new_path": "docs/index.md",
"diff": "@@ -29,7 +29,7 @@ To participate, submit your fuzzer to run on the FuzzBench platform by following\nAfter your integration is accepted, we will run a large-scale experiment using\nyour fuzzer and generate a report comparing your fuzzer to others, such as AFL\nand libFuzzer.\n-See [an example report](https://www.fuzzbench.com/reports/sample/index.html).\n+See [a sample report](https://www.fuzzbench.com/reports/sample/index.html).\n## Overview\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [docs] Always call it 'sample' report for consistency (#34) |
258,388 | 02.03.2020 11:42:59 | 28,800 | 384b63e03479aa0568471a5af461fe6bb50bd675 | Add blogpost link | [
{
"change_type": "MODIFY",
"old_path": "docs/reference/useful_links.md",
"new_path": "docs/reference/useful_links.md",
"diff": "@@ -19,4 +19,8 @@ access them [here](https://www.fuzzbench.com/reports/index.html).\n## Blog posts\n-TODO: Add link to launch blog post.\n+Announcement blog post:\n+\n+[https://security.googleblog.com/2020/03/fuzzbench-fuzzer-benchmarking-as-service.html](https://security.googleblog.com/2020/03/fuzzbench-fuzzer-benchmarking-as-service.html)\n+\n+[https://opensource.googleblog.com/2020/03/fuzzbench-fuzzer-benchmarking-as-service.html](https://opensource.googleblog.com/2020/03/fuzzbench-fuzzer-benchmarking-as-service.html)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Add blogpost link (#37) |
258,390 | 03.03.2020 18:22:01 | -3,600 | 26c788c927d980c28e2e3e2cdc9af24b1260bb74 | Update honggfuzz to
It'll allow the systemd target to be fully-instrumented.
This honggfuzz version was tested locally/manually with systemd
and with lcms fuzzers from the fuzzbench project.
Closes | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/honggfuzz/builder.Dockerfile",
"new_path": "fuzzers/honggfuzz/builder.Dockerfile",
"diff": "@@ -18,10 +18,10 @@ FROM $parent_image\n# honggfuzz requires libfd and libunwid.\nRUN apt-get update -y && apt-get install -y libbfd-dev libunwind-dev libblocksruntime-dev\n-# Download honggfuz version 2.0.\n+# Download honggfuz version 2.1 + 77ea4dc4b499799e20ba33ef5df0152ecd113925\n# Set CFLAGS use honggfuzz's defaults except for -mnative which can build CPU\n# dependent code that may not work on the machines we actually fuzz on.\nRUN git clone https://github.com/google/honggfuzz.git /honggfuzz && \\\ncd /honggfuzz && \\\n- git checkout d1de86d03b2b4e332915ee1eda06e62c43daa9b6 && \\\n+ git checkout 77ea4dc4b499799e20ba33ef5df0152ecd113925 && \\\nCFLAGS=\"-O3 -funroll-loops\" make\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Update honggfuzz to 77ea4dc4b499799e20ba33ef5df0152ecd113925. (#49)
It'll allow the systemd target to be fully-instrumented.
This honggfuzz version was tested locally/manually with systemd
and with lcms fuzzers from the fuzzbench project.
Closes #47 |
258,388 | 04.03.2020 09:02:17 | 28,800 | 2b68547981d3f049fc6ec9c6ca84ebb7b4b122ca | Warn users if presubmit fails because it is on a new repo. | [
{
"change_type": "MODIFY",
"old_path": "docs/getting-started/prerequisites.md",
"new_path": "docs/getting-started/prerequisites.md",
"diff": "@@ -24,6 +24,7 @@ Clone the FuzzBench repository to your machine by running the following command:\ngit clone https://github.com/google/fuzzbench\ncd fuzzbench\ngit submodule update --init\n+git pull --rebase # So that presubmit scripts work.\n```\n## Installing prerequisites\n"
},
{
"change_type": "MODIFY",
"old_path": "presubmit.py",
"new_path": "presubmit.py",
"diff": "@@ -261,11 +261,16 @@ def license_check(paths: List[Path]) -> bool:\ndef get_changed_files() -> List[Path]:\n\"\"\"Return a list of absolute paths of files changed in this git branch.\"\"\"\ndiff_command = ['git', 'diff', '--name-only', 'FETCH_HEAD']\n+ try:\n+ output = subprocess.check_output(diff_command).decode().splitlines()\nreturn [\n- Path(path).absolute()\n- for path in subprocess.check_output(diff_command).decode().splitlines()\n- if Path(path).is_file()\n+ Path(path).absolute() for path in output if Path(path).is_file()\n]\n+ except subprocess.CalledProcessError:\n+ pass\n+ raise Exception(\n+ ('\"%s\" failed. Please run \"git pull origin master --rebase\" and try'\n+ ' again.') % ' '.join(diff_command))\ndef do_tests() -> bool:\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Warn users if presubmit fails because it is on a new repo. (#60) |
258,388 | 04.03.2020 09:02:43 | 28,800 | 4e33e4e05782d5f2f5e9e49c17b875c7436b2595 | Run presubmit seperately | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/ci.yml",
"new_path": ".github/workflows/ci.yml",
"diff": "@@ -3,6 +3,18 @@ name: CI\non: [pull_request]\njobs:\n+ presubmit:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ - name: Setup Python environment\n+ uses: actions/setup-python@v1.1.1\n+ with:\n+ python-version: 3.7\n+ - name: Run presubmit checks\n+ run: |\n+ make presubmit\n+\nbuild:\nruns-on: ubuntu-latest\n@@ -32,7 +44,4 @@ jobs:\npython-version: 3.7\n- name: Build benchmarks\nrun: |\n- make install-dependencies\n- source .venv/bin/activate\n- make presubmit\nmake build-$FUZZER_NAME-all\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Run presubmit seperately (#58) |
258,388 | 04.03.2020 18:23:27 | 28,800 | de03b5887cfaf6507f10bca8f757b22a7d099cf6 | [new_process] Use get instead of get_nowait to avoid hogging CPU. | [
{
"change_type": "MODIFY",
"old_path": "common/new_process.py",
"new_path": "common/new_process.py",
"diff": "@@ -26,6 +26,7 @@ from typing import List, Tuple\nfrom common import logs\nLOG_LIMIT_FIELD = 10 * 1024 # 10 KB.\n+WAIT_SECONDS = 5\ndef _enqueue_file_lines(process: subprocess.Popen,\n@@ -71,9 +72,7 @@ def _mirror_output(process: subprocess.Popen, output_files: List) -> str:\nwhile True:\n# See if we can get a line from the queue.\ntry:\n- # TODO(metzman): Handle cases where the process does not have utf-8\n- # encoded output.\n- line = out_queue.get_nowait().decode('utf-8', errors='ignore')\n+ line = out_queue.get(timeout=WAIT_SECONDS).decode('utf-8', errors='ignore')\nexcept queue.Empty:\nif not thread.is_alive():\nbreak\n"
},
{
"change_type": "MODIFY",
"old_path": "conftest.py",
"new_path": "conftest.py",
"diff": "@@ -21,6 +21,12 @@ from unittest import mock\nimport pytest\nimport sqlalchemy\n+from common import new_process\n+\n+# Never wait for a timeout so that tests don't take any longer than they need\n+# to.\n+new_process.WAIT_SECONDS = 0\n+\n# Set this to an in-memory instance of SQLite so that db_utils can be imported\n# without running a real Postgres database.\n# pylint: disable=wrong-import-position\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [new_process] Use get instead of get_nowait to avoid hogging CPU. (#65) |
258,388 | 05.03.2020 08:29:05 | 28,800 | b40f67b9fd315ba94fa0a2250ec2740e626f87d6 | [base-builder] Copy llvm tools as well
Copy llvm tools from the OSS-Fuzz clang installation.
This should evenutally be replaced by building clang in the image instead of copying from another image. | [
{
"change_type": "MODIFY",
"old_path": "docker/base-builder/Dockerfile",
"new_path": "docker/base-builder/Dockerfile",
"diff": "@@ -46,6 +46,7 @@ RUN apt-get update -y && apt-get install -y \\\n# Copy clang binaries and libs.\nCOPY --from=base-clang /usr/local/bin/clang* /usr/local/bin/\n+COPY --from=base-clang /usr/local/bin/llvm-* /usr/local/bin/\nCOPY --from=base-clang /usr/local/lib/clang /usr/local/lib/clang\nCOPY --from=base-clang /usr/local/lib/libc++*.a /usr/local/lib/\nCOPY --from=base-clang /usr/local/include/ /usr/local/include\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [base-builder] Copy llvm tools as well (#61)
Copy llvm tools from the OSS-Fuzz clang installation.
This should evenutally be replaced by building clang in the image instead of copying from another image. |
258,388 | 05.03.2020 09:16:58 | 28,800 | 48974e05283ac652377f0fcd128ed1d972ff979d | [CI] Only build fuzzer images when necessary
Only build them when there has been a change that affects them. | [
{
"change_type": "RENAME",
"old_path": ".github/workflows/ci.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "-name: CI\n-\n-on: [pull_request]\n+name: Build fuzzers\n+on:\n+ pull_request:\n+ paths:\n+ - 'docker/**' # Base images changes.\n+ - 'fuzzers/**' # Changes to fuzzers themselves.\n+ - 'benchmarks/**' # Changes to benchmarks.\njobs:\n- presubmit:\n- runs-on: ubuntu-latest\n- steps:\n- - uses: actions/checkout@v2\n- - name: Setup Python environment\n- uses: actions/setup-python@v1.1.1\n- with:\n- python-version: 3.7\n- - name: Run presubmit checks\n- run: |\n- make presubmit\n-\nbuild:\nruns-on: ubuntu-latest\n-\nstrategy:\nfail-fast: false\nmatrix:\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": ".github/workflows/presubmit.yml",
"diff": "+name: CI\n+\n+on: [pull_request]\n+\n+jobs:\n+ presubmit:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ - name: Setup Python environment\n+ uses: actions/setup-python@v1.1.1\n+ with:\n+ python-version: 3.7\n+ - name: Run presubmit checks\n+ run: |\n+ make presubmit\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [CI] Only build fuzzer images when necessary (#68)
Only build them when there has been a change that affects them. |
258,388 | 05.03.2020 16:44:02 | 28,800 | 3d48d1122637fe5cc11a50fc581942f53be01cc5 | [aflplusplus] Use afl-clang-fast(++) as compiler
Use afl-clang-fast(++) as compiler instead of clang with
trace-pc-guard for faster and better instrumentation. | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflplusplus/builder.Dockerfile",
"new_path": "fuzzers/aflplusplus/builder.Dockerfile",
"diff": "ARG parent_image=gcr.io/fuzzbench/base-builder\nFROM $parent_image\n+# Install wget to download afl_driver.cpp. Install libstdc++ to use llvm_mode.\n+RUN apt-get update && \\\n+ apt-get install wget libstdc++-5-dev -y\n+\n# Download and compile afl++ (v2.60c).\n# Build without Python support as we don't need it.\n# Set AFL_NO_X86 to skip flaky tests.\nRUN git clone https://github.com/vanhauser-thc/AFLplusplus.git /afl && \\\ncd /afl && \\\ngit checkout 842cd9dec3c4c83d660d96dcdb3f5cf0c6e6f4fb && \\\n- AFL_NO_X86=1 make PYTHON_INCLUDE=/\n+ AFL_NO_X86=1 make PYTHON_INCLUDE=/ && \\\n+ cd llvm_mode && \\\n+ CXXFLAGS= make\n# Use afl_driver.cpp from LLVM as our fuzzing library.\n-RUN apt-get update && \\\n- apt-get install wget -y && \\\n- wget https://raw.githubusercontent.com/llvm/llvm-project/5feb80e748924606531ba28c97fe65145c65372e/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /afl/afl_driver.cpp && \\\n- clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -I/afl && \\\n+RUN wget https://raw.githubusercontent.com/llvm/llvm-project/5feb80e748924606531ba28c97fe65145c65372e/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /afl/afl_driver.cpp && \\\nclang++ -stdlib=libc++ -std=c++11 -O2 -c /afl/afl_driver.cpp && \\\n- ar r /libAFL.a *.o\n+ ar ru /libAFLDriver.a *.o\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflplusplus/fuzzer.py",
"new_path": "fuzzers/aflplusplus/fuzzer.py",
"diff": "@@ -17,13 +17,35 @@ import os\nimport shutil\nfrom fuzzers.afl import fuzzer as afl_fuzzer\n+from fuzzers import utils\n# OUT environment variable is the location of build directory (default is /out).\ndef build():\n\"\"\"Build fuzzer.\"\"\"\n- afl_fuzzer.build()\n+ cflags = [\n+ '-O2',\n+ '-fno-omit-frame-pointer',\n+ '-gline-tables-only',\n+ '-fsanitize=address',\n+ ]\n+ utils.append_flags('CFLAGS', cflags)\n+ utils.append_flags('CXXFLAGS', cflags)\n+\n+ os.environ['CC'] = '/afl/afl-clang-fast'\n+ os.environ['CXX'] = '/afl/afl-clang-fast++'\n+ os.environ['FUZZER_LIB'] = '/libAFLDriver.a'\n+\n+ # Some benchmarks like lcms\n+ # (see: https://github.com/mm2/Little-CMS/commit/ab1093539b4287c233aca6a3cf53b234faceb792#diff-f0e6d05e72548974e852e8e55dffc4ccR212)\n+ # fail to compile if the compiler outputs things to stderr in unexpected\n+ # cases. Prevent these failures by using AFL_QUIET to stop afl-clang-fast\n+ # from writing AFL specific messages to stderr.\n+ os.environ['AFL_QUIET'] = '1'\n+\n+ utils.build_benchmark()\n+ shutil.copy('/afl/afl-fuzz', os.environ['OUT'])\ndef fuzz(input_corpus, output_corpus, target_binary):\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [aflplusplus] Use afl-clang-fast(++) as compiler (#69)
Use afl-clang-fast(++) as compiler instead of clang with
trace-pc-guard for faster and better instrumentation. |
258,388 | 09.03.2020 09:37:05 | 25,200 | 5dbb50e9bb8a6fb3584f25f26fb88bebea02d699 | [reports] Add label-by-experiment name to generate_report.py
This makes it easier to determine how a fuzzer has progressed over the course of multiple
experiments. | [
{
"change_type": "MODIFY",
"old_path": "experiment/generate_report.py",
"new_path": "experiment/generate_report.py",
"diff": "@@ -33,17 +33,17 @@ def get_arg_parser():\nparser.add_argument('experiment', nargs='+', help='Experiment name')\nparser.add_argument(\n'-n',\n- '--report_name',\n+ '--report-name',\nhelp='Name of the report. Default: name of the first experiment.')\nparser.add_argument(\n'-t',\n- '--report_type',\n+ '--report-type',\nchoices=['default'],\ndefault='default',\nhelp='Type of the report (which template to use). Default: default.')\nparser.add_argument(\n'-d',\n- '--report_dir',\n+ '--report-dir',\ndefault='./report',\nhelp='Directory for writing a report. Default: ./report')\nparser.add_argument(\n@@ -52,9 +52,16 @@ def get_arg_parser():\naction='store_true',\ndefault=False,\nhelp='If set, plots are created faster, but contain less details.')\n+ parser.add_argument(\n+ '-l',\n+ '--label-by-experiment',\n+ action='store_true',\n+ default=False,\n+ help='If set, then the report will track progress made in experiments')\n+\nparser.add_argument(\n'-c',\n- '--from_cached_data',\n+ '--from-cached-data',\naction='store_true',\ndefault=False,\nhelp=('If set, and the experiment data is already cached, '\n@@ -63,10 +70,20 @@ def get_arg_parser():\nreturn parser\n+def label_fuzzers_by_experiment(experiment_df):\n+ \"\"\"Returns a dataframe where every fuzzer is labeled by the experiment it\n+ was run in.\"\"\"\n+ experiment_df['fuzzer'] = (experiment_df['fuzzer'] + '-' +\n+ experiment_df['experiment'])\n+\n+ return experiment_df\n+\n+\n# pylint: disable=too-many-arguments\ndef generate_report(experiment_names,\nreport_directory,\nreport_name=None,\n+ label_by_experiment=False,\nreport_type='default',\nquick=False,\nfrom_cached_data=False):\n@@ -83,6 +100,9 @@ def generate_report(experiment_names,\n# Save the raw data along with the report.\nexperiment_df.to_csv(data_path)\n+ if label_by_experiment:\n+ experiment_df = label_fuzzers_by_experiment(experiment_df)\n+\nfuzzer_names = experiment_df.fuzzer.unique()\nplotter = plotting.Plotter(fuzzer_names, quick)\nexperiment_ctx = experiment_results.ExperimentResults(\n@@ -103,7 +123,8 @@ def main():\nargs = parser.parse_args()\ngenerate_report(args.experiment, args.report_dir, args.report_name,\n- args.report_type, args.quick, args.from_cached_data)\n+ args.label_by_experiment, args.report_type, args.quick,\n+ args.from_cached_data)\nif __name__ == '__main__':\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "experiment/test_generate_report.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions andsss\n+# limitations under the License.\n+\"\"\"Tests for generate_report.py\"\"\"\n+import pandas as pd\n+\n+from experiment import generate_report\n+\n+\n+def label_fuzzers_by_experiment():\n+ \"\"\"Tests that label_fuzzers_by_experiment includes the experiment name in\n+ the fuzzer name\"\"\"\n+ input_df = pd.DataFrame({\n+ 'experiment': ['experiment-a', 'experiment-b'],\n+ 'fuzzer': ['fuzzer-1', 'fuzzer-2']\n+ })\n+ labeled_df = generate_report.label_fuzzers_by_experiment(input_df)\n+\n+ expected_fuzzers_df = pd.DataFrame(\n+ {'fuzzer': ['fuzzer-1-experiment-a', 'fuzzer-2-experiment-b']})\n+\n+ assert (labeled_df['fuzzer'] == expected_fuzzers_df['fuzzer']).all()\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [reports] Add label-by-experiment name to generate_report.py (#62)
This makes it easier to determine how a fuzzer has progressed over the course of multiple
experiments. |
258,388 | 09.03.2020 14:01:38 | 25,200 | 2db4efc668f23a5dde4ae10de30998af19cf739e | [generate_report] Support fuzzer selection with -f option
[generate_report] Support fuzzer selection with -f option
Allow users of generate_report to specify the fuzzers they want
included in a report using `--fuzzers` (`-f` for short). | [
{
"change_type": "MODIFY",
"old_path": "experiment/generate_report.py",
"new_path": "experiment/generate_report.py",
"diff": "@@ -30,7 +30,7 @@ from common import logs\ndef get_arg_parser():\n\"\"\"Returns argument parser.\"\"\"\nparser = argparse.ArgumentParser(description='Report generator.')\n- parser.add_argument('experiment', nargs='+', help='Experiment name')\n+ parser.add_argument('experiments', nargs='+', help='Experiment names')\nparser.add_argument(\n'-n',\n'--report-name',\n@@ -52,6 +52,10 @@ def get_arg_parser():\naction='store_true',\ndefault=False,\nhelp='If set, plots are created faster, but contain less details.')\n+ parser.add_argument('-f',\n+ '--fuzzers',\n+ nargs='*',\n+ help='Names of the fuzzers to include in the report. ')\nparser.add_argument(\n'-l',\n'--label-by-experiment',\n@@ -79,11 +83,18 @@ def label_fuzzers_by_experiment(experiment_df):\nreturn experiment_df\n+def filter_fuzzers(experiment_df, included_fuzzers):\n+ \"\"\"Returns a DataFrame of rows in |experiment_df| where each row's fuzzer is\n+ in |included_fuzzers|.\"\"\"\n+ return experiment_df[experiment_df['fuzzer'].isin(included_fuzzers)]\n+\n+\n# pylint: disable=too-many-arguments\ndef generate_report(experiment_names,\nreport_directory,\nreport_name=None,\nlabel_by_experiment=False,\n+ fuzzers=None,\nreport_type='default',\nquick=False,\nfrom_cached_data=False):\n@@ -100,6 +111,9 @@ def generate_report(experiment_names,\n# Save the raw data along with the report.\nexperiment_df.to_csv(data_path)\n+ if fuzzers is not None:\n+ experiment_df = filter_fuzzers(experiment_df, fuzzers)\n+\nif label_by_experiment:\nexperiment_df = label_fuzzers_by_experiment(experiment_df)\n@@ -122,9 +136,9 @@ def main():\nparser = get_arg_parser()\nargs = parser.parse_args()\n- generate_report(args.experiment, args.report_dir, args.report_name,\n- args.label_by_experiment, args.report_type, args.quick,\n- args.from_cached_data)\n+ generate_report(args.experiments, args.report_dir, args.report_name,\n+ args.label_by_experiment, args.fuzzers, args.report_type,\n+ args.quick, args.from_cached_data)\nif __name__ == '__main__':\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [generate_report] Support fuzzer selection with -f option (#80)
[generate_report] Support fuzzer selection with -f option
Allow users of generate_report to specify the fuzzers they want
included in a report using `--fuzzers` (`-f` for short). |
258,390 | 10.03.2020 15:15:52 | -3,600 | 9184199334f8a457dfbf67aa99c03c5dbaf73317 | Update honggfuzz to the newest version | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/honggfuzz/builder.Dockerfile",
"new_path": "fuzzers/honggfuzz/builder.Dockerfile",
"diff": "@@ -18,14 +18,14 @@ FROM $parent_image\n# honggfuzz requires libfd and libunwid.\nRUN apt-get update -y && apt-get install -y libbfd-dev libunwind-dev libblocksruntime-dev\n-# Download honggfuz version 2.1 + af1b7b21dca0bd7ee586c3f17524ee41c855c5a5\n+# Download honggfuz version 2.1 + 815ccf8e9580b8c83ee673211da9fa217d354b5f\n# Set CFLAGS use honggfuzz's defaults except for -mnative which can build CPU\n# dependent code that may not work on the machines we actually fuzz on.\n# Create an empty object file which will become the FUZZER_LIB lib (since\n# honggfuzz doesn't need this when hfuzz-clang(++) is used).\nRUN git clone https://github.com/google/honggfuzz.git /honggfuzz && \\\ncd /honggfuzz && \\\n- git checkout af1b7b21dca0bd7ee586c3f17524ee41c855c5a5 && \\\n+ git checkout 815ccf8e9580b8c83ee673211da9fa217d354b5f && \\\nCFLAGS=\"-O3 -funroll-loops\" make && \\\ntouch empty_lib.c && \\\ncc -c -o empty_lib.o empty_lib.c\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Update honggfuzz to the newest version (#87) |
258,388 | 10.03.2020 10:07:37 | 25,200 | 2f1e4f6230b279920cac512f96c080721f685b5b | [run_experiment] Use all benchmarks if no benchmarks arg provided
Use all benchmarks if no benchmarks arg provided | [
{
"change_type": "MODIFY",
"old_path": "experiment/run_experiment.py",
"new_path": "experiment/run_experiment.py",
"diff": "@@ -103,15 +103,6 @@ def get_directories(parent_dir):\ndef validate_benchmarks(benchmarks: List[str]):\n\"\"\"Parses and validates list of benchmarks.\"\"\"\n- benchmark_directories = get_directories(BENCHMARKS_DIR)\n- if not os.path.exists(OSS_FUZZ_PROJECTS_DIR):\n- logs.warning('OSS-Fuzz repository is not checked out.'\n- 'skipping OSS-Fuzz benchmarks.')\n-\n- for benchmark in benchmarks:\n- if benchmark not in benchmark_directories:\n- raise Exception('Benchmark \"%s\" does not exist.' % benchmark)\n-\nfor benchmark in set(benchmarks):\nif benchmarks.count(benchmark) > 1:\nraise Exception('Benchmark \"%s\" is included more than once.' %\n@@ -302,17 +293,38 @@ class Dispatcher:\nzone=self.config['cloud_compute_zone'])\n+def get_all_benchmarks():\n+ \"\"\"Returns the list of all benchmarks.\"\"\"\n+ benchmarks_dir = os.path.join(utils.ROOT_DIR, 'benchmarks')\n+ all_benchmarks = []\n+ for benchmark in os.listdir(benchmarks_dir):\n+ benchmark_path = os.path.join(benchmarks_dir, benchmark)\n+ if os.path.isfile(os.path.join(benchmark_path, 'oss-fuzz.yaml')):\n+ # Benchmark is an OSS-Fuzz benchmark.\n+ all_benchmarks.append(benchmark)\n+ elif os.path.isfile(os.path.join(benchmark_path, 'build.sh')):\n+ # Benchmark is a standard benchmark.\n+ all_benchmarks.append(benchmark)\n+ return all_benchmarks\n+\n+\ndef main():\n\"\"\"Run an experiment in the cloud.\"\"\"\n+ logs.initialize()\n+\nparser = argparse.ArgumentParser(\ndescription='Begin an experiment that evaluates fuzzers on one or '\n'more benchmarks.')\n+ all_benchmarks = get_all_benchmarks()\n+\nparser.add_argument('-b',\n'--benchmarks',\n- help='Benchmark names.',\n+ help='Benchmark names. All of them by default.',\nnargs='+',\n- required=True)\n+ required=False,\n+ default=all_benchmarks,\n+ choices=all_benchmarks)\nparser.add_argument('-c',\n'--experiment-config',\nhelp='Path to the experiment configuration yaml file.',\n@@ -335,7 +347,6 @@ def main():\ndefault=[])\nargs = parser.parse_args()\n- logs.initialize()\nstart_experiment(args.experiment_name, args.experiment_config,\nargs.benchmarks, args.fuzzers, args.fuzzer_configs)\nif not os.getenv('MANUAL_EXPERIMENT'):\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [run_experiment] Use all benchmarks if no benchmarks arg provided (#88)
Use all benchmarks if no benchmarks arg provided |
258,388 | 10.03.2020 10:09:22 | 25,200 | 0893d76b8073f810d25101ae755a4012f692ae89 | [generate_report] Support benchmark selection with -b option | [
{
"change_type": "MODIFY",
"old_path": "analysis/data_utils.py",
"new_path": "analysis/data_utils.py",
"diff": "@@ -29,10 +29,16 @@ def drop_uninteresting_columns(experiment_df):\ndef filter_fuzzers(experiment_df, included_fuzzers):\n- \"\"\"Returns table with only rows where fuzzer in in |included_fuzzers|.\"\"\"\n+ \"\"\"Returns table with only rows where fuzzer is in |included_fuzzers|.\"\"\"\nreturn experiment_df[experiment_df['fuzzer'].isin(included_fuzzers)]\n+def filter_benchmarks(experiment_df, included_benchmarks):\n+ \"\"\"Returns table with only rows where benchmark is in\n+ |included_benchmarks|.\"\"\"\n+ return experiment_df[experiment_df['benchmark'].isin(included_benchmarks)]\n+\n+\ndef label_fuzzers_by_experiment(experiment_df):\n\"\"\"Returns table where every fuzzer is labeled by the experiment it\nwas run in.\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/generate_report.py",
"new_path": "experiment/generate_report.py",
"diff": "@@ -53,7 +53,13 @@ def get_arg_parser():\naction='store_true',\ndefault=False,\nhelp='If set, plots are created faster, but contain less details.')\n- parser.add_argument('-f',\n+ parser.add_argument(\n+ '-b',\n+ '--benchmarks',\n+ nargs='*',\n+ help='Names of the benchmarks to include in the report.')\n+ parser.add_argument(\n+ '-f',\n'--fuzzers',\nnargs='*',\nhelp='Names of the fuzzers to include in the report.')\n@@ -80,6 +86,7 @@ def generate_report(experiment_names,\nreport_directory,\nreport_name=None,\nlabel_by_experiment=False,\n+ benchmarks=None,\nfuzzers=None,\nreport_type='default',\nquick=False,\n@@ -97,6 +104,9 @@ def generate_report(experiment_names,\n# Save the raw data along with the report.\nexperiment_df.to_csv(data_path)\n+ if benchmarks is not None:\n+ experiment_df = data_utils.filter_benchmarks(experiment_df, benchmarks)\n+\nif fuzzers is not None:\nexperiment_df = data_utils.filter_fuzzers(experiment_df, fuzzers)\n@@ -123,7 +133,7 @@ def main():\nargs = parser.parse_args()\ngenerate_report(args.experiments, args.report_dir, args.report_name,\n- args.label_by_experiment, args.fuzzers, args.report_type,\n+ args.label_by_experiment, args.benchmarks, args.fuzzers, args.report_type,\nargs.quick, args.from_cached_data)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [generate_report] Support benchmark selection with -b option (#89) |
258,406 | 11.03.2020 22:58:17 | -32,400 | 94de19293d44bfe97482b619e619d62d090b176a | Update Eclipser to use commit
Resolves Eclipser's mishandling of initial seed corpus.
Makes Eclipser to use edge coverage instead of node coverage.
Cleanup and configuration update. | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/eclipser/runner.Dockerfile",
"new_path": "fuzzers/eclipser/runner.Dockerfile",
"diff": "@@ -37,5 +37,5 @@ RUN wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsof\n# Build Eclipser.\nRUN git clone https://github.com/SoftSec-KAIST/Eclipser /Eclipser && \\\ncd /Eclipser && \\\n- git checkout 8a00591ce3158c2860739725d4362213f587ec72 && \\\n+ git checkout b072f045324869c607d3cdfa8fae0cdfed944492 && \\\nmake\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Update Eclipser to use commit b072f045 (#92)
- Resolves Eclipser's mishandling of initial seed corpus.
- Makes Eclipser to use edge coverage instead of node coverage.
- Cleanup and configuration update. |
258,376 | 12.03.2020 04:19:50 | -39,600 | a65fe98fc63adc0b24c599c582234179c32e0eae | [AFLSmart] Add AFLSmart structure-aware greybox fuzzer
Add AFLSmart structure-aware greybox fuzzer | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -16,6 +16,7 @@ jobs:\n- afl\n- aflfast\n- aflplusplus\n+ - aflsmart\n- eclipser\n- entropic\n- fairfuzz\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/aflsmart/builder.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+ARG parent_image=gcr.io/fuzzbench/base-builder\n+FROM $parent_image\n+\n+# install AFLSmart dependencies\n+RUN dpkg --add-architecture i386 && \\\n+ apt-get update -y && apt-get install -y \\\n+ apt-utils \\\n+ libc6-dev-i386 \\\n+ python-pip \\\n+ g++-multilib \\\n+ mono-complete \\\n+ gnupg-curl \\\n+ software-properties-common\n+\n+# install gcc-4.4 & g++-4.4 required by Peach while running on Ubuntu 16.04\n+RUN add-apt-repository --keyserver hkps://keyserver.ubuntu.com:443 ppa:ubuntu-toolchain-r/test -y && \\\n+ apt-get update -y && apt-get install -y \\\n+ gcc-4.4 \\\n+ g++-4.4 \\\n+ unzip \\\n+ wget \\\n+ tzdata\n+\n+# Download and compile AFLSmart\n+RUN git clone https://github.com/aflsmart/aflsmart /afl && \\\n+ cd afl && \\\n+ git checkout df095901ea379f033d4d82345023de004f28b9a7 && \\\n+ AFL_NO_X86=1 make\n+\n+# setup Peach\n+RUN cd /afl && \\\n+ wget https://sourceforge.net/projects/peachfuzz/files/Peach/3.0/peach-3.0.202-source.zip && \\\n+ unzip peach-3.0.202-source.zip && \\\n+ patch -p1 < peach-3.0.202.patch && \\\n+ cd peach-3.0.202-source && \\\n+ CC=gcc-4.4 CXX=g++-4.4 CXXFLAGS=\"-std=c++0x\" ./waf configure && \\\n+ CC=gcc-4.4 CXX=g++-4.4 CXXFLAGS=\"-std=c++0x\" ./waf install\n+\n+# Use afl_driver.cpp from LLVM as our fuzzing library.\n+RUN wget https://raw.githubusercontent.com/llvm/llvm-project/5feb80e748924606531ba28c97fe65145c65372e/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /afl/afl_driver.cpp && \\\n+ clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -I/afl && \\\n+ clang++ -stdlib=libc++ -std=c++11 -O2 -c /afl/afl_driver.cpp && \\\n+ ar r /libAFL.a *.o\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/aflsmart/fuzzer.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Integration code for AFLSmart fuzzer.\"\"\"\n+\n+import os\n+import shutil\n+import glob\n+\n+from fuzzers.afl import fuzzer as afl_fuzzer\n+\n+# OUT environment variable is the location of build directory (default is /out).\n+\n+\n+def build():\n+ \"\"\"Build fuzzer.\"\"\"\n+ afl_fuzzer.build()\n+\n+ # Copy Peach binaries to OUT\n+ shutil.copytree('/afl/peach-3.0.202-source/output/linux_x86_64_debug/bin', os.environ['OUT'] + '/peach-3.0.202')\n+\n+ # Copy supported input models\n+ for file in glob.glob('/afl/input_models/*.xml'):\n+ print(file)\n+ shutil.copy(file, os.environ['OUT'])\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run afl-fuzz on target.\"\"\"\n+ afl_fuzzer.prepare_fuzz_environment(input_corpus)\n+ os.environ['PATH'] += os.pathsep + '/out/peach-3.0.202/'\n+\n+ input_model = ''\n+ benchmark_name = os.environ['BENCHMARK']\n+ if benchmark_name == 'libpng-1.2.56':\n+ input_model = 'png.xml'\n+ if benchmark_name == 'libpcap_fuzz_both':\n+ input_model = 'pcap.xml'\n+ if benchmark_name == 'libjpeg-turbo-07-2017':\n+ input_model = 'jpeg.xml'\n+\n+ if input_model != '':\n+ afl_fuzzer.run_afl_fuzz(\n+ input_corpus,\n+ output_corpus,\n+ target_binary,\n+ additional_flags=[\n+ # Enable stacked mutations\n+ '-h',\n+ # Enable structure-aware fuzzing\n+ '-w',\n+ 'peach',\n+ # Select input model\n+ '-g',\n+ input_model,\n+ ])\n+ else:\n+ afl_fuzzer.run_afl_fuzz(\n+ input_corpus,\n+ output_corpus,\n+ target_binary)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/aflsmart/runner.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+FROM gcr.io/fuzzbench/base-runner\n+\n+RUN apt-get update -y && apt-get install -y \\\n+ mono-complete \\\n+ tzdata\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [AFLSmart] Add AFLSmart structure-aware greybox fuzzer (#84)
Add AFLSmart structure-aware greybox fuzzer |
258,388 | 11.03.2020 12:21:50 | 25,200 | 81f0e681de1afeff24abb592b9d8a45182ada4e0 | [aflsmart] Format | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflsmart/fuzzer.py",
"new_path": "fuzzers/aflsmart/fuzzer.py",
"diff": "@@ -27,13 +27,15 @@ def build():\nafl_fuzzer.build()\n# Copy Peach binaries to OUT\n- shutil.copytree('/afl/peach-3.0.202-source/output/linux_x86_64_debug/bin', os.environ['OUT'] + '/peach-3.0.202')\n+ shutil.copytree('/afl/peach-3.0.202-source/output/linux_x86_64_debug/bin',\n+ os.environ['OUT'] + '/peach-3.0.202')\n# Copy supported input models\nfor file in glob.glob('/afl/input_models/*.xml'):\nprint(file)\nshutil.copy(file, os.environ['OUT'])\n+\ndef fuzz(input_corpus, output_corpus, target_binary):\n\"\"\"Run afl-fuzz on target.\"\"\"\nafl_fuzzer.prepare_fuzz_environment(input_corpus)\n@@ -64,7 +66,4 @@ def fuzz(input_corpus, output_corpus, target_binary):\ninput_model,\n])\nelse:\n- afl_fuzzer.run_afl_fuzz(\n- input_corpus,\n- output_corpus,\n- target_binary)\n+ afl_fuzzer.run_afl_fuzz(input_corpus, output_corpus, target_binary)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [aflsmart] Format (#96) |
258,388 | 11.03.2020 15:09:31 | 25,200 | cfe54c171652e2c8dc5f84b535666cf9cb9d0b13 | [docs] Fix links in setting_up_a_google_cloud_project.md | [
{
"change_type": "MODIFY",
"old_path": "docs/running-your-own-experiment/setting_up_a_google_cloud_project.md",
"new_path": "docs/running-your-own-experiment/setting_up_a_google_cloud_project.md",
"diff": "@@ -38,7 +38,7 @@ export PROJECT_NAME=<your-project-name>\nFor the rest of this page, replace `$PROJECT_NAME` with the name of the\nproject you created.\n-* [Install Google Cloud SDK](https://console.cloud.google.com/sdk/install).\n+* [Install Google Cloud SDK](https://cloud.google.com/sdk/install).\n* Set your default project using gcloud:\n@@ -132,7 +132,7 @@ docker build -f docker/dispatcher-image/Dockerfile \\\nFuzzBench uses an instance running this image to manage most of the experiment.\n-* [Enable Google Container Registry API](https://console.console.cloud.google.com/apis/api/containerregistry.googleapis.com/overview)\n+* [Enable Google Container Registry API](https://console.cloud.google.com/apis/api/containerregistry.googleapis.com/overview)\nto use the container registry.\n* Push `dispatcher-image` to the docker registry:\n@@ -162,7 +162,7 @@ so that FuzzBench can connect to the database.\n## Configure networking\n* Go to the networking page for the network you want to run your experiment in.\n-[This](https://cloud.console.google.com/networking/subnetworks/details/us-central1/default)\n+[This](https://console.cloud.google.com/networking/subnetworks/details/us-central1/default)\nis the networking page for the default network in \"us-central1\". It is best if\nyou use `$POSTGRES_REGION` for this.\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [docs] Fix links in setting_up_a_google_cloud_project.md (#100) |
258,388 | 11.03.2020 15:41:22 | 25,200 | 3b0452d6c59eceeb3f26393edfc9bcf0cc937c65 | [aflplusplus] Use COMPAT_CFLAGS and fix comments and formatting. | [
{
"change_type": "MODIFY",
"old_path": "docker/base-builder/Dockerfile",
"new_path": "docker/base-builder/Dockerfile",
"diff": "@@ -52,4 +52,4 @@ COPY --from=base-clang /usr/local/lib/libc++*.a /usr/local/lib/\nCOPY --from=base-clang /usr/local/include/ /usr/local/include\n# Use libc++ thoughout the build.\n-ENV CXXFLAGS -stdlib=libc++ -pthread\n+ENV CXXFLAGS -stdlib=libc++\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflplusplus/fuzzer.py",
"new_path": "fuzzers/aflplusplus/fuzzer.py",
"diff": "@@ -33,34 +33,33 @@ def build():\n\"\"\"Build fuzzer.\"\"\"\n# BUILD_MODES is not already supported by fuzzbench, meanwhile we provide\n# a default configuration\n- build_modes = [\"instrim\", \"laf\"]\n- if \"BUILD_MODES\" in os.environ:\n+ build_modes = ['instrim', 'laf']\n+ if 'BUILD_MODES' in os.environ:\nbuild_modes = os.environ['BUILD_MODES'].split(',')\n- cflags = [\n+ utils.set_no_sanitizer_compilation_flags()\n+ optimization_cflags = [\n'-O2',\n- '-fno-omit-frame-pointer',\n- '-gline-tables-only',\n]\n- utils.append_flags('CFLAGS', cflags)\n- utils.append_flags('CXXFLAGS', cflags)\n+ utils.append_flags('CFLAGS', optimization_cflags)\n+ utils.append_flags('CXXFLAGS', optimization_cflags)\n- if \"qemu\" in build_modes:\n+ if 'qemu' in build_modes:\nos.environ['CC'] = 'clang'\nos.environ['CXX'] = 'clang++'\nelse:\nos.environ['CC'] = '/afl/afl-clang-fast'\nos.environ['CXX'] = '/afl/afl-clang-fast++'\n- if \"laf\" in build_modes:\n+ if 'laf' in build_modes:\nos.environ['AFL_LLVM_LAF_SPLIT_SWITCHES'] = '1'\nos.environ['AFL_LLVM_LAF_TRANSFORM_COMPARES'] = '1'\nos.environ['AFL_LLVM_LAF_SPLIT_COMPARES'] = '1'\n- if \"instrim\" in build_modes:\n+ if 'instrim' in build_modes:\n# I avoid to put also AFL_LLVM_INSTRIM_LOOPHEAD\n- os.environ[\"AFL_LLVM_INSTRIM\"] = \"1\"\n- os.environ[\"AFL_LLVM_INSTRIM_SKIPSINGLEBLOCK\"] = \"1\"\n+ os.environ['AFL_LLVM_INSTRIM'] = '1'\n+ os.environ['AFL_LLVM_INSTRIM_SKIPSINGLEBLOCK'] = '1'\nos.environ['FUZZER_LIB'] = '/libAFLDriver.a'\n@@ -79,11 +78,11 @@ def build():\n# twice in the same directory without this.\nutils.build_benchmark()\n- if \"cmplog\" in build_modes and \"qemu\" not in build_modes:\n+ if 'cmplog' in build_modes and 'qemu' not in build_modes:\n# CmpLog requires an build with different instrumentation.\nnew_env = os.environ.copy()\n- new_env[\"AFL_LLVM_CMPLOG\"] = \"1\"\n+ new_env['AFL_LLVM_CMPLOG'] = '1'\n# For CmpLog build, set the OUT and FUZZ_TARGET environment\n# variable to point to the new CmpLog build directory.\n@@ -115,9 +114,9 @@ def fuzz(input_corpus, output_corpus, target_binary):\nafl_fuzzer.prepare_fuzz_environment(input_corpus)\nos.environ['AFL_PRELOAD'] = '/afl/libdislocator.so'\n- flags = [\"-d\"] # FidgetyAFL is better when runnign alone\n+ flags = ['-d'] # FidgetyAFL is better when running alone.\nif os.path.exists(cmplog_target_binary):\n- flags += [\"-c\", cmplog_target_binary]\n+ flags += ['-c', cmplog_target_binary]\nif 'ADDITIONAL_ARGS' in os.environ:\nflags += os.environ['ADDITIONAL_ARGS'].split(' ')\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/utils.py",
"new_path": "fuzzers/utils.py",
"diff": "@@ -61,8 +61,7 @@ NO_SANITIZER_COMPAT_CFLAGS = [\n'-pthread', '-Wl,--no-as-needed', '-Wl,-ldl', '-Wl,-lm',\n'-Wno-unused-command-line-argument'\n]\n-NO_SANITIZER_COMPAT_CXXFLAGS = ['-stdlib=libc++', '-pthread'] + \\\n- NO_SANITIZER_COMPAT_CFLAGS\n+NO_SANITIZER_COMPAT_CXXFLAGS = ['-stdlib=libc++'] + NO_SANITIZER_COMPAT_CFLAGS\ndef set_no_sanitizer_compilation_flags(env=None):\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [aflplusplus] Use COMPAT_CFLAGS and fix comments and formatting. (#99) |
258,388 | 11.03.2020 16:36:54 | 25,200 | 309c69bbfaf671b5198467d5d20dd880c23b9b1b | [run_experiment] Use all fuzzers if fuzzers+fuzzer_configs not provided | [
{
"change_type": "MODIFY",
"old_path": "experiment/run_experiment.py",
"new_path": "experiment/run_experiment.py",
"diff": "@@ -169,10 +169,6 @@ def start_experiment(experiment_name: str, config_filename: str,\nwith open(experiment_config_filename, 'w') as experiment_config_file:\nyaml.dump(config, experiment_config_file, default_flow_style=False)\n- if not fuzzers and not fuzzer_configs:\n- raise Exception('Need to provide either a list of fuzzers or '\n- 'a list of fuzzer configs.')\n-\nfuzzer_config_dir = os.path.join(config_dir, 'fuzzer-configs')\nfilesystem.recreate_directory(fuzzer_config_dir)\nfor fuzzer_config in fuzzer_configs:\n@@ -308,6 +304,16 @@ def get_all_benchmarks():\nreturn all_benchmarks\n+def get_all_fuzzers():\n+ \"\"\"Returns the list of all fuzzers.\"\"\"\n+ fuzzers_dir = os.path.join(utils.ROOT_DIR, 'fuzzers')\n+ return [\n+ fuzzer for fuzzer in os.listdir(fuzzers_dir)\n+ if (os.path.isfile(\n+ os.path.join(fuzzers_dir, fuzzer, 'fuzzer.py')) and\n+ fuzzer != 'coverage')\n+ ]\n+\ndef main():\n\"\"\"Run an experiment in the cloud.\"\"\"\nlogs.initialize()\n@@ -347,8 +353,13 @@ def main():\ndefault=[])\nargs = parser.parse_args()\n+ if not args.fuzzers and not args.fuzzer_configs:\n+ fuzzers = get_all_fuzzers()\n+ else:\n+ fuzzers = args.fuzzers\n+\nstart_experiment(args.experiment_name, args.experiment_config,\n- args.benchmarks, args.fuzzers, args.fuzzer_configs)\n+ args.benchmarks, fuzzers, args.fuzzer_configs)\nif not os.getenv('MANUAL_EXPERIMENT'):\nstop_experiment.stop_experiment(args.experiment_name,\nargs.experiment_config)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [run_experiment] Use all fuzzers if fuzzers+fuzzer_configs not provided (#101) |
258,388 | 11.03.2020 18:50:25 | 25,200 | a96560010456c066e5f9e18de53dbb9334d005ed | Move restore_directory into utils so other modules can use it. | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflplusplus/fuzzer.py",
"new_path": "fuzzers/aflplusplus/fuzzer.py",
"diff": "import os\nimport shutil\n-import contextlib\n-import tempfile\nfrom fuzzers.afl import fuzzer as afl_fuzzer\nfrom fuzzers import utils\n@@ -72,7 +70,7 @@ def build():\nsrc = os.getenv('SRC')\nwork = os.getenv('WORK')\n- with restore_directory(src), restore_directory(work):\n+ with utils.restore_directory(src), utils.restore_directory(work):\n# Restore SRC to its initial state so we can build again without any\n# trouble. For some OSS-Fuzz projects, build_benchmark cannot be run\n# twice in the same directory without this.\n@@ -124,37 +122,3 @@ def fuzz(input_corpus, output_corpus, target_binary):\noutput_corpus,\ntarget_binary,\nadditional_flags=flags)\n-\n-\n-@contextlib.contextmanager\n-def restore_directory(directory):\n- \"\"\"Helper contextmanager that when created saves a backup of |directory| and\n- when closed/exited replaces |directory| with the backup.\n-\n- Example usage:\n-\n- directory = 'my-directory'\n- with restore_directory(directory):\n- shutil.rmtree(directory)\n- # At this point directory is in the same state where it was before we\n- # deleted it.\n- \"\"\"\n- # TODO(metzman): Figure out if this is worth it, so far it only allows QSYM\n- # to compile bloaty.\n- if not directory:\n- # Don't do anything if directory is None.\n- yield\n- return\n- # Save cwd so that if it gets deleted we can just switch into the restored\n- # version without code that runs after us running into issues.\n- initial_cwd = os.getcwd()\n- with tempfile.TemporaryDirectory() as temp_dir:\n- backup = os.path.join(temp_dir, os.path.basename(directory))\n- shutil.copytree(directory, backup)\n- yield\n- shutil.rmtree(directory)\n- shutil.move(backup, directory)\n- try:\n- os.getcwd()\n- except FileNotFoundError:\n- os.chdir(initial_cwd)\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/qsym/fuzzer.py",
"new_path": "fuzzers/qsym/fuzzer.py",
"diff": "# limitations under the License.\n\"\"\"Integration code for QSYM fuzzer.\"\"\"\n-import contextlib\nimport shutil\nimport subprocess\nimport os\n-import tempfile\nimport threading\nimport time\n@@ -43,7 +41,7 @@ def build():\nsrc = os.getenv('SRC')\nwork = os.getenv('WORK')\n- with restore_directory(src), restore_directory(work):\n+ with utils.restore_directory(src), utils.restore_directory(work):\n# Restore SRC to its initial state so we can build again without any\n# trouble. For some OSS-Fuzz projects, build_benchmark cannot be run\n# twice in the same directory without this.\n@@ -112,37 +110,3 @@ def fuzz(input_corpus, output_corpus, target_binary):\n'./qsym/bin/run_qsym_afl.py', '-a', 'afl-slave', '-o', output_corpus,\n'-n', 'qsym', '--', uninstrumented_target_binary\n])\n-\n-\n-@contextlib.contextmanager\n-def restore_directory(directory):\n- \"\"\"Helper contextmanager that when created saves a backup of |directory| and\n- when closed/exited replaces |directory| with the backup.\n-\n- Example usage:\n-\n- directory = 'my-directory'\n- with restore_directory(directory):\n- shutil.rmtree(directory)\n- # At this point directory is in the same state where it was before we\n- # deleted it.\n- \"\"\"\n- # TODO(metzman): Figure out if this is worth it, so far it only allows QSYM\n- # to compile bloaty.\n- if not directory:\n- # Don't do anything if directory is None.\n- yield\n- return\n- # Save cwd so that if it gets deleted we can just switch into the restored\n- # version without code that runs after us running into issues.\n- initial_cwd = os.getcwd()\n- with tempfile.TemporaryDirectory() as temp_dir:\n- backup = os.path.join(temp_dir, os.path.basename(directory))\n- shutil.copytree(directory, backup)\n- yield\n- shutil.rmtree(directory)\n- shutil.move(backup, directory)\n- try:\n- os.getcwd()\n- except FileNotFoundError:\n- os.chdir(initial_cwd)\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/utils.py",
"new_path": "fuzzers/utils.py",
"diff": "# limitations under the License.\n\"\"\"Utility functions for running fuzzers.\"\"\"\n+import contextlib\nimport os\nimport shutil\nimport subprocess\n+import tempfile\nOSS_FUZZ_LIB_FUZZING_ENGINE_PATH = '/usr/lib/libFuzzingEngine.a'\n@@ -72,3 +74,37 @@ def set_no_sanitizer_compilation_flags(env=None):\nenv = os.environ\nenv['CFLAGS'] = ' '.join(NO_SANITIZER_COMPAT_CFLAGS)\nenv['CXXFLAGS'] = ' '.join(NO_SANITIZER_COMPAT_CXXFLAGS)\n+\n+\n+@contextlib.contextmanager\n+def restore_directory(directory):\n+ \"\"\"Helper contextmanager that when created saves a backup of |directory| and\n+ when closed/exited replaces |directory| with the backup.\n+\n+ Example usage:\n+\n+ directory = 'my-directory'\n+ with restore_directory(directory):\n+ shutil.rmtree(directory)\n+ # At this point directory is in the same state where it was before we\n+ # deleted it.\n+ \"\"\"\n+ # TODO(metzman): Figure out if this is worth it, so far it only allows QSYM\n+ # to compile bloaty.\n+ if not directory:\n+ # Don't do anything if directory is None.\n+ yield\n+ return\n+ # Save cwd so that if it gets deleted we can just switch into the restored\n+ # version without code that runs after us running into issues.\n+ initial_cwd = os.getcwd()\n+ with tempfile.TemporaryDirectory() as temp_dir:\n+ backup = os.path.join(temp_dir, os.path.basename(directory))\n+ shutil.copytree(directory, backup)\n+ yield\n+ shutil.rmtree(directory)\n+ shutil.move(backup, directory)\n+ try:\n+ os.getcwd()\n+ except FileNotFoundError:\n+ os.chdir(initial_cwd)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Move restore_directory into utils so other modules can use it. (#98) |
258,388 | 15.03.2020 16:10:03 | 25,200 | eb2496473ea0fa0d0ad15d519b94129898128c81 | Make presubmit work for new repos and fix lint/format/type checking in CI | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/presubmit.yml",
"new_path": ".github/workflows/presubmit.yml",
"diff": "@@ -7,6 +7,9 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n+ - run: | # Needed for presubmit to work.\n+ git fetch origin master --depth 1\n+ git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master\n- name: Setup Python environment\nuses: actions/setup-python@v1.1.1\nwith:\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/getting-started/prerequisites.md",
"new_path": "docs/getting-started/prerequisites.md",
"diff": "@@ -24,7 +24,6 @@ Clone the FuzzBench repository to your machine by running the following command:\ngit clone https://github.com/google/fuzzbench\ncd fuzzbench\ngit submodule update --init\n-git pull --rebase # So that presubmit scripts work.\n```\n## Installing prerequisites\n"
},
{
"change_type": "MODIFY",
"old_path": "presubmit.py",
"new_path": "presubmit.py",
"diff": "@@ -260,17 +260,30 @@ def license_check(paths: List[Path]) -> bool:\ndef get_changed_files() -> List[Path]:\n\"\"\"Return a list of absolute paths of files changed in this git branch.\"\"\"\n- diff_command = ['git', 'diff', '--name-only', 'FETCH_HEAD']\n+ uncommitted_diff_command = ['git', 'diff', '--name-only', 'HEAD']\n+ output = subprocess.check_output(\n+ uncommitted_diff_command).decode().splitlines()\n+ uncommitted_changed_files = set(\n+ Path(path).absolute() for path in output if Path(path).is_file())\n+\n+ committed_diff_command = ['git', 'diff', '--name-only', 'origin...']\ntry:\n- output = subprocess.check_output(diff_command).decode().splitlines()\n- return [\n- Path(path).absolute() for path in output if Path(path).is_file()\n- ]\n+ output = subprocess.check_output(\n+ committed_diff_command).decode().splitlines()\n+ committed_changed_files = set(\n+ Path(path).absolute() for path in output if Path(path).is_file())\n+ return list(committed_changed_files.union(uncommitted_changed_files))\nexcept subprocess.CalledProcessError:\n+ # This probably won't happen to anyone. It can happen if your copy\n+ # of the repo wasn't cloned so give instructions on how to handle.\npass\n- raise Exception(\n- ('\"%s\" failed. Please run \"git pull origin master --rebase\" and try'\n- ' again.') % ' '.join(diff_command))\n+ raise Exception((\n+ '\"%s\" failed.\\n'\n+ 'Please run \"git fetch origin master && '\n+ 'git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master\" '\n+ 'and try again.\\n'\n+ 'Please file an issue if this doesn\\'t fix things.') %\n+ ' '.join(committed_diff_command))\ndef do_tests() -> bool:\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Make presubmit work for new repos and fix lint/format/type checking in CI (#97) |
258,387 | 15.03.2020 22:45:39 | 14,400 | 5a6b36fb42cc87b8bb24c4631516856778cb6cf8 | [fastcgs] Add a new experimental fuzzer named fastcgs | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -20,6 +20,7 @@ jobs:\n- eclipser\n- entropic\n- fairfuzz\n+ - fastcgs\n- honggfuzz\n- libfuzzer\n- mopt\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/fastcgs/builder.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+ARG parent_image=gcr.io/fuzzbench/base-builder\n+FROM $parent_image\n+\n+# Install wget to download afl_driver.cpp. Install libstdc++ to use llvm_mode.\n+RUN apt-get update && \\\n+ apt-get install wget libstdc++-5-dev -y\n+\n+# Download and compile afl++ (v2.62d).\n+# Build without Python support as we don't need it.\n+# Set AFL_NO_X86 to skip flaky tests.\n+\n+RUN rm -rf /afl\n+\n+RUN git clone https://github.com/alifahmed/aflmod /afl && \\\n+ cd /afl && \\\n+ git checkout 45a7513bbf9890e54e7593449cd6404efdb3ee16 && \\\n+ export AFL_LLVM_LAF_SPLIT_SWITCHES=1 && \\\n+ export AFL_LLVM_LAF_TRANSFORM_COMPARES=1 && \\\n+ export AFL_LLVM_LAF_SPLIT_COMPARES=1 && \\\n+ AFL_NO_X86=1 make PYTHON_INCLUDE=/ && \\\n+ cd llvm_mode && \\\n+ CXXFLAGS= make\n+\n+# Use afl_driver.cpp from LLVM as our fuzzing library.\n+RUN wget https://raw.githubusercontent.com/llvm/llvm-project/5feb80e748924606531ba28c97fe65145c65372e/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /afl/afl_driver.cpp && \\\n+ clang++ -stdlib=libc++ -std=c++11 -O2 -c /afl/afl_driver.cpp && \\\n+ ar ru /libAFLDriver.a *.o\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/fastcgs/fuzzer.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Integration code for AFLplusplus fuzzer.\"\"\"\n+\n+import os\n+import shutil\n+\n+from fuzzers.afl import fuzzer as afl_fuzzer\n+from fuzzers import utils\n+\n+# OUT environment variable is the location of build directory (default is /out).\n+\n+\n+def build():\n+ \"\"\"Build fuzzer.\"\"\"\n+ cflags = [\n+ '-O2',\n+ '-fno-omit-frame-pointer',\n+ '-gline-tables-only',\n+ '-fsanitize=address',\n+ ]\n+ utils.append_flags('CFLAGS', cflags)\n+ utils.append_flags('CXXFLAGS', cflags)\n+\n+ os.environ['CC'] = '/afl/afl-clang-fast'\n+ os.environ['CXX'] = '/afl/afl-clang-fast++'\n+ os.environ['FUZZER_LIB'] = '/libAFLDriver.a'\n+\n+ # Some benchmarks like lcms\n+ # (see: https://github.com/mm2/Little-CMS/commit/ab1093539b4287c233aca6a3cf53b234faceb792#diff-f0e6d05e72548974e852e8e55dffc4ccR212)\n+ # fail to compile if the compiler outputs things to stderr in unexpected\n+ # cases. Prevent these failures by using AFL_QUIET to stop afl-clang-fast\n+ # from writing AFL specific messages to stderr.\n+ os.environ['AFL_QUIET'] = '1'\n+\n+ utils.build_benchmark()\n+ shutil.copy('/afl/afl-fuzz', os.environ['OUT'])\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\"\"\"\n+ afl_fuzzer.prepare_fuzz_environment(input_corpus)\n+\n+ afl_fuzzer.run_afl_fuzz(\n+ input_corpus,\n+ output_corpus,\n+ target_binary,\n+ additional_flags=[\n+ # Enable AFLFast's power schedules with default exponential\n+ # schedule.\n+ '-p',\n+ 'fast',\n+ # Enable Mopt mutator with pacemaker fuzzing mode at first. This\n+ # is also recommended in a short-time scale evaluation.\n+ '-L',\n+ '0',\n+ ])\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/fastcgs/runner.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+FROM gcr.io/fuzzbench/base-runner\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [fastcgs] Add a new experimental fuzzer named fastcgs (#78) |
258,388 | 15.03.2020 21:41:00 | 25,200 | ac642951a9ad7a039d51f66f1ec96e151067860c | [presubmit] Remove unnecessary git diff invocation
Remove unnecessary git diff invocation that was accidentally
left out of previous commit. | [
{
"change_type": "MODIFY",
"old_path": "presubmit.py",
"new_path": "presubmit.py",
"diff": "@@ -260,19 +260,15 @@ def license_check(paths: List[Path]) -> bool:\ndef get_changed_files() -> List[Path]:\n\"\"\"Return a list of absolute paths of files changed in this git branch.\"\"\"\n- uncommitted_diff_command = ['git', 'diff', '--name-only', 'HEAD']\n- output = subprocess.check_output(\n- uncommitted_diff_command).decode().splitlines()\n- uncommitted_changed_files = set(\n- Path(path).absolute() for path in output if Path(path).is_file())\n-\n- committed_diff_command = ['git', 'diff', '--name-only', 'origin...']\n+ diff_command = ['git', 'diff', '--name-only', 'origin...']\ntry:\n- output = subprocess.check_output(\n- committed_diff_command).decode().splitlines()\n- committed_changed_files = set(\n- Path(path).absolute() for path in output if Path(path).is_file())\n- return list(committed_changed_files.union(uncommitted_changed_files))\n+ output = subprocess.check_output(diff_command).decode().splitlines()\n+ changed_files = list(\n+ set(\n+ Path(path).absolute()\n+ for path in output\n+ if Path(path).is_file()))\n+ return changed_files\nexcept subprocess.CalledProcessError:\n# This probably won't happen to anyone. It can happen if your copy\n# of the repo wasn't cloned so give instructions on how to handle.\n@@ -283,7 +279,7 @@ def get_changed_files() -> List[Path]:\n'git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master\" '\n'and try again.\\n'\n'Please file an issue if this doesn\\'t fix things.') %\n- ' '.join(committed_diff_command))\n+ ' '.join(diff_command))\ndef do_tests() -> bool:\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [presubmit] Remove unnecessary git diff invocation (#103)
Remove unnecessary git diff invocation that was accidentally
left out of previous commit. |
258,388 | 16.03.2020 14:46:29 | 25,200 | c431056e0d0b3df9e74f84c1ec935cc6c190ff15 | Move code out of try-except to prevent UnboundLocalError
Move code out of try-except to prevent UnboundLocalError | [
{
"change_type": "MODIFY",
"old_path": "analysis/plotting.py",
"new_path": "analysis/plotting.py",
"diff": "@@ -313,11 +313,10 @@ class Plotter:\ncritical_difference = Orange.evaluation.compute_CD(\naverage_ranks.values, num_of_benchmarks)\n- try:\n- Orange.evaluation.graph_ranks(average_ranks.values,\n- average_ranks.index,\n+ Orange.evaluation.graph_ranks(average_ranks.values, average_ranks.index,\ncritical_difference)\nfig = plt.gcf()\n+ try:\nfig.savefig(image_path, bbox_inches=\"tight\")\nfinally:\nplt.close(fig)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Move code out of try-except to prevent UnboundLocalError (#109)
Move code out of try-except to prevent UnboundLocalError |
258,376 | 18.03.2020 05:34:52 | -39,600 | f8a26aa72b0240b8783220b7b4ee8cbfbdd03b2f | Update experiment summary text
Also, add README.md for AFLSmart | [
{
"change_type": "MODIFY",
"old_path": "analysis/report_templates/default.html",
"new_path": "analysis/report_templates/default.html",
"diff": "Aggregate critical difference diagram showing average ranks when\nranking fuzzers on each benchmark according to their median reached\ncoverages. Critical difference is based on Friedman/Nemenyi post-hoc\n- test. See more in the\n- <a href=\"https://google.github.io/fuzzbench/reference/report/\">\n- documentation</a>.\n+ test. See more in the <a href=\"https://google.github.io/fuzzbench/reference/report/\">\n+ documentation</a>.<br>\n+ Note: If a fuzzer does not support all benchmarks,\n+ its ranking as shown in this diagram can be lower than it should be.\n+ So please check the list of supported benchmarks for the fuzzer(s) of your interest.\n+ The list could be specified in the fuzzer's README.md like\n+ <a href=\"https://github.com/google/fuzzbench/blob/master/fuzzers/aflsmart/README.md\">this</a>.\n<div class=\"row\">\n<div class=\"col s7 offset-s3\">\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Update experiment summary text (#121)
Also, add README.md for AFLSmart
Co-authored-by: Abhishek Arya <inferno@chromium.org> |
258,388 | 18.03.2020 08:38:50 | 25,200 | 8d9375d51f8cdd9d398c9b34e13e50b9a70f337e | [aflplusplus_mopt] add afl++ mopt variant
PR with some minor nits fixed | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -16,6 +16,7 @@ jobs:\n- afl\n- aflfast\n- aflplusplus\n+ - aflplusplus_mopt\n- aflsmart\n- eclipser\n- entropic\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflplusplus/fuzzer.py",
"new_path": "fuzzers/aflplusplus/fuzzer.py",
"diff": "@@ -30,7 +30,7 @@ def get_cmplog_build_directory(target_directory):\ndef build():\n\"\"\"Build fuzzer.\"\"\"\n# BUILD_MODES is not already supported by fuzzbench, meanwhile we provide\n- # a default configuration\n+ # a default configuration.\nbuild_modes = ['instrim', 'laf']\nif 'BUILD_MODES' in os.environ:\nbuild_modes = os.environ['BUILD_MODES'].split(',')\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/aflplusplus_mopt/builder.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+ARG parent_image=gcr.io/fuzzbench/base-builder\n+FROM $parent_image\n+\n+# Install wget to download afl_driver.cpp. Install libstdc++ to use llvm_mode.\n+RUN apt-get update && \\\n+ apt-get install wget libstdc++-5-dev -y\n+\n+# Download and compile afl++ (v2.62d).\n+# Build without Python support as we don't need it.\n+# Set AFL_NO_X86 to skip flaky tests.\n+RUN git clone https://github.com/vanhauser-thc/AFLplusplus.git /afl && \\\n+ cd /afl && \\\n+ git checkout 35720304be17b94c3167cd3ce2bb8afe64bfe538 && \\\n+ AFL_NO_X86=1 make PYTHON_INCLUDE=/ && \\\n+ cd libdislocator && make && cd .. && \\\n+ cd llvm_mode && CXXFLAGS= make\n+\n+# Use afl_driver.cpp from LLVM as our fuzzing library.\n+RUN wget https://raw.githubusercontent.com/llvm/llvm-project/5feb80e748924606531ba28c97fe65145c65372e/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /afl/afl_driver.cpp && \\\n+ clang++ -stdlib=libc++ -std=c++11 -O2 -c /afl/afl_driver.cpp && \\\n+ ar ru /libAFLDriver.a *.o\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/aflplusplus_mopt/fuzzer.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Integration code for AFLplusplus fuzzer.\"\"\"\n+\n+import os\n+\n+from fuzzers.afl import fuzzer as afl_fuzzer\n+from fuzzers.aflplusplus import fuzzer as aflplusplus_fuzzer\n+\n+# OUT environment variable is the location of build directory (default is /out).\n+\n+\n+def build():\n+ \"\"\"Build fuzzer.\"\"\"\n+ aflplusplus_fuzzer.build()\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\"\"\"\n+ # Calculate CmpLog binary path from the instrumented target binary.\n+ target_binary_directory = os.path.dirname(target_binary)\n+ cmplog_target_binary_directory = (\n+ aflplusplus_fuzzer.get_cmplog_build_directory(target_binary_directory))\n+ target_binary_name = os.path.basename(target_binary)\n+ cmplog_target_binary = os.path.join(cmplog_target_binary_directory,\n+ target_binary_name)\n+\n+ afl_fuzzer.prepare_fuzz_environment(input_corpus)\n+ # os.environ['AFL_PRELOAD'] = '/afl/libdislocator.so'\n+\n+ flags = ['-L0'] # afl++ MOpt activation at once\n+ flags += ['-pfast'] # fast scheduling\n+ if os.path.exists(cmplog_target_binary):\n+ flags += ['-c', cmplog_target_binary]\n+ if 'ADDITIONAL_ARGS' in os.environ:\n+ flags += os.environ['ADDITIONAL_ARGS'].split(' ')\n+\n+ afl_fuzzer.run_afl_fuzz(input_corpus,\n+ output_corpus,\n+ target_binary,\n+ additional_flags=flags)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/aflplusplus_mopt/runner.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+FROM gcr.io/fuzzbench/base-runner\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [aflplusplus_mopt] add afl++ mopt variant (#122)
PR #111 with some minor nits fixed
Co-authored-by: van Hauser <vh@thc.org> |
258,388 | 19.03.2020 10:32:41 | 25,200 | 32ca56c8cb613ffe706b10ac59f110bd902764be | [QSYM] Remove fuzzer
As pointed out to us, qsym doesn't work on kernels used in linux
distros newer than Ubuntu 14.0.4 or Centos 7. | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -25,7 +25,6 @@ jobs:\n- honggfuzz\n- libfuzzer\n- mopt\n- - qsym\nenv:\nFUZZER_NAME: ${{ matrix.fuzzer }}\n"
},
{
"change_type": "DELETE",
"old_path": "fuzzers/qsym/builder.Dockerfile",
"new_path": null,
"diff": "-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\n-ARG parent_image=gcr.io/fuzzbench/base-builder\n-FROM $parent_image\n-\n-# QSym runs on afl instrumented binaries.\n-\n-# Download and compile AFL v2.56b.\n-# Set AFL_NO_X86 to skip flaky tests.\n-RUN git clone https://github.com/google/AFL.git /afl && \\\n- cd /afl && \\\n- git checkout 8da80951dd7eeeb3e3b5a3bcd36c485045f40274 && \\\n- AFL_NO_X86=1 make\n-\n-# Use afl_driver.cpp from LLVM as our fuzzing library.\n-RUN apt-get update && \\\n- apt-get install wget -y && \\\n- wget https://raw.githubusercontent.com/llvm/llvm-project/5feb80e748924606531ba28c97fe65145c65372e/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /afl/afl_driver.cpp && \\\n- clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -I/afl && \\\n- clang++ -stdlib=libc++ -std=c++11 -O2 -c /afl/afl_driver.cpp && \\\n- ar r /libQSYM.a *.o\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "fuzzers/qsym/fuzzer.py",
"new_path": null,
"diff": "-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\"\"\"Integration code for QSYM fuzzer.\"\"\"\n-\n-import shutil\n-import subprocess\n-import os\n-import threading\n-import time\n-\n-from fuzzers import utils\n-from fuzzers.afl import fuzzer as afl_fuzzer\n-\n-# FUZZ_TARGET environment variable is location of the fuzz target (default is\n-# /out/fuzz-target).\n-# OUT environment variable is the location of build directory (default is /out).\n-\n-\n-def get_uninstrumented_build_directory(target_directory):\n- \"\"\"Return path to uninstrumented target directory.\"\"\"\n- return os.path.join(target_directory, 'uninstrumented')\n-\n-\n-def build():\n- \"\"\"Build fuzzer.\"\"\"\n- afl_fuzzer.prepare_build_environment()\n-\n- # Override AFL's FUZZER_LIB with QSYM's.\n- os.environ['FUZZER_LIB'] = '/libQSYM.a'\n-\n- src = os.getenv('SRC')\n- work = os.getenv('WORK')\n- with utils.restore_directory(src), utils.restore_directory(work):\n- # Restore SRC to its initial state so we can build again without any\n- # trouble. For some OSS-Fuzz projects, build_benchmark cannot be run\n- # twice in the same directory without this.\n- utils.build_benchmark()\n-\n- # QSYM requires an uninstrumented build as well.\n- new_env = os.environ.copy()\n- utils.set_no_sanitizer_compilation_flags(new_env)\n- cflags = ['-O2', '-fno-omit-frame-pointer', '-gline-tables-only']\n- utils.append_flags('CFLAGS', cflags, new_env)\n- utils.append_flags('CXXFLAGS', cflags, new_env)\n-\n- # For uninstrumented build, set the OUT and FUZZ_TARGET environment\n- # variable to point to the new uninstrumented build directory.\n- build_directory = os.environ['OUT']\n- uninstrumented_build_directory = get_uninstrumented_build_directory(\n- build_directory)\n- os.mkdir(uninstrumented_build_directory)\n- new_env['OUT'] = uninstrumented_build_directory\n- fuzz_target = os.getenv('FUZZ_TARGET')\n- if fuzz_target:\n- new_env['FUZZ_TARGET'] = os.path.join(uninstrumented_build_directory,\n- os.path.basename(fuzz_target))\n-\n- print('Re-building benchmark for uninstrumented fuzzing target')\n- utils.build_benchmark(env=new_env)\n-\n- print('[post_build] Copying afl-fuzz to $OUT directory')\n- # Copy out the afl-fuzz binary as a build artifact.\n- shutil.copy('/afl/afl-fuzz', build_directory)\n- # QSYM also requires afl-showmap.\n- print('[post_build] Copying afl-showmap to $OUT directory')\n- shutil.copy('/afl/afl-showmap', build_directory)\n-\n-\n-def fuzz(input_corpus, output_corpus, target_binary):\n- \"\"\"Run fuzzer.\"\"\"\n- # Calculate uninstrumented binary path from the instrumented target binary.\n- target_binary_directory = os.path.dirname(target_binary)\n- uninstrumented_target_binary_directory = (\n- get_uninstrumented_build_directory(target_binary_directory))\n- target_binary_name = os.path.basename(target_binary)\n- uninstrumented_target_binary = os.path.join(\n- uninstrumented_target_binary_directory, target_binary_name)\n-\n- afl_fuzzer.prepare_fuzz_environment(input_corpus)\n-\n- print('[run_fuzzer] Running AFL for QSYM')\n- afl_fuzz_thread = threading.Thread(target=afl_fuzzer.run_afl_fuzz,\n- args=(input_corpus, output_corpus,\n- target_binary, ['-S',\n- 'afl-slave']))\n- afl_fuzz_thread.start()\n-\n- # Wait till AFL initializes (i.e. fuzzer_stats file exists) before\n- # launching QSYM.\n- print('[run_fuzzer] Waiting for AFL to finish initialization')\n- afl_stats_file = os.path.join(output_corpus, 'afl-slave', 'fuzzer_stats')\n- while True:\n- if os.path.exists(afl_stats_file):\n- break\n- time.sleep(5)\n-\n- print('[run_fuzzer] Running QSYM')\n- subprocess.Popen([\n- './qsym/bin/run_qsym_afl.py', '-a', 'afl-slave', '-o', output_corpus,\n- '-n', 'qsym', '--', uninstrumented_target_binary\n- ])\n"
},
{
"change_type": "DELETE",
"old_path": "fuzzers/qsym/runner.Dockerfile",
"new_path": null,
"diff": "-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\n-FROM gcr.io/fuzzbench/base-runner\n-\n-# Install compilers and sudo needed by QSYM's build scripts.\n-RUN apt-get update && apt-get install -y \\\n- git \\\n- build-essential \\\n- sudo\n-\n-# Finally, clone the source for QSYM and build it.\n-# Remove ptrace_scope check in setup.*. This cannot be enabled in Google Cloud\n-# build, but it is enabled at runtime on the bot.\n-RUN git clone https://github.com/sslab-gatech/qsym.git qsym && \\\n- cd qsym && \\\n- git checkout 3fe575cab73e1ccd80ae2605ca08999f7ddbd437 && \\\n- sed -i '3,7d' ./setup.sh && \\\n- sed -i '23,25d' ./setup.py && \\\n- sed -i 's/pytest-xdist//g' setup.py && \\\n- ./setup.sh && \\\n- pip install .\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [QSYM] Remove fuzzer (#130)
As pointed out to us, qsym doesn't work on kernels used in linux
distros newer than Ubuntu 14.0.4 or Centos 7. |
258,388 | 19.03.2020 11:42:20 | 25,200 | 93b0e1a3373bb54a023f6119581794d59a9265e9 | [make] Fix make-$FUZZER-all to build oss-fuzz benchmarks | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".github/workflows/build.py",
"diff": "+#!/usr/bin/env python3\n+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Script for building fuzzer,benchmark pairs in CI.\"\"\"\n+import sys\n+import subprocess\n+\n+# Don't build php benchmark since it fills up disk in GH actions.\n+OSS_FUZZ_BENCHMARKS = [\n+ 'bloaty_fuzz_target',\n+ 'curl_curl_fuzzer_http',\n+ 'irssi_server-fuzz',\n+ 'jsoncpp_jsoncpp_fuzzer',\n+ 'libpcap_fuzz_both',\n+ 'mbedtls_fuzz_dtlsclient',\n+ 'openssl_x509',\n+ 'sqlite3_ossfuzz',\n+ 'systemd_fuzz-link-parser',\n+ 'zlib_zlib_uncompress_fuzzer',\n+]\n+\n+STANDARD_BENCHMARKS = [\n+ 'freetype2-2017',\n+ 'harfbuzz-1.3.2',\n+ 'lcms-2017-03-21',\n+ 'libjpeg-turbo-07-2017',\n+ 'libpng-1.2.56',\n+ 'libxml2-v2.9.2',\n+ 'openthread-2019-12-23',\n+ 'proj4-2017-08-14',\n+ 're2-2014-12-09',\n+ 'vorbis-2017-12-11',\n+ 'woff2-2016-05-06',\n+ 'wpantund-2018-02-27',\n+]\n+\n+\n+def get_make_targets(benchmarks, fuzzer):\n+ \"\"\"Return pull and build targets for |fuzzer| and each benchmark\n+ in |benchmarks| to pass to make.\"\"\"\n+ return [('pull-%s-%s' % (fuzzer, benchmark),\n+ 'build-%s-%s' % (fuzzer, benchmark)) for benchmark in benchmarks]\n+\n+\n+def delete_docker_images():\n+ \"\"\"Delete docker images.\"\"\"\n+ # TODO(metzman): Don't delete base-runner/base-builder so it\n+ # doesn't need to be pulled for every target.\n+ result = subprocess.run(['docker', 'images', '-q'],\n+ stdout=subprocess.PIPE,\n+ check=True)\n+ image_names = result.stdout.splitlines()\n+ subprocess.run(['docker', 'rmi', '-f'] + image_names, check=False)\n+\n+\n+def make_builds(benchmarks, fuzzer):\n+ \"\"\"Use make to build each target in |build_targets|.\"\"\"\n+ make_targets = get_make_targets(benchmarks, fuzzer)\n+ success = True\n+ for pull_target, build_target in make_targets:\n+ # Pull target first.\n+ subprocess.run(['make', '-j', pull_target], check=False)\n+\n+ # Then build.\n+ result = subprocess.run(['make', build_target], check=False)\n+ if not result.returncode == 0:\n+ success = False\n+ # Delete docker images so disk doesn't fill up.\n+ delete_docker_images()\n+ return success\n+\n+\n+def do_build(build_type, fuzzer):\n+ \"\"\"Build fuzzer,benchmark pairs for CI.\"\"\"\n+ if build_type == 'oss-fuzz':\n+ benchmarks = OSS_FUZZ_BENCHMARKS\n+ elif build_type == 'standard':\n+ benchmarks = STANDARD_BENCHMARKS\n+ else:\n+ raise Exception('Invalid build_type: %s' % build_type)\n+\n+ return make_builds(benchmarks, fuzzer)\n+\n+\n+def main():\n+ \"\"\"Build OSS-Fuzz or standard benchmarks with a fuzzer.\"\"\"\n+ if len(sys.argv) != 3:\n+ print('Usage: %s <build_type> <fuzzer>' % sys.argv[0])\n+ return 1\n+ build_type = sys.argv[1]\n+ fuzzer = sys.argv[2]\n+ result = do_build(build_type, fuzzer)\n+ return 0 if result else 1\n+\n+\n+if __name__ == '__main__':\n+ sys.exit(main())\n"
},
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -26,6 +26,10 @@ jobs:\n- libfuzzer\n- mopt\n+ benchmark_type:\n+ - oss-fuzz\n+ - standard\n+\nenv:\nFUZZER_NAME: ${{ matrix.fuzzer }}\n@@ -35,6 +39,15 @@ jobs:\nuses: actions/setup-python@v1.1.1\nwith:\npython-version: 3.7\n- - name: Build benchmarks\n+ - name: Build Benchmarks\n+ if: ${{ matrix.benchmark_type == 'standard' }}\n+ run: |\n+ python .github/workflows/build.py standard $FUZZER_NAME\n+ - name: Setup Python environment\n+ uses: actions/setup-python@v1.1.1\n+ with:\n+ python-version: 3.7\n+ - name: Build OSS-Fuzz Benchmarks\n+ if: ${{ matrix.benchmark_type == 'oss-fuzz' }}\nrun: |\n- make build-$FUZZER_NAME-all\n+ python .github/workflows/build.py oss-fuzz $FUZZER_NAME\n"
},
{
"change_type": "MODIFY",
"old_path": "docker/build.mk",
"new_path": "docker/build.mk",
"diff": "@@ -20,26 +20,45 @@ BASE_TAG := gcr.io/fuzzbench\nbuild-all: $(addsuffix -all, $(addprefix build-,$(FUZZERS)))\n+pull-all: $(addsuffix -all, $(addprefix pull-,$(FUZZERS)))\nbase-image:\ndocker build \\\n--tag $(BASE_TAG)/base-image \\\n+ --cache-from $(BASE_TAG)/base-image \\\ndocker/base-image\n+pull-base-image:\n+ docker pull $(BASE_TAG)/base-image\n+\nbase-builder: base-image\ndocker build \\\n--tag $(BASE_TAG)/base-builder \\\n+ --cache-from $(BASE_TAG)/base-builder \\\n+ --cache-from gcr.io/oss-fuzz-base/base-clang \\\ndocker/base-builder\n+pull-base-clang:\n+ docker pull gcr.io/oss-fuzz-base/base-clang\n+\n+pull-base-builder: pull-base-image pull-base-clang\n+ docker pull $(BASE_TAG)/base-builder\n+\nbase-runner: base-image\ndocker build \\\n--tag $(BASE_TAG)/base-runner \\\n+ --cache-from $(BASE_TAG)/base-runner \\\ndocker/base-runner\n+\n+pull-base-runner: pull-base-image\n+ docker pull $(BASE_TAG)/base-runner\n+\ndispatcher-image: base-image\ndocker build \\\n--tag $(BASE_TAG)/dispatcher-image \\\n+ --cache-from $(BASE_TAG)/dispatcher-image \\\ndocker/dispatcher-image\n@@ -49,9 +68,14 @@ define fuzzer_template\ndocker build \\\n--tag $(BASE_TAG)/builders/$(1) \\\n--file fuzzers/$(1)/builder.Dockerfile \\\n+ --cache-from $(BASE_TAG)/builders/$(1) \\\nfuzzers/$(1)\n-build-$(1)-all: $(addprefix build-$(1)-,$(BENCHMARKS))\n+.pull-$(1)-builder: pull-base-builder\n+ docker pull $(BASE_TAG)/builders/$(1)\n+\n+build-$(1)-all: $(addprefix build-$(1)-,$(BENCHMARKS)) $(addprefix build-$(1)-,$(OSS_FUZZ_PROJECTS))\n+pull-$(1)-all: $(addprefix pull-$(1)-,$(BENCHMARKS)) $(addprefix pull-$(1)-,$(OSS_FUZZ_PROJECTS))\nendef\n@@ -65,25 +89,39 @@ define fuzzer_benchmark_template\n--tag $(BASE_TAG)/builders/$(1)/$(2) \\\n--build-arg fuzzer=$(1) \\\n--build-arg benchmark=$(2) \\\n+ --cache-from $(BASE_TAG)/builders/$(1)/$(2) \\\n--file docker/benchmark-builder/Dockerfile \\\n.\n+.pull-$(1)-$(2)-builder: .pull-$(1)-builder\n+ docker pull $(BASE_TAG)/builders/$(1)/$(2)\n+\n.$(1)-$(2)-intermediate-runner: base-runner\ndocker build \\\n--tag $(BASE_TAG)/runners/$(1)/$(2)-intermediate \\\n--file fuzzers/$(1)/runner.Dockerfile \\\n+ --cache-from $(BASE_TAG)/runners/$(1)/$(2)-intermediate \\\nfuzzers/$(1)\n+.pull-$(1)-$(2)-intermediate-runner: pull-base-runner\n+ docker pull $(BASE_TAG)/runners/$(1)/$(2)-intermediate\n+\n.$(1)-$(2)-runner: .$(1)-$(2)-builder .$(1)-$(2)-intermediate-runner\ndocker build \\\n--tag $(BASE_TAG)/runners/$(1)/$(2) \\\n--build-arg fuzzer=$(1) \\\n--build-arg benchmark=$(2) \\\n+ --cache-from $(BASE_TAG)/runners/$(1)/$(2) \\\n--file docker/benchmark-runner/Dockerfile \\\n.\n+.pull-$(1)-$(2)-runner: .pull-$(1)-$(2)-builder .pull-$(1)-$(2)-intermediate-runner\n+ docker pull $(BASE_TAG)/runners/$(1)/$(2)\n+\nbuild-$(1)-$(2): .$(1)-$(2)-runner\n+pull-$(1)-$(2): .pull-$(1)-$(2)-runner\n+\nrun-$(1)-$(2): .$(1)-$(2)-runner\ndocker run \\\n--cap-add SYS_NICE \\\n@@ -137,32 +175,50 @@ define fuzzer_oss_fuzz_project_template\n--tag $(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name)-intermediate \\\n--file=fuzzers/$(1)/builder.Dockerfile \\\n--build-arg parent_image=gcr.io/fuzzbench/oss-fuzz/$($(2)-project-name)@sha256:$($(2)-oss-fuzz-builder-hash) \\\n+ --cache-from $(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name)-intermediate \\\nfuzzers/$(1)\n+.pull-$(1)-$(2)-oss-fuzz-builder-intermediate:\n+ docker pull $(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name)-intermediate\n+\n.$(1)-$(2)-oss-fuzz-builder: .$(1)-$(2)-oss-fuzz-builder-intermediate\ndocker build \\\n--tag $(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name) \\\n--file=docker/oss-fuzz-builder/Dockerfile \\\n--build-arg parent_image=$(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name)-intermediate \\\n--build-arg fuzzer=$(1) \\\n+ --cache-from $(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name) \\\n.\n+.pull-$(1)-$(2)-oss-fuzz-builder: .pull-$(1)-$(2)-oss-fuzz-builder-intermediate\n+ docker pull $(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name)\n+\n.$(1)-$(2)-oss-fuzz-intermediate-runner: base-runner\ndocker build \\\n--tag $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)-intermediate \\\n--file fuzzers/$(1)/runner.Dockerfile \\\n+ --cache-from $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)-intermediate \\\nfuzzers/$(1)\n+.pull-$(1)-$(2)-oss-fuzz-intermediate-runner: pull-base-runner\n+ docker pull $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)-intermediate\n+\n.$(1)-$(2)-oss-fuzz-runner: .$(1)-$(2)-oss-fuzz-builder .$(1)-$(2)-oss-fuzz-intermediate-runner\ndocker build \\\n--tag $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name) \\\n--build-arg fuzzer=$(1) \\\n--build-arg oss_fuzz_project=$($(2)-project-name) \\\n+ --cache-from $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name) \\\n--file docker/oss-fuzz-runner/Dockerfile \\\n.\n+.pull-$(1)-$(2)-oss-fuzz-runner: .pull-$(1)-$(2)-oss-fuzz-builder .pull-$(1)-$(2)-oss-fuzz-intermediate-runner\n+ docker pull $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)\n+\nbuild-$(1)-$(2): .$(1)-$(2)-oss-fuzz-runner\n+pull-$(1)-$(2): .pull-$(1)-$(2)-oss-fuzz-runner\n+\nrun-$(1)-$(2): .$(1)-$(2)-oss-fuzz-runner\ndocker run \\\n--cap-add SYS_NICE \\\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/honggfuzz/builder.Dockerfile",
"new_path": "fuzzers/honggfuzz/builder.Dockerfile",
"diff": "@@ -16,7 +16,12 @@ ARG parent_image=gcr.io/fuzzbench/base-builder\nFROM $parent_image\n# honggfuzz requires libfd and libunwid.\n-RUN apt-get update -y && apt-get install -y libbfd-dev libunwind-dev libblocksruntime-dev\n+RUN apt-get update -y && \\\n+ apt-get install -y \\\n+ libbfd-dev \\\n+ libunwind-dev \\\n+ libblocksruntime-dev \\\n+ liblzma-dev\n# Download honggfuz version 2.1 + f316276ee58c2339ce8505d58eaf63baa967ed1c\n# Set CFLAGS use honggfuzz's defaults except for -mnative which can build CPU\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [make] Fix make-$FUZZER-all to build oss-fuzz benchmarks (#116) |
258,388 | 19.03.2020 13:29:41 | 25,200 | be046fc290b1ecfe80aabe4eb6b887b60bb772e9 | [aflsmart] Fix issue building aflsmart in OSS-Fuzz
[aflsmart] Fix issues building aflsmart in OSS-Fuzz
OSS-Fuzz benchmarks don't use / as CWD. Be consistent about
using absolute paths for the repo and don't rely on CWD being /.
Also OSS-Fuzz defines CFLAGS, set it to none before using waf to avoid errors. | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflsmart/builder.Dockerfile",
"new_path": "fuzzers/aflsmart/builder.Dockerfile",
"diff": "@@ -37,18 +37,19 @@ RUN add-apt-repository --keyserver hkps://keyserver.ubuntu.com:443 ppa:ubuntu-to\n# Download and compile AFLSmart\nRUN git clone https://github.com/aflsmart/aflsmart /afl && \\\n- cd afl && \\\n+ cd /afl && \\\ngit checkout df095901ea379f033d4d82345023de004f28b9a7 && \\\nAFL_NO_X86=1 make\n-# setup Peach\n+# Setup Peach.\n+# Set CFLAGS=\"\" so that we don't use the CFLAGS defined in OSS-Fuzz images.\nRUN cd /afl && \\\nwget https://sourceforge.net/projects/peachfuzz/files/Peach/3.0/peach-3.0.202-source.zip && \\\nunzip peach-3.0.202-source.zip && \\\npatch -p1 < peach-3.0.202.patch && \\\ncd peach-3.0.202-source && \\\n- CC=gcc-4.4 CXX=g++-4.4 CXXFLAGS=\"-std=c++0x\" ./waf configure && \\\n- CC=gcc-4.4 CXX=g++-4.4 CXXFLAGS=\"-std=c++0x\" ./waf install\n+ CC=gcc-4.4 CXX=g++-4.4 CFLAGS=\"\" CXXFLAGS=\"-std=c++0x\" ./waf configure && \\\n+ CC=gcc-4.4 CXX=g++-4.4 CFLAGS=\"\" CXXFLAGS=\"-std=c++0x\" ./waf install\n# Use afl_driver.cpp from LLVM as our fuzzing library.\nRUN wget https://raw.githubusercontent.com/llvm/llvm-project/5feb80e748924606531ba28c97fe65145c65372e/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /afl/afl_driver.cpp && \\\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [aflsmart] Fix issue building aflsmart in OSS-Fuzz (#117)
[aflsmart] Fix issues building aflsmart in OSS-Fuzz
OSS-Fuzz benchmarks don't use / as CWD. Be consistent about
using absolute paths for the repo and don't rely on CWD being /.
Also OSS-Fuzz defines CFLAGS, set it to none before using waf to avoid errors. |
258,390 | 19.03.2020 22:04:47 | -3,600 | e51bcf45955f77c87e0db7ae89f1669d07b7e886 | [honggfuzz] Update version | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/honggfuzz/builder.Dockerfile",
"new_path": "fuzzers/honggfuzz/builder.Dockerfile",
"diff": "@@ -23,14 +23,14 @@ RUN apt-get update -y && \\\nlibblocksruntime-dev \\\nliblzma-dev\n-# Download honggfuz version 2.1 + f316276ee58c2339ce8505d58eaf63baa967ed1c\n+# Download honggfuz version 2.1 + 539ea048d6273864e396ad95b08911c69cd2ac51\n# Set CFLAGS use honggfuzz's defaults except for -mnative which can build CPU\n# dependent code that may not work on the machines we actually fuzz on.\n# Create an empty object file which will become the FUZZER_LIB lib (since\n# honggfuzz doesn't need this when hfuzz-clang(++) is used).\nRUN git clone https://github.com/google/honggfuzz.git /honggfuzz && \\\ncd /honggfuzz && \\\n- git checkout f316276ee58c2339ce8505d58eaf63baa967ed1c && \\\n+ git checkout 539ea048d6273864e396ad95b08911c69cd2ac51 && \\\nCFLAGS=\"-O3 -funroll-loops\" make && \\\ntouch empty_lib.c && \\\ncc -c -o empty_lib.o empty_lib.c\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [honggfuzz] Update version (#129)
Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> |
258,388 | 19.03.2020 15:01:40 | 25,200 | cabc8a532a2dd1ac860014c04bd6d4d834af6b55 | [CI] Miscellaneous improvements
Improve build script and cleanup workflow config file | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/build.py",
"new_path": ".github/workflows/build.py",
"diff": "@@ -67,18 +67,19 @@ def delete_docker_images():\ndef make_builds(benchmarks, fuzzer):\n\"\"\"Use make to build each target in |build_targets|.\"\"\"\nmake_targets = get_make_targets(benchmarks, fuzzer)\n- success = True\nfor pull_target, build_target in make_targets:\n# Pull target first.\nsubprocess.run(['make', '-j', pull_target], check=False)\n# Then build.\n- result = subprocess.run(['make', build_target], check=False)\n+ print('Building', build_target)\n+ build_command = ['make', '-j', build_target]\n+ result = subprocess.run(build_command, check=False)\nif not result.returncode == 0:\n- success = False\n+ return False\n# Delete docker images so disk doesn't fill up.\ndelete_docker_images()\n- return success\n+ return True\ndef do_build(build_type, fuzzer):\n"
},
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -31,7 +31,8 @@ jobs:\n- standard\nenv:\n- FUZZER_NAME: ${{ matrix.fuzzer }}\n+ FUZZER: ${{ matrix.fuzzer }}\n+ BENCHMARK_TYPE: ${{ matrix.benchmark_type }}\nsteps:\n- uses: actions/checkout@v2\n@@ -40,14 +41,5 @@ jobs:\nwith:\npython-version: 3.7\n- name: Build Benchmarks\n- if: ${{ matrix.benchmark_type == 'standard' }}\nrun: |\n- python .github/workflows/build.py standard $FUZZER_NAME\n- - name: Setup Python environment\n- uses: actions/setup-python@v1.1.1\n- with:\n- python-version: 3.7\n- - name: Build OSS-Fuzz Benchmarks\n- if: ${{ matrix.benchmark_type == 'oss-fuzz' }}\n- run: |\n- python .github/workflows/build.py oss-fuzz $FUZZER_NAME\n+ python .github/workflows/build.py $BENCHMARK_TYPE $FUZZER\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [CI] Miscellaneous improvements (#134)
Improve build script and cleanup workflow config file |
258,388 | 19.03.2020 17:59:02 | 25,200 | 60b67bf72f96658bc54d51a00af888ad6d5df3e7 | [afl] Skip deterministic steps (ie: use -d). | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/afl/fuzzer.py",
"new_path": "fuzzers/afl/fuzzer.py",
"diff": "@@ -83,6 +83,9 @@ def run_afl_fuzz(input_corpus,\ninput_corpus,\n'-o',\noutput_corpus,\n+ # Use deterministic mode as it does best when we don't have\n+ # seeds which is often the case.\n+ '-d',\n# Use no memory limit as ASAN doesn't play nicely with one.\n'-m',\n'none'\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/afl_deterministic/builder.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+ARG parent_image=gcr.io/fuzzbench/base-builder\n+FROM $parent_image\n+\n+# Download and compile AFL v2.56b.\n+# Set AFL_NO_X86 to skip flaky tests.\n+RUN git clone https://github.com/google/AFL.git /afl && \\\n+ cd /afl && \\\n+ git checkout 8da80951dd7eeeb3e3b5a3bcd36c485045f40274 && \\\n+ AFL_NO_X86=1 make\n+\n+# Use afl_driver.cpp from LLVM as our fuzzing library.\n+RUN apt-get update && \\\n+ apt-get install wget -y && \\\n+ wget https://raw.githubusercontent.com/llvm/llvm-project/5feb80e748924606531ba28c97fe65145c65372e/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /afl/afl_driver.cpp && \\\n+ clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -I/afl && \\\n+ clang++ -stdlib=libc++ -std=c++11 -O2 -c /afl/afl_driver.cpp && \\\n+ ar r /libAFL.a *.o\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/afl_deterministic/fuzzer.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Integration code for AFL fuzzer.\"\"\"\n+\n+import subprocess\n+\n+from fuzzers.afl import fuzzer as afl_fuzzer\n+\n+# OUT environment variable is the location of build directory (default is /out).\n+\n+\n+def build():\n+ \"\"\"Build fuzzer.\"\"\"\n+ afl_fuzzer.build()\n+\n+\n+def run_afl_fuzz(input_corpus,\n+ output_corpus,\n+ target_binary,\n+ additional_flags=None,\n+ hide_output=False):\n+ \"\"\"Run afl-fuzz.\"\"\"\n+ # Spawn the afl fuzzing process.\n+ # FIXME: Currently AFL will exit if it encounters a crashing input in seed\n+ # corpus (usually timeouts). Add a way to skip/delete such inputs and\n+ # re-run AFL. This currently happens with a seed in wpantund benchmark.\n+ print('[run_fuzzer] Running target with afl-fuzz')\n+ command = [\n+ './afl-fuzz',\n+ '-i',\n+ input_corpus,\n+ '-o',\n+ output_corpus,\n+ # Use no memory limit as ASAN doesn't play nicely with one.\n+ '-m',\n+ 'none'\n+ ]\n+ if additional_flags:\n+ command.extend(additional_flags)\n+ command += [\n+ '--',\n+ target_binary,\n+ # Pass INT_MAX to afl the maximize the number of persistent loops it\n+ # performs.\n+ '2147483647'\n+ ]\n+ output_stream = subprocess.DEVNULL if hide_output else None\n+ subprocess.call(command, stdout=output_stream, stderr=output_stream)\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run afl-fuzz on target.\"\"\"\n+ afl_fuzzer.prepare_fuzz_environment(input_corpus)\n+\n+ run_afl_fuzz(input_corpus, output_corpus, target_binary)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/afl_deterministic/runner.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+FROM gcr.io/fuzzbench/base-runner\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflplusplus/fuzzer.py",
"new_path": "fuzzers/aflplusplus/fuzzer.py",
"diff": "@@ -112,7 +112,7 @@ def fuzz(input_corpus, output_corpus, target_binary):\nafl_fuzzer.prepare_fuzz_environment(input_corpus)\nos.environ['AFL_PRELOAD'] = '/afl/libdislocator.so'\n- flags = ['-d'] # FidgetyAFL is better when running alone.\n+ flags = []\nif os.path.exists(cmplog_target_binary):\nflags += ['-c', cmplog_target_binary]\nif 'ADDITIONAL_ARGS' in os.environ:\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflplusplus_mopt/fuzzer.py",
"new_path": "fuzzers/aflplusplus_mopt/fuzzer.py",
"diff": "@@ -37,10 +37,9 @@ def fuzz(input_corpus, output_corpus, target_binary):\ntarget_binary_name)\nafl_fuzzer.prepare_fuzz_environment(input_corpus)\n- # os.environ['AFL_PRELOAD'] = '/afl/libdislocator.so'\n- flags = ['-L0'] # afl++ MOpt activation at once\n- flags += ['-pfast'] # fast scheduling\n+ flags = ['-L0'] # afl++ MOpt activation at once.\n+ flags += ['-pfast'] # Fast scheduling.\nif os.path.exists(cmplog_target_binary):\nflags += ['-c', cmplog_target_binary]\nif 'ADDITIONAL_ARGS' in os.environ:\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [afl] Skip deterministic steps (ie: use -d). (#132) |
258,388 | 19.03.2020 18:06:49 | 25,200 | 0982a9f5dfc1dd75be46bda6d0def61e2b21c76e | Dont use ASAN for benchmark builds
We aren't detecting crashes yet so it isn't useful.
Temporarily add libfuzzer w/asan as a fuzzer so we can figure out if ASAN helps libFuzzer performance. | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/afl/fuzzer.py",
"new_path": "fuzzers/afl/fuzzer.py",
"diff": "@@ -24,10 +24,9 @@ from fuzzers import utils\ndef prepare_build_environment():\n\"\"\"Set environment variables used to build AFL-based fuzzers.\"\"\"\n- cflags = [\n- '-O2', '-fno-omit-frame-pointer', '-gline-tables-only',\n- '-fsanitize=address', '-fsanitize-coverage=trace-pc-guard'\n- ]\n+ utils.set_no_sanitizer_compilation_flags()\n+\n+ cflags = ['-O3', '-fsanitize-coverage=trace-pc-guard']\nutils.append_flags('CFLAGS', cflags)\nutils.append_flags('CXXFLAGS', cflags)\n@@ -37,7 +36,7 @@ def prepare_build_environment():\ndef build():\n- \"\"\"Build fuzzer.\"\"\"\n+ \"\"\"Build benchmark.\"\"\"\nprepare_build_environment()\nutils.build_benchmark()\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflfast/fuzzer.py",
"new_path": "fuzzers/aflfast/fuzzer.py",
"diff": "@@ -17,7 +17,7 @@ from fuzzers.afl import fuzzer as afl_fuzzer\ndef build():\n- \"\"\"Build fuzzer.\"\"\"\n+ \"\"\"Build benchmark.\"\"\"\nafl_fuzzer.build()\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflplusplus/fuzzer.py",
"new_path": "fuzzers/aflplusplus/fuzzer.py",
"diff": "@@ -28,7 +28,7 @@ def get_cmplog_build_directory(target_directory):\ndef build():\n- \"\"\"Build fuzzer.\"\"\"\n+ \"\"\"Build benchmark.\"\"\"\n# BUILD_MODES is not already supported by fuzzbench, meanwhile we provide\n# a default configuration.\nbuild_modes = ['instrim', 'laf']\n@@ -36,11 +36,9 @@ def build():\nbuild_modes = os.environ['BUILD_MODES'].split(',')\nutils.set_no_sanitizer_compilation_flags()\n- optimization_cflags = [\n- '-O3',\n- ]\n- utils.append_flags('CFLAGS', optimization_cflags)\n- utils.append_flags('CXXFLAGS', optimization_cflags)\n+ cflags = ['-O3']\n+ utils.append_flags('CFLAGS', cflags)\n+ utils.append_flags('CXXFLAGS', cflags)\nif 'qemu' in build_modes:\nos.environ['CC'] = 'clang'\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflplusplus_mopt/fuzzer.py",
"new_path": "fuzzers/aflplusplus_mopt/fuzzer.py",
"diff": "@@ -22,7 +22,7 @@ from fuzzers.aflplusplus import fuzzer as aflplusplus_fuzzer\ndef build():\n- \"\"\"Build fuzzer.\"\"\"\n+ \"\"\"Build benchmark.\"\"\"\naflplusplus_fuzzer.build()\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflsmart/fuzzer.py",
"new_path": "fuzzers/aflsmart/fuzzer.py",
"diff": "@@ -23,7 +23,7 @@ from fuzzers.afl import fuzzer as afl_fuzzer\ndef build():\n- \"\"\"Build fuzzer.\"\"\"\n+ \"\"\"Build benchmark.\"\"\"\nafl_fuzzer.build()\n# Copy Peach binaries to OUT\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/coverage/fuzzer.py",
"new_path": "fuzzers/coverage/fuzzer.py",
"diff": "@@ -19,12 +19,9 @@ from fuzzers import utils\ndef build():\n- \"\"\"Build fuzzer.\"\"\"\n- cflags = [\n- '-O0',\n- '-fsanitize-coverage=trace-pc-guard',\n- '-fsanitize=address', # For capturing crashes.\n- ]\n+ \"\"\"Build benchmark.\"\"\"\n+ utils.set_no_sanitizer_compilation_flags()\n+ cflags = ['-O3', '-fsanitize-coverage=trace-pc-guard']\nutils.append_flags('CFLAGS', cflags)\nutils.append_flags('CXXFLAGS', cflags)\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/eclipser/fuzzer.py",
"new_path": "fuzzers/eclipser/fuzzer.py",
"diff": "@@ -22,14 +22,11 @@ from fuzzers import utils\ndef build():\n- \"\"\"Build fuzzer.\"\"\"\n+ \"\"\"Build benchmark.\"\"\"\n# QEMU does not work with sanitizers, so skip -fsanitize=. See\n# https://github.com/SoftSec-KAIST/Eclipser/issues/5\nutils.set_no_sanitizer_compilation_flags()\n- cflags = [\n- '-O2',\n- '-fno-omit-frame-pointer',\n- ]\n+ cflags = ['-O3']\nutils.append_flags('CFLAGS', cflags)\nutils.append_flags('CXXFLAGS', cflags)\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/entropic/fuzzer.py",
"new_path": "fuzzers/entropic/fuzzer.py",
"diff": "@@ -22,13 +22,9 @@ from fuzzers.libfuzzer import fuzzer as libfuzzer_fuzzer\ndef build():\n- \"\"\"Build fuzzer.\"\"\"\n- cflags = [\n- '-O2',\n- '-fno-omit-frame-pointer',\n- '-gline-tables-only',\n- '-fsanitize=address,fuzzer-no-link',\n- ]\n+ \"\"\"Build benchmark.\"\"\"\n+ utils.set_no_sanitizer_compilation_flags()\n+ cflags = ['-O3', '-fsanitize=fuzzer-no-link']\nutils.append_flags('CFLAGS', cflags)\nutils.append_flags('CXXFLAGS', cflags)\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/fairfuzz/fuzzer.py",
"new_path": "fuzzers/fairfuzz/fuzzer.py",
"diff": "@@ -17,7 +17,7 @@ from fuzzers.afl import fuzzer as afl_fuzzer\ndef build():\n- \"\"\"Build fuzzer.\"\"\"\n+ \"\"\"Build benchmark.\"\"\"\nafl_fuzzer.build()\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/fastcgs/fuzzer.py",
"new_path": "fuzzers/fastcgs/fuzzer.py",
"diff": "@@ -23,9 +23,10 @@ from fuzzers import utils\ndef build():\n- \"\"\"Build fuzzer.\"\"\"\n- cflags = ['-O3']\n+ \"\"\"Build benchmark.\"\"\"\nutils.set_no_sanitizer_compilation_flags()\n+\n+ cflags = ['-O3']\nutils.append_flags('CFLAGS', cflags)\nutils.append_flags('CXXFLAGS', cflags)\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/honggfuzz/fuzzer.py",
"new_path": "fuzzers/honggfuzz/fuzzer.py",
"diff": "@@ -23,13 +23,10 @@ from fuzzers import utils\ndef build():\n- \"\"\"Build fuzzer.\"\"\"\n- cflags = [\n- '-O2',\n- '-fno-omit-frame-pointer',\n- '-gline-tables-only',\n- '-fsanitize=address',\n- ]\n+ \"\"\"Build benchmark.\"\"\"\n+ utils.set_no_sanitizer_compilation_flags()\n+\n+ cflags = ['-O3']\nutils.append_flags('CFLAGS', cflags)\nutils.append_flags('CXXFLAGS', cflags)\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/libfuzzer/fuzzer.py",
"new_path": "fuzzers/libfuzzer/fuzzer.py",
"diff": "@@ -20,17 +20,12 @@ from fuzzers import utils\ndef build():\n- \"\"\"Build fuzzer.\"\"\"\n+ \"\"\"Build benchmark.\"\"\"\n# With LibFuzzer we use -fsanitize=fuzzer-no-link for build CFLAGS and then\n# /usr/lib/libFuzzer.a as the FUZZER_LIB for the main fuzzing binary. This\n# allows us to link against a version of LibFuzzer that we specify.\n-\n- cflags = [\n- '-O2',\n- '-fno-omit-frame-pointer',\n- '-gline-tables-only',\n- '-fsanitize=address,fuzzer-no-link',\n- ]\n+ utils.set_no_sanitizer_compilation_flags()\n+ cflags = ['-O3', '-fsanitize=fuzzer-no-link']\nutils.append_flags('CFLAGS', cflags)\nutils.append_flags('CXXFLAGS', cflags)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/libfuzzer_asan/builder.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+ARG parent_image=gcr.io/fuzzbench/base-builder\n+FROM $parent_image\n+\n+RUN git clone https://github.com/llvm/llvm-project.git /llvm-project && \\\n+ cd /llvm-project/ && \\\n+ git checkout 6d07802d63a8589447de0a697696447a583de9d8 && \\\n+ cd compiler-rt/lib/fuzzer && \\\n+ (for f in *.cpp; do \\\n+ clang++ -stdlib=libc++ -fPIC -gline-tables-only -O2 -fno-omit-frame-pointer -std=c++11 $f -c & \\\n+ done && wait) && \\\n+ ar r /usr/lib/libFuzzer.a *.o\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/libfuzzer_asan/fuzzer.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Integration code for libFuzzer fuzzer.\"\"\"\n+\n+import os\n+\n+from fuzzers.libfuzzer import fuzzer as libfuzzer_fuzzer\n+from fuzzers import utils\n+\n+\n+def build():\n+ \"\"\"Build benchmark.\"\"\"\n+ # With LibFuzzer we use -fsanitize=fuzzer-no-link for build CFLAGS and then\n+ # /usr/lib/libFuzzer.a as the FUZZER_LIB for the main fuzzing binary. This\n+ # allows us to link against a version of LibFuzzer that we specify.\n+ utils.set_no_sanitizer_compilation_flags()\n+ cflags = ['-O3', '-fsanitize=fuzzer-no-link']\n+ utils.append_flags('CFLAGS', cflags)\n+ utils.append_flags('CXXFLAGS', cflags)\n+\n+ os.environ['CC'] = 'clang'\n+ os.environ['CXX'] = 'clang++'\n+ os.environ['FUZZER_LIB'] = '/usr/lib/libFuzzer.a'\n+\n+ utils.build_benchmark()\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\"\"\"\n+ libfuzzer_fuzzer.fuzz(input_corpus, output_corpus, target_binary)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/libfuzzer_asan/runner.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+FROM gcr.io/fuzzbench/base-runner\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/mopt/fuzzer.py",
"new_path": "fuzzers/mopt/fuzzer.py",
"diff": "@@ -17,7 +17,7 @@ from fuzzers.afl import fuzzer as afl_fuzzer\ndef build():\n- \"\"\"Build fuzzer.\"\"\"\n+ \"\"\"Build benchmark.\"\"\"\nafl_fuzzer.build()\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Dont use ASAN for benchmark builds (#126)
We aren't detecting crashes yet so it isn't useful.
Temporarily add libfuzzer w/asan as a fuzzer so we can figure out if ASAN helps libFuzzer performance. |
258,388 | 20.03.2020 12:03:14 | 25,200 | f30629e30be62a5099c9db24d3be1b5fef1e9819 | [make] Fix $BENCHMARK in OSS-Fuzz benchmarks
Fixes | [
{
"change_type": "MODIFY",
"old_path": "docker/build.mk",
"new_path": "docker/build.mk",
"diff": "@@ -226,7 +226,7 @@ run-$(1)-$(2): .$(1)-$(2)-oss-fuzz-runner\n-e FUZZ_OUTSIDE_EXPERIMENT=1 \\\n-e TRIAL_ID=1 \\\n-e FUZZER=$(1) \\\n- -e BENCHMARK=$($(2)-project-name) \\\n+ -e BENCHMARK=$(2) \\\n-e FUZZ_TARGET=$($(2)-fuzz-target) \\\n-it $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)\n@@ -237,7 +237,7 @@ debug-$(1)-$(2): .$(1)-$(2)-oss-fuzz-runner\n-e FUZZ_OUTSIDE_EXPERIMENT=1 \\\n-e TRIAL_ID=1 \\\n-e FUZZER=$(1) \\\n- -e BENCHMARK=$($(2)-project-name) \\\n+ -e BENCHMARK=$(2) \\\n-e FUZZ_TARGET=$($(2)-fuzz-target) \\\n--entrypoint \"/bin/bash\" \\\n-it $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [make] Fix $BENCHMARK in OSS-Fuzz benchmarks (#139)
Fixes #137 |
258,387 | 23.03.2020 11:26:20 | 14,400 | 12717d8a86ed7010ad93daf690f08c75a84a4da0 | [fastcgs] Changed base fuzzer to original MOpt | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/fastcgs/builder.Dockerfile",
"new_path": "fuzzers/fastcgs/builder.Dockerfile",
"diff": "@@ -23,16 +23,12 @@ RUN apt-get update && \\\n# Build without Python support as we don't need it.\n# Set AFL_NO_X86 to skip flaky tests.\n-RUN rm -rf /afl\n-\n-RUN git clone https://github.com/alifahmed/aflmod /afl && \\\n+RUN rm -rf /afl && git clone https://github.com/alifahmed/aflmod /afl && \\\ncd /afl && \\\n- git checkout b1be4ff2f6f86767e263a27be471220867721ef7 && \\\n- AFL_NO_X86=1 make PYTHON_INCLUDE=/ && \\\n- cd llvm_mode && \\\n- CXXFLAGS= make\n+ git checkout af232ce29db2339e1696675420166daf78c7aefc && \\\n+ AFL_NO_X86=1 make\n# Use afl_driver.cpp from LLVM as our fuzzing library.\n-RUN wget https://raw.githubusercontent.com/llvm/llvm-project/5feb80e748924606531ba28c97fe65145c65372e/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /afl/afl_driver.cpp && \\\n- clang++ -stdlib=libc++ -std=c++11 -O2 -c /afl/afl_driver.cpp && \\\n- ar ru /libAFLDriver.a *.o\n+RUN cd /afl && clang++ -stdlib=libc++ -std=c++11 -O3 -c cgs_driver.cpp && \\\n+ clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -I/afl && \\\n+ ar r /libAFL.a *.o\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/fastcgs/fuzzer.py",
"new_path": "fuzzers/fastcgs/fuzzer.py",
"diff": "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n-\"\"\"Integration code for AFLplusplus fuzzer.\"\"\"\n-\n-import os\n-import shutil\n+\"\"\"Integration code for MOpt fuzzer.\"\"\"\nfrom fuzzers.afl import fuzzer as afl_fuzzer\n-from fuzzers import utils\n-\n-# OUT environment variable is the location of build directory (default is /out).\ndef build():\n\"\"\"Build benchmark.\"\"\"\n- utils.set_no_sanitizer_compilation_flags()\n-\n- cflags = ['-O3']\n- utils.append_flags('CFLAGS', cflags)\n- utils.append_flags('CXXFLAGS', cflags)\n-\n- os.environ['CC'] = '/afl/afl-clang-fast'\n- os.environ['CXX'] = '/afl/afl-clang-fast++'\n- os.environ['FUZZER_LIB'] = '/libAFLDriver.a'\n-\n- # Some benchmarks like lcms\n- # (see: https://github.com/mm2/Little-CMS/commit/ab1093539b4287c233aca6a3cf53b234faceb792#diff-f0e6d05e72548974e852e8e55dffc4ccR212)\n- # fail to compile if the compiler outputs things to stderr in unexpected\n- # cases. Prevent these failures by using AFL_QUIET to stop afl-clang-fast\n- # from writing AFL specific messages to stderr.\n- os.environ['AFL_QUIET'] = '1'\n-\n- utils.build_benchmark()\n- shutil.copy('/afl/afl-fuzz', os.environ['OUT'])\n+ afl_fuzzer.build()\ndef fuzz(input_corpus, output_corpus, target_binary):\n@@ -54,14 +30,8 @@ def fuzz(input_corpus, output_corpus, target_binary):\noutput_corpus,\ntarget_binary,\nadditional_flags=[\n- # Enable AFLFast's power schedules with default exponential\n- # schedule.\n- '-p',\n- 'fast',\n# Enable Mopt mutator with pacemaker fuzzing mode at first. This\n# is also recommended in a short-time scale evaluation.\n'-L',\n'0',\n- # Skip deterministic fuzzing steps\n- '-d'\n])\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [fastcgs] Changed base fuzzer to original MOpt (#141) |
258,390 | 23.03.2020 17:14:43 | -3,600 | 39cdad29e6e4903c11bc8a7a1012b443406df206 | Update honggfuzz
This version adds splicing
(https://github.com/google/honggfuzz/commit/150cbd741c7346571e5a9c47b7819d2e37500a64)
which rather significantly improves coverage in some tests (e.g. in
sqlite3) | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/honggfuzz/builder.Dockerfile",
"new_path": "fuzzers/honggfuzz/builder.Dockerfile",
"diff": "@@ -23,14 +23,14 @@ RUN apt-get update -y && \\\nlibblocksruntime-dev \\\nliblzma-dev\n-# Download honggfuz version 2.1 + 539ea048d6273864e396ad95b08911c69cd2ac51\n+# Download honggfuz version 2.1 + 8c0808190bd10ae63b26853ca8ef29e5e17736fe\n# Set CFLAGS use honggfuzz's defaults except for -mnative which can build CPU\n# dependent code that may not work on the machines we actually fuzz on.\n# Create an empty object file which will become the FUZZER_LIB lib (since\n# honggfuzz doesn't need this when hfuzz-clang(++) is used).\nRUN git clone https://github.com/google/honggfuzz.git /honggfuzz && \\\ncd /honggfuzz && \\\n- git checkout 539ea048d6273864e396ad95b08911c69cd2ac51 && \\\n+ git checkout 8c0808190bd10ae63b26853ca8ef29e5e17736fe && \\\nCFLAGS=\"-O3 -funroll-loops\" make && \\\ntouch empty_lib.c && \\\ncc -c -o empty_lib.o empty_lib.c\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Update honggfuzz (#140)
This version adds splicing
(https://github.com/google/honggfuzz/commit/150cbd741c7346571e5a9c47b7819d2e37500a64)
which rather significantly improves coverage in some tests (e.g. in
sqlite3) |
258,390 | 23.03.2020 21:23:18 | -3,600 | 25c597bef489abb30279e367ac52bb7a19ad3e89 | Update honggfuzz (previous update performs badly under KVM).
Previous update performs
not-so-well under GCE/KVM, because of extensive bus locking (use of
atomics).
Sorry for so quick pace of updates, but I've just tested it under KVM.
On my desktop PC it performed well enough. | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/honggfuzz/builder.Dockerfile",
"new_path": "fuzzers/honggfuzz/builder.Dockerfile",
"diff": "@@ -23,14 +23,14 @@ RUN apt-get update -y && \\\nlibblocksruntime-dev \\\nliblzma-dev\n-# Download honggfuz version 2.1 + 8c0808190bd10ae63b26853ca8ef29e5e17736fe\n+# Download honggfuz version 2.1 + 5a40d002370fdb26aeb2156bd062bae697ce925f\n# Set CFLAGS use honggfuzz's defaults except for -mnative which can build CPU\n# dependent code that may not work on the machines we actually fuzz on.\n# Create an empty object file which will become the FUZZER_LIB lib (since\n# honggfuzz doesn't need this when hfuzz-clang(++) is used).\nRUN git clone https://github.com/google/honggfuzz.git /honggfuzz && \\\ncd /honggfuzz && \\\n- git checkout 8c0808190bd10ae63b26853ca8ef29e5e17736fe && \\\n+ git checkout 5a40d002370fdb26aeb2156bd062bae697ce925f && \\\nCFLAGS=\"-O3 -funroll-loops\" make && \\\ntouch empty_lib.c && \\\ncc -c -o empty_lib.o empty_lib.c\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Update honggfuzz (previous update performs badly under KVM). (#143)
Previous update https://github.com/google/fuzzbench/pull/140 performs
not-so-well under GCE/KVM, because of extensive bus locking (use of
atomics).
Sorry for so quick pace of updates, but I've just tested it under KVM.
On my desktop PC it performed well enough. |
258,388 | 25.03.2020 09:18:36 | 25,200 | 179625c54e47d5b6e8807e91d1179150a36d50e2 | [analysis] Drop "id" column from experiment data
It is the same as trial_id so it just takes up space.
Fixes | [
{
"change_type": "MODIFY",
"old_path": "analysis/queries.py",
"new_path": "analysis/queries.py",
"diff": "@@ -26,4 +26,8 @@ def get_experiment_data(experiment_names):\nsqlalchemy.orm.joinedload('trial')).filter(\nmodels.Snapshot.trial.has(\nmodels.Trial.experiment.in_(experiment_names)))\n- return pd.read_sql_query(snapshots_query.statement, db_utils.engine)\n+\n+ # id must be loaded to do the join but get rid of it now since\n+ # trial_id provides the same info.\n+ data = pd.read_sql_query(snapshots_query.statement, db_utils.engine)\n+ return data.drop(columns=['id'])\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [analysis] Drop "id" column from experiment data (#148)
It is the same as trial_id so it just takes up space.
Fixes #133 |
258,390 | 26.03.2020 17:02:49 | -3,600 | a87013c69d47ab040d0e54fff84408a8f8403e37 | [honggfuzz]: update version
Another bunch of improvements and speed-ups which were actually
made possible b/c fuzzbench provides very solid perf data :) | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/honggfuzz/builder.Dockerfile",
"new_path": "fuzzers/honggfuzz/builder.Dockerfile",
"diff": "@@ -23,14 +23,14 @@ RUN apt-get update -y && \\\nlibblocksruntime-dev \\\nliblzma-dev\n-# Download honggfuz version 2.1 + 5a40d002370fdb26aeb2156bd062bae697ce925f\n+# Download honggfuz version 2.1 + 274f2f149237e412fb39cea407f0b19555cb6a35\n# Set CFLAGS use honggfuzz's defaults except for -mnative which can build CPU\n# dependent code that may not work on the machines we actually fuzz on.\n# Create an empty object file which will become the FUZZER_LIB lib (since\n# honggfuzz doesn't need this when hfuzz-clang(++) is used).\nRUN git clone https://github.com/google/honggfuzz.git /honggfuzz && \\\ncd /honggfuzz && \\\n- git checkout 5a40d002370fdb26aeb2156bd062bae697ce925f && \\\n+ git checkout 274f2f149237e412fb39cea407f0b19555cb6a35 && \\\nCFLAGS=\"-O3 -funroll-loops\" make && \\\ntouch empty_lib.c && \\\ncc -c -o empty_lib.o empty_lib.c\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [honggfuzz]: update version (#157)
Another bunch of improvements and speed-ups which were actually
made possible b/c fuzzbench provides very solid perf data :) |
258,387 | 26.03.2020 14:06:08 | 14,400 | e4624bcacbe369a295ea6733ede4e39cce66df10 | [fastcgs] Update commit | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/fastcgs/builder.Dockerfile",
"new_path": "fuzzers/fastcgs/builder.Dockerfile",
"diff": "@@ -25,10 +25,10 @@ RUN apt-get update && \\\nRUN rm -rf /afl && git clone https://github.com/alifahmed/aflmod /afl && \\\ncd /afl && \\\n- git checkout af232ce29db2339e1696675420166daf78c7aefc && \\\n+ git checkout 2fa372ae2c638a557b253162350a6761bdd91278 && \\\nAFL_NO_X86=1 make\n# Use afl_driver.cpp from LLVM as our fuzzing library.\nRUN cd /afl && clang++ -stdlib=libc++ -std=c++11 -O3 -c cgs_driver.cpp && \\\n- clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -I/afl && \\\n+ clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -O3 -I/afl && \\\nar r /libAFL.a *.o\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [fastcgs] Update commit (#154) |
258,388 | 26.03.2020 12:10:06 | 25,200 | dc57fc4d016d189f541f4c62d8f05f223b8465c2 | Add reference doc on benchmarks
Add reference doc on benchmarks providing info on each benchmark (such as size, edges, dictionary, seed corpus size) in table form. | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "docs/reference/benchmarks.md",
"diff": "+---\n+layout: default\n+title: Benchmarks\n+nav_order: 4\n+permalink: /reference/benchmarks/\n+parent: Reference\n+---\n+\n+This page describes each benchmark that is part of fuzzbench.\n+\n+The table below was generated using benchmarks.py.\n+\n+| Benchmark | Fuzz target | Has dictionary? | Number of seed inputs | Number of progam edges\\* | Binary Size (MB)\\*\\* |\n+|:---------------------------:|:----------------------:|:---------------:|:---------------------:|:------------------------:|:--------------------:|\n+| bloaty_fuzz_target | fuzz_target | False | 94 | 89530 | 43.74 |\n+| curl_curl_fuzzer_http | curl_fuzzer_http | False | 31 | 62523 | 20.11 |\n+| freetype2-2017 | fuzz-target | False | 2 | 19056 | 6.76 |\n+| harfbuzz-1.3.2 | fuzz-target | False | 58 | 10021 | 6.24 |\n+| irssi_server-fuzz | server-fuzz | True | 895 | 37455 | 15.3 |\n+| jsoncpp_jsoncpp_fuzzer | jsoncpp_fuzzer | True | 0 | 5536 | 5.96 |\n+| lcms-2017-03-21 | fuzz-target | False | 1 | 6959 | 6.11 |\n+| libjpeg-turbo-07-2017 | fuzz-target | False | 1 | 9586 | 6.4 |\n+| libpcap_fuzz_both | fuzz_both | False | 0 | 8149 | 6.14 |\n+| libpng-1.2.56 | fuzz-target | False | 1 | 2991 | 5.8 |\n+| libxml2-v2.9.2 | fuzz-target | False | 0 | 50461 | 8.23 |\n+| mbedtls_fuzz_dtlsclient | fuzz_dtlsclient | False | 1 | 10942 | 6.67 |\n+| openssl_x509 | x509 | True | 2241 | 45989 | 18.14 |\n+| openthread-2019-12-23 | fuzz-target | False | 0 | 17932 | 6.72 |\n+| php_php-fuzz-parser | php-fuzz-parser | True | 2782 | 123767 | 15.57 |\n+| proj4-2017-08-14 | fuzz-target | False | 44 | 6156 | 6.17 |\n+| re2-2014-12-09 | fuzz-target | False | 0 | 6547 | 6.02 |\n+| sqlite3_ossfuzz | ossfuzz | True | 1258 | 45136 | 7.9 |\n+| systemd_fuzz-link-parser | fuzz-link-parser | False | 6 | 53453 | 5.91 |\n+| vorbis-2017-12-11 | fuzz-target | False | 1 | 5022 | 6.0 |\n+| woff2-2016-05-06 | fuzz-target | False | 62 | 10923 | 6.72 |\n+| wpantund-2018-02-27 | fuzz-target | False | 8 | 28888 | 7.35 |\n+| zlib_zlib_uncompress_fuzzer | zlib_uncompress_fuzzer | False | 0 | 875 | 5.69 |\n+\n+\\*Number of program edges is the number of\n+[\"guards\"](https://clang.llvm.org/docs/SanitizerCoverage.html#id2) in the\n+libFuzzer build of the target.\n+\\*\\*Size is determined by the size of the libFuzzer build of the target.\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "docs/reference/benchmarks.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Code for generating the table in benchmarks.md.\"\"\"\n+\n+import collections\n+import multiprocessing\n+import os\n+from pathlib import Path\n+import re\n+import subprocess\n+import sys\n+import tarfile\n+import zipfile\n+\n+from common import benchmark_utils\n+from common import filesystem\n+from common import fuzzer_utils as common_fuzzer_utils\n+from common import oss_fuzz\n+from common import utils\n+from fuzzers import utils as fuzzer_utils\n+\n+BUILD_ARCHIVE_EXTENSION = '.tar.gz'\n+COVERAGE_BUILD_PREFIX = 'coverage-build-'\n+LEN_COVERAGE_BUILD_PREFIX = len(COVERAGE_BUILD_PREFIX)\n+\n+GUARDS_REGEX = re.compile(rb'INFO:.*\\((?P<num_guards>\\d+) guards\\).*')\n+\n+ONE_MB = 1024**2\n+\n+BENCHMARK_INFO_FIELDS = ['benchmark', 'target', 'dict', 'seeds', 'guards', 'MB']\n+BenchmarkInfo = collections.namedtuple('BenchmarkInfo', BENCHMARK_INFO_FIELDS)\n+\n+\n+def get_benchmark_infos(builds_dir):\n+ \"\"\"Get BenchmarkInfo for each benchmark that has a build in\n+ builds_dir.\"\"\"\n+ build_paths = [\n+ os.path.join(builds_dir, path)\n+ for path in os.listdir(builds_dir)\n+ if path.endswith(BUILD_ARCHIVE_EXTENSION)\n+ ]\n+ pool = multiprocessing.Pool()\n+ return pool.map(get_benchmark_info, build_paths)\n+\n+\n+def get_real_benchmark_name(benchmark):\n+ \"\"\"The method we use to infer benchmark names from coverage builds\n+ doesn't quite work because the project name is used in OSS-Fuzz\n+ builds instead. This function figures out the actual benchmark based on\n+ the project name.\"\"\"\n+ benchmarks_dir = os.path.join(utils.ROOT_DIR, 'benchmarks')\n+ real_benchmarks = os.listdir(benchmarks_dir)\n+ if benchmark in real_benchmarks:\n+ return benchmark\n+\n+ for real_benchmark in real_benchmarks:\n+ if not os.path.isdir(os.path.join(benchmarks_dir, real_benchmark)):\n+ continue\n+\n+ if not benchmark_utils.is_oss_fuzz(real_benchmark):\n+ continue\n+\n+ config = oss_fuzz.get_config(real_benchmark)\n+ if config['project'] == benchmark:\n+ return real_benchmark\n+\n+ return None\n+\n+\n+def count_oss_fuzz_seeds(fuzz_target_path):\n+ \"\"\"Count the number of seeds in the OSS-Fuzz seed archive for\n+ |fuzze_target_path|.\"\"\"\n+ zip_file_name = fuzz_target_path + '_seed_corpus.zip'\n+ if not os.path.exists(zip_file_name):\n+ return 0\n+\n+ with zipfile.ZipFile(zip_file_name) as zip_file:\n+ return len([\n+ filename for filename in zip_file.namelist()\n+ if not filename.endswith('/')\n+ ])\n+\n+\n+def count_standard_seeds(seeds_dir):\n+ \"\"\"Count the number of seeds for a standard benchmark.\"\"\"\n+ return len([p for p in Path(seeds_dir).glob('**/*') if p.is_file()])\n+\n+\n+def get_seed_count(benchmark_path, fuzz_target_path):\n+ \"\"\"Count the number of seeds for a benchmark.\"\"\"\n+ standard_seeds_dir = os.path.join(benchmark_path, 'seeds')\n+ if os.path.exists(standard_seeds_dir):\n+ return count_standard_seeds(standard_seeds_dir)\n+ return count_oss_fuzz_seeds(fuzz_target_path)\n+\n+\n+def get_num_guards(fuzz_target_path):\n+ \"\"\"Returns the number of guards in |fuzz_target_path|.\"\"\"\n+ result = subprocess.run([fuzz_target_path, '-runs=0'],\n+ stdout=subprocess.PIPE,\n+ stderr=subprocess.STDOUT,\n+ check=True)\n+ output = result.stdout\n+ match = GUARDS_REGEX.search(output)\n+ assert match, 'Couldn\\'t determine guards for ' + fuzz_target_path\n+ return int(match.groupdict()['num_guards'])\n+\n+\n+def get_binary_size_mb(fuzz_target_path):\n+ \"\"\"Returns the size of |fuzz_target_path| in MB, rounded to two\n+ decimal places.\"\"\"\n+ size = os.path.getsize(fuzz_target_path)\n+ return round(size / ONE_MB, 2)\n+\n+\n+def get_fuzz_target(benchmark, benchmark_path):\n+ \"\"\"Returns the fuzz target and its path for |benchmark|.\"\"\"\n+ if benchmark_utils.is_oss_fuzz(benchmark):\n+ fuzz_target = oss_fuzz.get_config(benchmark)['fuzz_target']\n+ else:\n+ fuzz_target = common_fuzzer_utils.DEFAULT_FUZZ_TARGET_NAME\n+\n+ fuzz_target_path = common_fuzzer_utils.get_fuzz_target_binary(\n+ benchmark_path, fuzz_target)\n+ assert fuzz_target_path, 'Couldn\\'t find fuzz target for ' + benchmark\n+\n+ return fuzz_target, fuzz_target_path\n+\n+\n+def get_benchmark_info(build_path):\n+ \"\"\"Get BenchmarkInfo for the benchmark in |build_path|.\"\"\"\n+ basename = os.path.basename(build_path)\n+ benchmark = basename[len(COVERAGE_BUILD_PREFIX\n+ ):-len(BUILD_ARCHIVE_EXTENSION)]\n+ benchmark = get_real_benchmark_name(benchmark)\n+ parent_dir = os.path.dirname(build_path)\n+ benchmark_path = os.path.join(parent_dir, benchmark)\n+\n+ filesystem.create_directory(benchmark_path)\n+\n+ with tarfile.open(build_path) as tar_file:\n+ tar_file.extractall(benchmark_path)\n+\n+ fuzz_target, fuzz_target_path = get_fuzz_target(benchmark, benchmark_path)\n+ has_dictionary = bool(fuzzer_utils.get_dictionary_path(fuzz_target_path))\n+\n+ seeds = get_seed_count(benchmark_path, fuzz_target_path)\n+ num_guards = get_num_guards(fuzz_target_path)\n+ size = get_binary_size_mb(fuzz_target_path)\n+ return BenchmarkInfo(benchmark, fuzz_target, has_dictionary, seeds,\n+ num_guards, size)\n+\n+\n+def infos_to_markdown_table(benchmark_infos):\n+ \"\"\"Conver a list of BenchmarkInfos into a markdown table and\n+ return the result.\"\"\"\n+ markdown = ''\n+ for benchmark_info in sorted(benchmark_infos,\n+ key=lambda info: info.benchmark):\n+ markdown += '|{}|{}|{}|{}|{}|{}|\\n'.format(*benchmark_info)\n+ return markdown\n+\n+\n+def main():\n+ \"\"\"Print a markdown table with important data on each\n+ benchmark.\"\"\"\n+ if len(sys.argv) != 2:\n+ print('Usage {} <coverage_builds_directory>'.format(sys.argv[0]))\n+ return 1\n+ coverage_builds_dir = sys.argv[1]\n+ infos = get_benchmark_infos(coverage_builds_dir)\n+ print(infos_to_markdown_table(infos))\n+ print(BENCHMARK_INFO_FIELDS)\n+ return 0\n+\n+\n+if __name__ == '__main__':\n+ sys.exit(main())\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/reference/useful_links.md",
"new_path": "docs/reference/useful_links.md",
"diff": "---\nlayout: default\ntitle: Useful links\n-nav_order: 4\n+nav_order: 5\npermalink: /reference/useful-links/\nparent: Reference\n---\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Add reference doc on benchmarks (#155)
Add reference doc on benchmarks providing info on each benchmark (such as size, edges, dictionary, seed corpus size) in table form. |
258,383 | 26.03.2020 19:29:01 | 25,200 | ff4fe76120ad17f79b22f1b118bb743bd001cd77 | rename file .c to .cc since we are using the CXX compiler in build.sh | [
{
"change_type": "MODIFY",
"old_path": "benchmarks/lcms-2017-03-21/build.sh",
"new_path": "benchmarks/lcms-2017-03-21/build.sh",
"diff": "@@ -24,5 +24,5 @@ build_lib() {\nget_git_revision https://github.com/mm2/Little-CMS.git f9d75ccef0b54c9f4167d95088d4727985133c52 SRC\nbuild_lib\n-$CXX $CXXFLAGS ${SCRIPT_DIR}/cms_transform_fuzzer.c -I BUILD/include/ BUILD/src/.libs/liblcms2.a $FUZZER_LIB -o $FUZZ_TARGET\n+$CXX $CXXFLAGS ${SCRIPT_DIR}/cms_transform_fuzzer.cc -I BUILD/include/ BUILD/src/.libs/liblcms2.a $FUZZER_LIB -o $FUZZ_TARGET\ncp -r $SCRIPT_DIR/seeds $OUT/\n"
},
{
"change_type": "RENAME",
"old_path": "benchmarks/lcms-2017-03-21/cms_transform_fuzzer.c",
"new_path": "benchmarks/lcms-2017-03-21/cms_transform_fuzzer.cc",
"diff": ""
}
] | Python | Apache License 2.0 | google/fuzzbench | rename file .c to .cc since we are using the CXX compiler in build.sh (#170) |
258,383 | 26.03.2020 19:29:58 | 25,200 | 87ec75dce13f5aade95cb1cf9c5c862dbc04bc74 | [docs] give the command to run the fuzzer manually to debug it | [
{
"change_type": "MODIFY",
"old_path": "docs/getting-started/adding_a_new_fuzzer.md",
"new_path": "docs/getting-started/adding_a_new_fuzzer.md",
"diff": "@@ -247,6 +247,8 @@ make build-$FUZZER_NAME-all\n```shell\nmake debug-$FUZZER_NAME-$BENCHMARK_NAME\n+\n+ $ROOT_DIR/docker/benchmark-runner/startup-runner.sh\n```\n* Or, debug an existing fuzzer run in the `make run-*` docker container:\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [docs] give the command to run the fuzzer manually to debug it (#169) |
258,388 | 27.03.2020 13:22:39 | 25,200 | dbccb1052b654ab4268faffc1676d5628dce876a | [docs] Add reference/experiment_data.md
Add reference/experiment_data.md
Add reference/experiment_data.md a document on how to get the raw
data from experiments. | [
{
"change_type": "MODIFY",
"old_path": "docs/reference/benchmarks.md",
"new_path": "docs/reference/benchmarks.md",
"diff": "@@ -6,6 +6,8 @@ permalink: /reference/benchmarks/\nparent: Reference\n---\n+# Benchmarks\n+\nThis page describes each benchmark that is part of fuzzbench.\nThe table below was generated using benchmarks.py.\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/reference/useful_links.md",
"new_path": "docs/reference/useful_links.md",
"diff": "---\nlayout: default\ntitle: Useful links\n-nav_order: 5\n+nav_order: 6\npermalink: /reference/useful-links/\nparent: Reference\n---\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [docs] Add reference/experiment_data.md (#175)
Add reference/experiment_data.md
Add reference/experiment_data.md a document on how to get the raw
data from experiments. |
258,390 | 30.03.2020 17:23:30 | -7,200 | 7cfcb4c874f68e5668edb3941b4aefd57d28876c | [honggfuzz]: update to a newer version
A bigger change is that honggfuzz switched by-default from pc-guards to
8bit inline maps offered by libfuzzer's -fsanitize=fuzzer-no-link | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/honggfuzz/builder.Dockerfile",
"new_path": "fuzzers/honggfuzz/builder.Dockerfile",
"diff": "@@ -23,14 +23,14 @@ RUN apt-get update -y && \\\nlibblocksruntime-dev \\\nliblzma-dev\n-# Download honggfuz version 2.1 + 274f2f149237e412fb39cea407f0b19555cb6a35\n+# Download honggfuz version 2.1 + 4ff004700c3da264a2e8a867af1d97ed1d93ebd0\n# Set CFLAGS use honggfuzz's defaults except for -mnative which can build CPU\n# dependent code that may not work on the machines we actually fuzz on.\n# Create an empty object file which will become the FUZZER_LIB lib (since\n# honggfuzz doesn't need this when hfuzz-clang(++) is used).\nRUN git clone https://github.com/google/honggfuzz.git /honggfuzz && \\\ncd /honggfuzz && \\\n- git checkout 274f2f149237e412fb39cea407f0b19555cb6a35 && \\\n+ git checkout 4ff004700c3da264a2e8a867af1d97ed1d93ebd0 && \\\nCFLAGS=\"-O3 -funroll-loops\" make && \\\ntouch empty_lib.c && \\\ncc -c -o empty_lib.o empty_lib.c\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [honggfuzz]: update to a newer version (#185)
A bigger change is that honggfuzz switched by-default from pc-guards to
8bit inline maps offered by libfuzzer's -fsanitize=fuzzer-no-link |
258,388 | 31.03.2020 09:50:29 | 25,200 | b1cdf858b55b96a5c9a6185b48e167e8358f13b9 | [lafintel] Integrate fuzzer | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -24,6 +24,7 @@ jobs:\n- fairfuzz\n- fastcgs\n- honggfuzz\n+ - lafintel\n- libfuzzer\n- mopt\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/afl/fuzzer.py",
"new_path": "fuzzers/afl/fuzzer.py",
"diff": "@@ -23,7 +23,8 @@ from fuzzers import utils\ndef prepare_build_environment():\n- \"\"\"Set environment variables used to build AFL-based fuzzers.\"\"\"\n+ \"\"\"Set environment variables used to build targets for AFL-based\n+ fuzzers.\"\"\"\ncflags = ['-fsanitize-coverage=trace-pc-guard']\nutils.append_flags('CFLAGS', cflags)\nutils.append_flags('CXXFLAGS', cflags)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/lafintel/builder.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+ARG parent_image=gcr.io/fuzzbench/base-builder\n+FROM $parent_image\n+\n+# Need Clang/LLVM 3.8.\n+RUN apt-get update -y && \\\n+ apt-get -y install llvm-3.8 \\\n+ clang-3.8 \\\n+ libstdc++-5-dev \\\n+ wget\n+\n+# Download AFL and compile using default compiler.\n+# We need afl-2.26b\n+RUN wget https://lcamtuf.coredump.cx/afl/releases/afl-2.26b.tgz -O /afl-2.26b.tgz && \\\n+ tar xvzf /afl-2.26b.tgz -C / && \\\n+ mv /afl-2.26b /afl && \\\n+ cd /afl && \\\n+ AFL_NO_X86=1 make\n+\n+# Set the env variables for LLVM passes and test units.\n+ENV CC=clang-3.8\n+ENV CXX=clang++-3.8\n+ENV LLVM_CONFIG=llvm-config-3.8\n+\n+# Build the LLVM passes with the LAF-INTEL patches, using Clang 3.8.\n+RUN cd /afl/llvm_mode && \\\n+ wget https://gitlab.com/laf-intel/laf-llvm-pass/raw/master/src/afl.patch && \\\n+ patch -p0 < afl.patch && \\\n+ wget https://gitlab.com/laf-intel/laf-llvm-pass/raw/master/src/compare-transform-pass.so.cc && \\\n+ wget https://gitlab.com/laf-intel/laf-llvm-pass/raw/master/src/split-compares-pass.so.cc && \\\n+ wget https://gitlab.com/laf-intel/laf-llvm-pass/raw/master/src/split-switches-pass.so.cc && \\\n+ sed -i 's/errs()/outs()/g' split-switches-pass.so.cc && \\\n+ sed -i 's/errs()/outs()/g' split-compares-pass.so.cc && \\\n+ sed -i 's/errs()/outs()/g' compare-transform-pass.so.cc && \\\n+ CXXFLAGS= CFLAGS= make\n+\n+# Use afl_driver.cpp from LLVM as our fuzzing library.\n+RUN wget https://raw.githubusercontent.com/llvm/llvm-project/master/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /afl/afl_driver.cpp && \\\n+ $CXX -I/usr/local/include/c++/v1/ -stdlib=libc++ -std=c++11 -O2 -c /afl/afl_driver.cpp && \\\n+ ar r /libAFL.a *.o\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/lafintel/fuzzer.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Integration code for AFL fuzzer.\"\"\"\n+\n+import shutil\n+import os\n+\n+from fuzzers import utils\n+\n+from fuzzers.afl import fuzzer as afl_fuzzer\n+\n+\n+def prepare_build_environment():\n+ \"\"\"Set environment variables used to build benchmark.\"\"\"\n+ utils.set_no_sanitizer_compilation_flags()\n+\n+ # In php benchmark, there is a call to __builtin_cpu_supports(\"ssse3\")\n+ # (see https://github.com/php/php-src/blob/master/Zend/zend_cpuinfo.h).\n+ # It is not supported by clang-3.8, so we define the MACRO below\n+ # to replace any __builtin_cpu_supports() with 0, i.e., not supported\n+ cflags = ['-O3', '-fPIC', '-D__builtin_cpu_supports\\\\(x\\\\)=0']\n+ cppflags = cflags + ['-I/usr/local/include/c++/v1/', '-std=c++11']\n+ utils.append_flags('CFLAGS', cflags)\n+ utils.append_flags('CXXFLAGS', cppflags)\n+\n+ # Enable LAF-INTEL changes\n+ os.environ['LAF_SPLIT_SWITCHES'] = '1'\n+ os.environ['LAF_TRANSFORM_COMPARES'] = '1'\n+ os.environ['LAF_SPLIT_COMPARES'] = '1'\n+ os.environ['AFL_CC'] = 'clang-3.8'\n+ os.environ['AFL_CXX'] = 'clang++-3.8'\n+\n+ os.environ['CC'] = '/afl/afl-clang-fast'\n+ os.environ['CXX'] = '/afl/afl-clang-fast++'\n+ os.environ['FUZZER_LIB'] = '/libAFL.a'\n+\n+\n+def build():\n+ \"\"\"Build benchmark.\"\"\"\n+ prepare_build_environment()\n+\n+ utils.build_benchmark()\n+\n+ print('[post_build] Copying afl-fuzz to $OUT directory')\n+ # Copy out the afl-fuzz binary as a build artifact.\n+ shutil.copy('/afl/afl-fuzz', os.environ['OUT'])\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\"\"\"\n+ afl_fuzzer.fuzz(input_corpus, output_corpus, target_binary)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/lafintel/runner.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+FROM gcr.io/fuzzbench/base-runner\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [lafintel] Integrate fuzzer (#150)
Co-authored-by: Laurent Simon |
258,390 | 31.03.2020 19:06:52 | -7,200 | 577569a110af613256441b77bb032d917044f1f0 | Update honggfuzz
In
I identified a problem which cause honggfuzz benchmarks to achieve lower
numbers of PC-guards in some tests (e.g. in jsoncpp_fuzzer). This was
arbitrary use of -fno-inline. The master branch now removed the problem,
and I'd like to test that on fuzzbench. | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/honggfuzz/builder.Dockerfile",
"new_path": "fuzzers/honggfuzz/builder.Dockerfile",
"diff": "@@ -23,14 +23,14 @@ RUN apt-get update -y && \\\nlibblocksruntime-dev \\\nliblzma-dev\n-# Download honggfuz version 2.1 + 4ff004700c3da264a2e8a867af1d97ed1d93ebd0\n+# Download honggfuz version 2.1 + 7c34b297d365d1f9fbfc230db7504c8aca384608\n# Set CFLAGS use honggfuzz's defaults except for -mnative which can build CPU\n# dependent code that may not work on the machines we actually fuzz on.\n# Create an empty object file which will become the FUZZER_LIB lib (since\n# honggfuzz doesn't need this when hfuzz-clang(++) is used).\nRUN git clone https://github.com/google/honggfuzz.git /honggfuzz && \\\ncd /honggfuzz && \\\n- git checkout 4ff004700c3da264a2e8a867af1d97ed1d93ebd0 && \\\n+ git checkout 7c34b297d365d1f9fbfc230db7504c8aca384608 && \\\nCFLAGS=\"-O3 -funroll-loops\" make && \\\ntouch empty_lib.c && \\\ncc -c -o empty_lib.o empty_lib.c\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Update honggfuzz (#190)
In
https://github.com/google/honggfuzz/commit/0f3001e5b5407ae094781406361182ae151afdde
I identified a problem which cause honggfuzz benchmarks to achieve lower
numbers of PC-guards in some tests (e.g. in jsoncpp_fuzzer). This was
arbitrary use of -fno-inline. The master branch now removed the problem,
and I'd like to test that on fuzzbench. |
258,390 | 06.04.2020 18:30:28 | -7,200 | 7b1e79e3f0fb9fb41c821b37f48187e445df6334 | [honggfuzz] version update
New day, new code updates - they improve coverage in some benchmarks | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/honggfuzz/builder.Dockerfile",
"new_path": "fuzzers/honggfuzz/builder.Dockerfile",
"diff": "@@ -23,14 +23,14 @@ RUN apt-get update -y && \\\nlibblocksruntime-dev \\\nliblzma-dev\n-# Download honggfuz version 2.1 + 7c34b297d365d1f9fbfc230db7504c8aca384608\n+# Download honggfuz version 2.1 + e0d47db4d0d775a3dc42120351a17c646b198beb\n# Set CFLAGS use honggfuzz's defaults except for -mnative which can build CPU\n# dependent code that may not work on the machines we actually fuzz on.\n# Create an empty object file which will become the FUZZER_LIB lib (since\n# honggfuzz doesn't need this when hfuzz-clang(++) is used).\nRUN git clone https://github.com/google/honggfuzz.git /honggfuzz && \\\ncd /honggfuzz && \\\n- git checkout 7c34b297d365d1f9fbfc230db7504c8aca384608 && \\\n+ git checkout e0d47db4d0d775a3dc42120351a17c646b198beb && \\\nCFLAGS=\"-O3 -funroll-loops\" make && \\\ntouch empty_lib.c && \\\ncc -c -o empty_lib.o empty_lib.c\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [honggfuzz] version update (#204)
New day, new code updates - they improve coverage in some benchmarks |
258,388 | 06.04.2020 10:55:27 | 25,200 | 580b6797abcd7caf3c06cf2bd534c1c1bad31fcc | [base-builder] Remove installation of unneeded packages
The packages aren't needed remove them to optimize size/speed and make transition to one
builder image simpler. | [
{
"change_type": "MODIFY",
"old_path": "docker/base-builder/Dockerfile",
"new_path": "docker/base-builder/Dockerfile",
"diff": "@@ -22,24 +22,16 @@ RUN apt-get update -y && apt-get install -y \\\nautomake \\\ncmake \\\ngit \\\n- golang \\\nlibarchive-dev \\\n- libbfd-dev \\\nlibboost-dev \\\n- libbz2-dev \\\nlibcairo2-dev \\\nlibdbus-1-dev \\\nlibfreetype6-dev \\\n- libgcrypt20-dev \\\nlibglib2.0-dev \\\n- libgss-dev \\\n- liblzma-dev \\\n- libssl-dev \\\nlibtool \\\nlibunwind-dev \\\nlibxml2-dev \\\nnasm \\\n- openssl \\\nragel \\\nsubversion \\\nwget\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_builder.py",
"new_path": "experiment/test_builder.py",
"diff": "@@ -148,6 +148,7 @@ def get_specified_benchmarks():\nreturn fuzzers\n+# TODO(metzman): Fix failures caused by copying logs to GCS.\nclass TestBuildChangedBenchmarksOrFuzzers:\n\"\"\"Integration tests for integrations of changed fuzzers or benchmarks.\nNeeds TEST_BUILD_CHANGED_BENCHMARKS or TEST_BUILD_CHANGED_FUZZERS to run.\"\"\"\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [base-builder] Remove installation of unneeded packages (#199)
The packages aren't needed remove them to optimize size/speed and make transition to one
builder image simpler. |
258,388 | 06.04.2020 13:14:08 | 25,200 | eb137c22c2024b4a506c436246a0c14f2faa7e84 | [service] Initial code for running periodic experiments | [
{
"change_type": "MODIFY",
"old_path": "common/benchmark_utils.py",
"new_path": "common/benchmark_utils.py",
"diff": "@@ -77,11 +77,22 @@ def validate(benchmark):\nlogs.error('%s does not conform to %s pattern.', benchmark,\nVALID_BENCHMARK_REGEX.pattern)\nreturn False\n- benchmark_dir = os.path.join(utils.ROOT_DIR, 'benchmarks', benchmark)\n- build_sh = os.path.join(benchmark_dir, 'build.sh')\n- oss_fuzz_config = os.path.join(benchmark_dir, 'oss-fuzz.yaml')\n- valid = os.path.exists(build_sh) or os.path.exists(oss_fuzz_config)\n- if valid:\n+ if benchmark in get_all_benchmarks():\nreturn True\nlogs.error('%s must have a build.sh or oss-fuzz.yaml.', benchmark)\nreturn False\n+\n+\n+def get_all_benchmarks():\n+ \"\"\"Returns the list of all benchmarks.\"\"\"\n+ benchmarks_dir = os.path.join(utils.ROOT_DIR, 'benchmarks')\n+ all_benchmarks = []\n+ for benchmark in os.listdir(benchmarks_dir):\n+ benchmark_path = os.path.join(benchmarks_dir, benchmark)\n+ if os.path.isfile(os.path.join(benchmark_path, 'oss-fuzz.yaml')):\n+ # Benchmark is an OSS-Fuzz benchmark.\n+ all_benchmarks.append(benchmark)\n+ elif os.path.isfile(os.path.join(benchmark_path, 'build.sh')):\n+ # Benchmark is a standard benchmark.\n+ all_benchmarks.append(benchmark)\n+ return all_benchmarks\n"
},
{
"change_type": "MODIFY",
"old_path": "common/fuzzer_utils.py",
"new_path": "common/fuzzer_utils.py",
"diff": "@@ -19,6 +19,7 @@ import re\nfrom typing import Optional\nfrom common import logs\n+from common import utils\nDEFAULT_FUZZ_TARGET_NAME = 'fuzz-target'\nFUZZ_TARGET_SEARCH_STRING = b'LLVMFuzzerTestOneInput'\n@@ -74,3 +75,13 @@ def validate(fuzzer):\nlogs.error('Encountered \"%s\" while trying to import %s.', error,\nmodule_name)\nreturn False\n+\n+\n+def get_all_fuzzers():\n+ \"\"\"Returns the list of all fuzzers.\"\"\"\n+ fuzzers_dir = os.path.join(utils.ROOT_DIR, 'fuzzers')\n+ return [\n+ fuzzer for fuzzer in os.listdir(fuzzers_dir)\n+ if (os.path.isfile(os.path.join(fuzzers_dir, fuzzer, 'fuzzer.py')) and\n+ fuzzer != 'coverage')\n+ ]\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/run_experiment.py",
"new_path": "experiment/run_experiment.py",
"diff": "@@ -25,8 +25,10 @@ import sys\nfrom typing import Dict, List\nimport yaml\n+from common import benchmark_utils\nfrom common import experiment_utils\nfrom common import filesystem\n+from common import fuzzer_utils\nfrom common import gcloud\nfrom common import gsutil\nfrom common import logs\n@@ -306,31 +308,6 @@ class Dispatcher:\nzone=self.config['cloud_compute_zone'])\n-def get_all_benchmarks():\n- \"\"\"Returns the list of all benchmarks.\"\"\"\n- benchmarks_dir = os.path.join(utils.ROOT_DIR, 'benchmarks')\n- all_benchmarks = []\n- for benchmark in os.listdir(benchmarks_dir):\n- benchmark_path = os.path.join(benchmarks_dir, benchmark)\n- if os.path.isfile(os.path.join(benchmark_path, 'oss-fuzz.yaml')):\n- # Benchmark is an OSS-Fuzz benchmark.\n- all_benchmarks.append(benchmark)\n- elif os.path.isfile(os.path.join(benchmark_path, 'build.sh')):\n- # Benchmark is a standard benchmark.\n- all_benchmarks.append(benchmark)\n- return all_benchmarks\n-\n-\n-def get_all_fuzzers():\n- \"\"\"Returns the list of all fuzzers.\"\"\"\n- fuzzers_dir = os.path.join(utils.ROOT_DIR, 'fuzzers')\n- return [\n- fuzzer for fuzzer in os.listdir(fuzzers_dir)\n- if (os.path.isfile(os.path.join(fuzzers_dir, fuzzer, 'fuzzer.py')) and\n- fuzzer != 'coverage')\n- ]\n-\n-\ndef main():\n\"\"\"Run an experiment in the cloud.\"\"\"\nlogs.initialize()\n@@ -339,7 +316,7 @@ def main():\ndescription='Begin an experiment that evaluates fuzzers on one or '\n'more benchmarks.')\n- all_benchmarks = get_all_benchmarks()\n+ all_benchmarks = benchmark_utils.get_all_benchmarks()\nparser.add_argument('-b',\n'--benchmarks',\n@@ -371,7 +348,7 @@ def main():\nargs = parser.parse_args()\nif not args.fuzzers and not args.fuzzer_configs:\n- fuzzers = get_all_fuzzers()\n+ fuzzers = fuzzer_utils.get_all_fuzzers()\nelse:\nfuzzers = args.fuzzers\n"
},
{
"change_type": "MODIFY",
"old_path": "presubmit.py",
"new_path": "presubmit.py",
"diff": "@@ -39,7 +39,6 @@ _LICENSE_CHECK_EXTENSIONS = [\n'.proto',\n'.py',\n'.sh',\n- '.yaml',\n]\n_LICENSE_CHECK_IGNORE_DIRECTORIES = [\n'alembic',\n"
},
{
"change_type": "MODIFY",
"old_path": "requirements.txt",
"new_path": "requirements.txt",
"diff": "@@ -14,6 +14,7 @@ scikit-posthocs==0.6.2\nscipy==1.4.1\nseaborn==0.10.0\nsqlalchemy==1.3.13\n+pytz==2019.3\n# Needed for development.\npylint==2.4.4\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "service/experiment-config.yaml",
"diff": "+# This is the experiment config file used for the fuzzbench service.\n+# Unless you are a fuzzbench maintainer running this service, this\n+# will not work with your setup.\n+\n+trials: 20\n+max_total_time: 86400\n+cloud_project: fuzzbench\n+cloud_compute_zone: us-central1-a\n+cloud_experiment_bucket: gs://fuzzbench-data\n+cloud_web_bucket: gs://www.fuzzbench.com/reports\n+cloud_sql_instance_connection_name: \"fuzzbench:us-central1:postgres-experiment-db=tcp:5432\"\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "service/run_experiment.py",
"diff": "+#!/usr/bin/env python3\n+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Determines if an experiment should be run and runs one if necessary.\n+Note that this code uses a config file for experiments that is not generic.\n+Thus, it only works on the official fuzzbench service.\"\"\"\n+import argparse\n+import datetime\n+import os\n+import sys\n+\n+import pytz\n+\n+from common import logs\n+from common import benchmark_utils\n+from common import fuzzer_utils\n+from common import utils\n+\n+from experiment import run_experiment\n+\n+EXPERIMENT_CONFIG_FILE = os.path.join(utils.ROOT_DIR, 'service',\n+ 'experiment-config.yaml')\n+\n+\n+def get_experiment_name():\n+ \"\"\"Returns the name of the experiment to run.\"\"\"\n+ timezone = pytz.timezone('America/Los_Angeles')\n+ time_now = datetime.datetime.now(timezone)\n+ return time_now.strftime('%Y-%m-%d')\n+\n+\n+def run_diff_experiment():\n+ \"\"\"Run a diff expeirment. This is an experiment that runs only on\n+ fuzzers that have changed since the last experiment.\"\"\"\n+ # TODO(metzman): Implement this.\n+ raise NotImplementedError('Diff experiments not implemented yet.')\n+\n+\n+def run_full_experiment():\n+ \"\"\"Run a full experiment.\"\"\"\n+ experiment_name = get_experiment_name()\n+ fuzzers = fuzzer_utils.get_all_fuzzers()\n+ benchmarks = benchmark_utils.get_all_benchmarks()\n+ run_experiment.start_experiment(experiment_name,\n+ EXPERIMENT_CONFIG_FILE,\n+ benchmarks,\n+ fuzzers,\n+ fuzzer_configs=[])\n+\n+\n+def main():\n+ \"\"\"Run an experiment.\"\"\"\n+ logs.initialize()\n+ parser = argparse.ArgumentParser(\n+ description='Run a full or diff experiment (if needed).')\n+ parser.add_argument('experiment_type', choices=['diff', 'full'])\n+ args = parser.parse_args()\n+ if args.experiment_type == 'diff':\n+ run_diff_experiment()\n+ else:\n+ run_full_experiment()\n+ return 0\n+\n+\n+if __name__ == '__main__':\n+ sys.exit(main())\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [service] Initial code for running periodic experiments (#200) |
258,388 | 06.04.2020 17:42:44 | 25,200 | 7be41dc671858471e9342b18b79299425c69b657 | [wpantund] Remove benchmark
Remove benchmark as it can make network connections, causing timeouts.
Fixes | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/build.py",
"new_path": ".github/workflows/build.py",
"diff": "@@ -43,7 +43,6 @@ STANDARD_BENCHMARKS = [\n're2-2014-12-09',\n'vorbis-2017-12-11',\n'woff2-2016-05-06',\n- 'wpantund-2018-02-27',\n]\n"
},
{
"change_type": "DELETE",
"old_path": "benchmarks/wpantund-2018-02-27/build.sh",
"new_path": null,
"diff": "-#!/bin/bash -ex\n-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\n-. $(dirname $0)/../common.sh\n-\n-build_lib() {\n- rm -rf BUILD\n- cp -rf SRC BUILD\n- if [[ -f $FUZZER_LIB ]]; then\n- cp $FUZZER_LIB BUILD/src/wpantund/\n- cp $FUZZER_LIB BUILD/src/ncp-spinel/\n- fi\n- (cd BUILD && ./bootstrap.sh && ./configure \\\n- --enable-fuzz-targets \\\n- --disable-shared \\\n- --enable-static \\\n- CC=\"${CC}\" \\\n- CXX=\"${CXX}\" \\\n- FUZZ_LIBS=\"${FUZZER_LIB}\" \\\n- FUZZ_CFLAGS=\"${CFLAGS}\" \\\n- FUZZ_CXXFLAGS=\"${CXXFLAGS}\" \\\n- LDFLAGS=\"-lpthread\" \\\n- && make -j $JOBS)\n-}\n-\n-get_git_revision https://github.com/openthread/wpantund.git \\\n- 7fea6d7a24a52f6a61545610acb0ab8a6fddf503 SRC\n-build_lib\n-\n-if [[ ! -d $OUT/seeds ]]; then\n- cp -r BUILD/etc/fuzz-corpus/wpantund-fuzz $OUT/seeds\n-\n- # Remove this seed as it times out with vanilla AFL and cannot be used for\n- # fair fuzzer comparison.\n- rm $OUT/seeds/config-corpus-seed-0001\n-fi\n-\n-cp BUILD/src/wpantund/wpantund-fuzz $FUZZ_TARGET\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/reference/benchmarks.md",
"new_path": "docs/reference/benchmarks.md",
"diff": "@@ -35,7 +35,6 @@ The table below was generated using benchmarks.py.\n| systemd_fuzz-link-parser | fuzz-link-parser | False | 6 | 53453 | 5.91 |\n| vorbis-2017-12-11 | fuzz-target | False | 1 | 5022 | 6.0 |\n| woff2-2016-05-06 | fuzz-target | False | 62 | 10923 | 6.72 |\n-| wpantund-2018-02-27 | fuzz-target | False | 8 | 28888 | 7.35 |\n| zlib_zlib_uncompress_fuzzer | zlib_uncompress_fuzzer | False | 0 | 875 | 5.69 |\n\\*Number of program edges is the number of\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/afl/fuzzer.py",
"new_path": "fuzzers/afl/fuzzer.py",
"diff": "@@ -73,7 +73,7 @@ def run_afl_fuzz(input_corpus,\n# Spawn the afl fuzzing process.\n# FIXME: Currently AFL will exit if it encounters a crashing input in seed\n# corpus (usually timeouts). Add a way to skip/delete such inputs and\n- # re-run AFL. This currently happens with a seed in wpantund benchmark.\n+ # re-run AFL.\nprint('[run_fuzzer] Running target with afl-fuzz')\ncommand = [\n'./afl-fuzz',\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [wpantund] Remove benchmark (#207)
Remove benchmark as it can make network connections, causing timeouts.
Fixes #171. |
258,390 | 07.04.2020 20:07:14 | -7,200 | 46e55418edccb3bf3be58bc40dca03c6246b12a9 | [honggfuzz]: update version
The previous version can panic() under rare circumstances. | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/honggfuzz/builder.Dockerfile",
"new_path": "fuzzers/honggfuzz/builder.Dockerfile",
"diff": "@@ -23,14 +23,14 @@ RUN apt-get update -y && \\\nlibblocksruntime-dev \\\nliblzma-dev\n-# Download honggfuz version 2.1 + e0d47db4d0d775a3dc42120351a17c646b198beb\n+# Download honggfuz version 2.1 + 8e76143f884cefd3054e352eccc09d550788dba0\n# Set CFLAGS use honggfuzz's defaults except for -mnative which can build CPU\n# dependent code that may not work on the machines we actually fuzz on.\n# Create an empty object file which will become the FUZZER_LIB lib (since\n# honggfuzz doesn't need this when hfuzz-clang(++) is used).\nRUN git clone https://github.com/google/honggfuzz.git /honggfuzz && \\\ncd /honggfuzz && \\\n- git checkout e0d47db4d0d775a3dc42120351a17c646b198beb && \\\n+ git checkout 8e76143f884cefd3054e352eccc09d550788dba0 && \\\nCFLAGS=\"-O3 -funroll-loops\" make && \\\ntouch empty_lib.c && \\\ncc -c -o empty_lib.o empty_lib.c\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [honggfuzz]: update version (#209)
The previous version can panic() under rare circumstances. |
258,383 | 07.04.2020 11:23:59 | 25,200 | a53aa952b33d7be5120009c05a07de342a02d318 | use latest AFL code for lafintel | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/lafintel/builder.Dockerfile",
"new_path": "fuzzers/lafintel/builder.Dockerfile",
"diff": "@@ -28,6 +28,12 @@ RUN wget https://lcamtuf.coredump.cx/afl/releases/afl-2.26b.tgz -O /afl-2.26b.tg\ntar xvzf /afl-2.26b.tgz -C / && \\\nmv /afl-2.26b /afl && \\\ncd /afl && \\\n+ git clone https://github.com/google/AFL.git /afl/recent_afl && \\\n+ cd /afl/recent_afl && \\\n+ git checkout 8da80951dd7eeeb3e3b5a3bcd36c485045f40274 && \\\n+ cd /afl/ && \\\n+ cp /afl/recent_afl/*.c /afl/ && \\\n+ cp /afl/recent_afl/*.h /afl/ && \\\nAFL_NO_X86=1 make\n# Set the env variables for LLVM passes and test units.\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | use latest AFL code for lafintel (#208) |
258,387 | 13.04.2020 14:19:18 | 14,400 | 3ea428ed64e661ae173646e7d010128d7c080793 | [fastcgs] Testing variations | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -28,6 +28,8 @@ jobs:\n- entropic\n- fairfuzz\n- fastcgs\n+ - fastcgs_lm\n+ - fastcgs_br\n- honggfuzz\n- lafintel\n- libfuzzer\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/fastcgs/builder.Dockerfile",
"new_path": "fuzzers/fastcgs/builder.Dockerfile",
"diff": "@@ -25,7 +25,7 @@ RUN apt-get update && \\\nRUN rm -rf /afl && git clone https://github.com/alifahmed/aflmod /afl && \\\ncd /afl && \\\n- git checkout 2fa372ae2c638a557b253162350a6761bdd91278 && \\\n+ git checkout 2e944408d2fcf9333962faf0374a5efac82b4eed && \\\nAFL_NO_X86=1 make\n# Use afl_driver.cpp from LLVM as our fuzzing library.\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/fastcgs_br/builder.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+ARG parent_image=gcr.io/fuzzbench/base-builder\n+FROM $parent_image\n+\n+# Install wget to download afl_driver.cpp. Install libstdc++ to use llvm_mode.\n+RUN apt-get update && \\\n+ apt-get install wget libstdc++-5-dev -y\n+\n+# Download and compile afl++ (v2.62d).\n+# Build without Python support as we don't need it.\n+# Set AFL_NO_X86 to skip flaky tests.\n+\n+RUN rm -rf /afl && git clone https://github.com/alifahmed/aflmod /afl && \\\n+ cd /afl && \\\n+ git checkout 439f6461183c44c7509a8888b5515ab0a63311bc && \\\n+ AFL_NO_X86=1 make\n+\n+# Use afl_driver.cpp from LLVM as our fuzzing library.\n+RUN cd /afl && clang++ -stdlib=libc++ -std=c++11 -O3 -c cgs_driver.cpp && \\\n+ clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -O3 -I/afl && \\\n+ ar r /libAFL.a *.o\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/fastcgs_br/fuzzer.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Integration code for MOpt fuzzer.\"\"\"\n+\n+from fuzzers.afl import fuzzer as afl_fuzzer\n+\n+\n+def build():\n+ \"\"\"Build benchmark.\"\"\"\n+ afl_fuzzer.build()\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\"\"\"\n+ afl_fuzzer.prepare_fuzz_environment(input_corpus)\n+\n+ afl_fuzzer.run_afl_fuzz(\n+ input_corpus,\n+ output_corpus,\n+ target_binary,\n+ additional_flags=[\n+ # Enable Mopt mutator with pacemaker fuzzing mode at first. This\n+ # is also recommended in a short-time scale evaluation.\n+ '-L',\n+ '0',\n+ ])\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/fastcgs_br/runner.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+FROM gcr.io/fuzzbench/base-runner\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/fastcgs_lm/builder.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+ARG parent_image=gcr.io/fuzzbench/base-builder\n+FROM $parent_image\n+\n+# Install wget to download afl_driver.cpp. Install libstdc++ to use llvm_mode.\n+RUN apt-get update && \\\n+ apt-get install wget libstdc++-5-dev -y\n+\n+# Download and compile afl++ (v2.62d).\n+# Build without Python support as we don't need it.\n+# Set AFL_NO_X86 to skip flaky tests.\n+\n+RUN rm -rf /afl && git clone https://github.com/alifahmed/aflmod /afl && \\\n+ cd /afl && \\\n+ git checkout b0980698e7c15064e0f45ac49a0e60653e57f1bf && \\\n+ AFL_NO_X86=1 make\n+\n+# Use afl_driver.cpp from LLVM as our fuzzing library.\n+RUN cd /afl && clang++ -stdlib=libc++ -std=c++11 -O3 -c cgs_driver.cpp && \\\n+ clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -O3 -I/afl && \\\n+ ar r /libAFL.a *.o\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/fastcgs_lm/fuzzer.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Integration code for MOpt fuzzer.\"\"\"\n+\n+from fuzzers.afl import fuzzer as afl_fuzzer\n+\n+\n+def build():\n+ \"\"\"Build benchmark.\"\"\"\n+ afl_fuzzer.build()\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\"\"\"\n+ afl_fuzzer.prepare_fuzz_environment(input_corpus)\n+\n+ afl_fuzzer.run_afl_fuzz(\n+ input_corpus,\n+ output_corpus,\n+ target_binary,\n+ additional_flags=[\n+ # Enable Mopt mutator with pacemaker fuzzing mode at first. This\n+ # is also recommended in a short-time scale evaluation.\n+ '-L',\n+ '0',\n+ ])\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/fastcgs_lm/runner.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+FROM gcr.io/fuzzbench/base-runner\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [fastcgs] Testing variations (#218) |
258,415 | 13.04.2020 13:09:18 | 25,200 | 3718a8c6d1aba2e5974380e3d28f20d640dc85e5 | Only use Docker's cache-from when on a CI service.
This speeds up local caching when developing new fuzzers. | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/build.py",
"new_path": ".github/workflows/build.py",
"diff": "@@ -72,7 +72,7 @@ def make_builds(benchmarks, fuzzer):\n# Then build.\nprint('Building', build_target)\n- build_command = ['make', '-j', build_target]\n+ build_command = ['make', 'RUNNING_ON_CI=yes', '-j', build_target]\nresult = subprocess.run(build_command, check=False)\nif not result.returncode == 0:\nreturn False\n"
},
{
"change_type": "MODIFY",
"old_path": "docker/build.mk",
"new_path": "docker/build.mk",
"diff": "@@ -22,11 +22,18 @@ BASE_TAG ?= gcr.io/fuzzbench\nbuild-all: $(addsuffix -all, $(addprefix build-,$(FUZZERS)))\npull-all: $(addsuffix -all, $(addprefix pull-,$(FUZZERS)))\n+# If we're running on a CI service, cache-from a remote image. Otherwise just\n+# use the local cache.\n+cache_from = $(if ${RUNNING_ON_CI},--cache-from $(1),)\n+\n+# For base-* images (and those that depend on it), use a remote cache by\n+# default, unless the developer sets DISABLE_REMOTE_CACHE_FOR_BASE.\n+cache_from_base = $(if ${DISABLE_REMOTE_CACHE_FOR_BASE},,--cache-from $(1))\nbase-image:\ndocker build \\\n--tag $(BASE_TAG)/base-image \\\n- --cache-from $(BASE_TAG)/base-image \\\n+ $(call cache_from_base,${BASE_TAG}/base-image) \\\ndocker/base-image\npull-base-image:\n@@ -35,8 +42,8 @@ pull-base-image:\nbase-builder: base-image\ndocker build \\\n--tag $(BASE_TAG)/base-builder \\\n- --cache-from $(BASE_TAG)/base-builder \\\n- --cache-from gcr.io/oss-fuzz-base/base-clang \\\n+ $(call cache_from_base,${BASE_TAG}/base-builder) \\\n+ $(call cache_from_base,gcr.io/oss-fuzz-base/base-clang) \\\ndocker/base-builder\npull-base-clang:\n@@ -48,7 +55,7 @@ pull-base-builder: pull-base-image pull-base-clang\nbase-runner: base-image\ndocker build \\\n--tag $(BASE_TAG)/base-runner \\\n- --cache-from $(BASE_TAG)/base-runner \\\n+ $(call cache_from_base,${BASE_TAG}/base-runner) \\\ndocker/base-runner\n@@ -58,7 +65,7 @@ pull-base-runner: pull-base-image\ndispatcher-image: base-image\ndocker build \\\n--tag $(BASE_TAG)/dispatcher-image \\\n- --cache-from $(BASE_TAG)/dispatcher-image \\\n+ $(call cache_from,${BASE_TAG}/dispatcher-image) \\\ndocker/dispatcher-image\n@@ -68,7 +75,7 @@ define fuzzer_template\ndocker build \\\n--tag $(BASE_TAG)/builders/$(1) \\\n--file fuzzers/$(1)/builder.Dockerfile \\\n- --cache-from $(BASE_TAG)/builders/$(1) \\\n+ $(call cache_from,${BASE_TAG}/builders/$(1)) \\\nfuzzers/$(1)\n.pull-$(1)-builder: pull-base-builder\n@@ -89,7 +96,7 @@ define fuzzer_benchmark_template\n--tag $(BASE_TAG)/builders/$(1)/$(2) \\\n--build-arg fuzzer=$(1) \\\n--build-arg benchmark=$(2) \\\n- --cache-from $(BASE_TAG)/builders/$(1)/$(2) \\\n+ $(call cache_from,${BASE_TAG}/builders/$(1)/$(2)) \\\n--file docker/benchmark-builder/Dockerfile \\\n.\n@@ -102,7 +109,7 @@ ifneq ($(1), coverage)\ndocker build \\\n--tag $(BASE_TAG)/runners/$(1)/$(2)-intermediate \\\n--file fuzzers/$(1)/runner.Dockerfile \\\n- --cache-from $(BASE_TAG)/runners/$(1)/$(2)-intermediate \\\n+ $(call cache_from,${BASE_TAG}/runners/$(1)/$(2)-intermediate) \\\nfuzzers/$(1)\n.pull-$(1)-$(2)-intermediate-runner: pull-base-runner\n@@ -113,7 +120,7 @@ ifneq ($(1), coverage)\n--tag $(BASE_TAG)/runners/$(1)/$(2) \\\n--build-arg fuzzer=$(1) \\\n--build-arg benchmark=$(2) \\\n- --cache-from $(BASE_TAG)/runners/$(1)/$(2) \\\n+ $(call cache_from,${BASE_TAG}/runners/$(1)/$(2)) \\\n--file docker/benchmark-runner/Dockerfile \\\n.\n@@ -183,7 +190,7 @@ define fuzzer_oss_fuzz_benchmark_template\n--tag $(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name)-intermediate \\\n--file=fuzzers/$(1)/builder.Dockerfile \\\n--build-arg parent_image=gcr.io/fuzzbench/oss-fuzz/$($(2)-project-name)@sha256:$($(2)-oss-fuzz-builder-hash) \\\n- --cache-from $(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name)-intermediate \\\n+ $(call cache_from,${BASE_TAG}/oss-fuzz/builders/$(1)/$($(2)-project-name)-intermediate) \\\nfuzzers/$(1)\n.pull-$(1)-$(2)-oss-fuzz-builder-intermediate:\n@@ -195,7 +202,7 @@ define fuzzer_oss_fuzz_benchmark_template\n--file=docker/oss-fuzz-builder/Dockerfile \\\n--build-arg parent_image=$(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name)-intermediate \\\n--build-arg fuzzer=$(1) \\\n- --cache-from $(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name) \\\n+ $(call cache_from,${BASE_TAG}/oss-fuzz/builders/$(1)/$($(2)-project-name)) \\\n.\n.pull-$(1)-$(2)-oss-fuzz-builder: .pull-$(1)-$(2)-oss-fuzz-builder-intermediate\n@@ -207,7 +214,7 @@ ifneq ($(1), coverage)\ndocker build \\\n--tag $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)-intermediate \\\n--file fuzzers/$(1)/runner.Dockerfile \\\n- --cache-from $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)-intermediate \\\n+ $(call cache_from,${BASE_TAG}/oss-fuzz/runners/$(1)/$($(2)-project-name)-intermediate) \\\nfuzzers/$(1)\n.pull-$(1)-$(2)-oss-fuzz-intermediate-runner: pull-base-runner\n@@ -218,7 +225,7 @@ ifneq ($(1), coverage)\n--tag $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name) \\\n--build-arg fuzzer=$(1) \\\n--build-arg oss_fuzz_project=$($(2)-project-name) \\\n- --cache-from $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name) \\\n+ $(call cache_from,${BASE_TAG}/oss-fuzz/runners/$(1)/$($(2)-project-name)) \\\n--file docker/oss-fuzz-runner/Dockerfile \\\n.\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Only use Docker's cache-from when on a CI service. (#216)
This speeds up local caching when developing new fuzzers. |
258,387 | 16.04.2020 11:13:13 | 14,400 | 7d547daf74c5f409f833e19cc7f25b7515f9dca7 | Changed map size | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/fastcgs_br/builder.Dockerfile",
"new_path": "fuzzers/fastcgs_br/builder.Dockerfile",
"diff": "@@ -25,7 +25,7 @@ RUN apt-get update && \\\nRUN rm -rf /afl && git clone https://github.com/alifahmed/aflmod /afl && \\\ncd /afl && \\\n- git checkout 439f6461183c44c7509a8888b5515ab0a63311bc && \\\n+ git checkout 1124baa6339a3b6614371388ead169154fdde89e && \\\nAFL_NO_X86=1 make\n# Use afl_driver.cpp from LLVM as our fuzzing library.\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Changed map size (#232) |
258,387 | 21.04.2020 00:36:16 | 14,400 | 12eb7456c4a3b9e0133aa3ff26c9de79746d9435 | [fastcgs_br] Fix for failing bloaty_fuzz_target | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/fastcgs_br/builder.Dockerfile",
"new_path": "fuzzers/fastcgs_br/builder.Dockerfile",
"diff": "@@ -25,7 +25,7 @@ RUN apt-get update && \\\nRUN rm -rf /afl && git clone https://github.com/alifahmed/aflmod /afl && \\\ncd /afl && \\\n- git checkout 1124baa6339a3b6614371388ead169154fdde89e && \\\n+ git checkout 7968f079c28977aa38bb08a64ebfc273807724ec && \\\nAFL_NO_X86=1 make\n# Use afl_driver.cpp from LLVM as our fuzzing library.\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [fastcgs_br] Fix for failing bloaty_fuzz_target (#246) |
258,388 | 21.04.2020 10:23:29 | 25,200 | fa230b554c8ad2030806d423f4e9f0ee06acc12b | [irssi_server-fuzz] Remove benchmark
It behaves very nondeterministically, fails a lot when getting
coverage and is a bottleneck in measuring coverage. | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/build.py",
"new_path": ".github/workflows/build.py",
"diff": "@@ -20,7 +20,6 @@ import subprocess\nOSS_FUZZ_BENCHMARKS = [\n'bloaty_fuzz_target',\n'curl_curl_fuzzer_http',\n- 'irssi_server-fuzz',\n'jsoncpp_jsoncpp_fuzzer',\n'libpcap_fuzz_both',\n'mbedtls_fuzz_dtlsclient',\n"
},
{
"change_type": "DELETE",
"old_path": "benchmarks/irssi_server-fuzz/oss-fuzz.yaml",
"new_path": null,
"diff": "-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\n-project: irssi\n-fuzz_target: server-fuzz\n-oss_fuzz_builder_hash: 3bc35a46bdbb15157f54a2c82e86c9d88f8867f278bcabcbc195086ccafd4d16\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/reference/benchmarks.md",
"new_path": "docs/reference/benchmarks.md",
"diff": "@@ -18,7 +18,6 @@ The table below was generated using benchmarks.py.\n| curl_curl_fuzzer_http | curl_fuzzer_http | False | 31 | 62523 | 20.11 |\n| freetype2-2017 | fuzz-target | False | 2 | 19056 | 6.76 |\n| harfbuzz-1.3.2 | fuzz-target | False | 58 | 10021 | 6.24 |\n-| irssi_server-fuzz | server-fuzz | True | 895 | 37455 | 15.3 |\n| jsoncpp_jsoncpp_fuzzer | jsoncpp_fuzzer | True | 0 | 5536 | 5.96 |\n| lcms-2017-03-21 | fuzz-target | False | 1 | 6959 | 6.11 |\n| libjpeg-turbo-07-2017 | fuzz-target | False | 1 | 9586 | 6.4 |\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [irssi_server-fuzz] Remove benchmark (#240)
It behaves very nondeterministically, fails a lot when getting
coverage and is a bottleneck in measuring coverage. |
258,388 | 21.04.2020 15:56:33 | 25,200 | 944c368ee176f42b023e8bac6d151e59bd725cea | Add short run tests to make and CI and add unittests for fuzzers
Add test-$fuzzer-$target make target to check fuzzer can
run for 20 seconds. Make this target in CI.
Also add some unittests for each fuzzer module. | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -69,4 +69,4 @@ jobs:\n- name: Build Benchmarks\nrun: |\n- python .github/workflows/build.py $BENCHMARK_TYPE $FUZZER\n+ python .github/workflows/test_fuzzer_benchmarks.py $BENCHMARK_TYPE $FUZZER\n"
},
{
"change_type": "RENAME",
"old_path": ".github/workflows/build.py",
"new_path": ".github/workflows/test_fuzzer_benchmarks.py",
"diff": "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n-\"\"\"Script for building fuzzer,benchmark pairs in CI.\"\"\"\n+\"\"\"Script for building and briefly running fuzzer,benchmark pairs in CI.\"\"\"\nimport sys\nimport subprocess\n@@ -45,10 +45,11 @@ STANDARD_BENCHMARKS = [\ndef get_make_targets(benchmarks, fuzzer):\n- \"\"\"Return pull and build targets for |fuzzer| and each benchmark\n+ \"\"\"Return pull and test targets for |fuzzer| and each benchmark\nin |benchmarks| to pass to make.\"\"\"\nreturn [('pull-%s-%s' % (fuzzer, benchmark),\n- 'build-%s-%s' % (fuzzer, benchmark)) for benchmark in benchmarks]\n+ 'test-run-%s-%s' % (fuzzer, benchmark))\n+ for benchmark in benchmarks]\ndef delete_docker_images():\n@@ -70,8 +71,8 @@ def make_builds(benchmarks, fuzzer):\nsubprocess.run(['make', '-j', pull_target], check=False)\n# Then build.\n- print('Building', build_target)\nbuild_command = ['make', 'RUNNING_ON_CI=yes', '-j', build_target]\n+ print('Running command:', ' '.join(build_command))\nresult = subprocess.run(build_command, check=False)\nif not result.returncode == 0:\nreturn False\n"
},
{
"change_type": "MODIFY",
"old_path": "common/experiment_utils.py",
"new_path": "common/experiment_utils.py",
"diff": "@@ -18,8 +18,13 @@ import posixpath\nfrom common import environment\n-# Time interval for collecting experiment data (e.g. corpus, crashes).\n-SNAPSHOT_PERIOD = 15 * 60 # Seconds.\n+_DEFAULT_SNAPSHOT_SECONDS = 15 * 60 # Seconds.\n+\n+\n+def get_snapshot_seconds():\n+ \"\"\"Returns the amount of time in seconds between snapshots of a\n+ fuzzer's corpus during an experiment.\"\"\"\n+ return environment.get('SNAPSHOT_PERIOD', _DEFAULT_SNAPSHOT_SECONDS)\ndef get_work_dir():\n"
},
{
"change_type": "MODIFY",
"old_path": "docker/build.mk",
"new_path": "docker/build.mk",
"diff": "@@ -142,6 +142,18 @@ run-$(1)-$(2): .$(1)-$(2)-runner\n-it \\\n$(BASE_TAG)/runners/$(1)/$(2)\n+test-run-$(1)-$(2): .$(1)-$(2)-runner\n+ docker run \\\n+ --cap-add SYS_NICE \\\n+ --cap-add SYS_PTRACE \\\n+ -e FUZZ_OUTSIDE_EXPERIMENT=1 \\\n+ -e TRIAL_ID=1 \\\n+ -e FUZZER=$(1) \\\n+ -e BENCHMARK=$(2) \\\n+ -e MAX_TOTAL_TIME=20 \\\n+ -e SNAPSHOT_PERIOD=10 \\\n+ $(BASE_TAG)/runners/$(1)/$(2)\n+\ndebug-$(1)-$(2): .$(1)-$(2)-runner\ndocker run \\\n--cpus=1 \\\n@@ -250,6 +262,19 @@ run-$(1)-$(2): .$(1)-$(2)-oss-fuzz-runner\n-e FUZZ_TARGET=$($(2)-fuzz-target) \\\n-it $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)\n+test-run-$(1)-$(2): .$(1)-$(2)-oss-fuzz-runner\n+ docker run \\\n+ --cap-add SYS_NICE \\\n+ --cap-add SYS_PTRACE \\\n+ -e FUZZ_OUTSIDE_EXPERIMENT=1 \\\n+ -e TRIAL_ID=1 \\\n+ -e FUZZER=$(1) \\\n+ -e BENCHMARK=$(2) \\\n+ -e FUZZ_TARGET=$($(2)-fuzz-target) \\\n+ -e MAX_TOTAL_TIME=20 \\\n+ -e SNAPSHOT_PERIOD=10 \\\n+ $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)\n+\ndebug-$(1)-$(2): .$(1)-$(2)-oss-fuzz-runner\ndocker run \\\n--cpus=1 \\\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/measurer.py",
"new_path": "experiment/measurer.py",
"diff": "@@ -171,7 +171,7 @@ def measure_all_trials(experiment: str, max_total_time: int, pool, q) -> bool:\ndef _time_to_cycle(time_in_seconds: float) -> int:\n\"\"\"Converts |time_in_seconds| to the corresponding cycle and returns it.\"\"\"\n- return time_in_seconds // experiment_utils.SNAPSHOT_PERIOD\n+ return time_in_seconds // experiment_utils.get_snapshot_seconds()\ndef _query_ids_of_measured_trials(experiment: str):\n@@ -486,7 +486,7 @@ def measure_snapshot_coverage(fuzzer: str, benchmark: str, trial_num: int,\nsnapshot_measurer.trial_dir)\nreturn None\n- this_time = cycle * experiment_utils.SNAPSHOT_PERIOD\n+ this_time = cycle * experiment_utils.get_snapshot_seconds()\nif snapshot_measurer.is_cycle_unchanged(cycle):\nsnapshot_logger.info('Cycle: %d is unchanged.', cycle)\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/run_coverage.py",
"new_path": "experiment/run_coverage.py",
"diff": "@@ -37,7 +37,7 @@ def find_crashing_units(artifacts_dir: str) -> List[str]:\nRSS_LIMIT_MB = 2048\nUNIT_TIMEOUT = 5\n-MAX_TOTAL_TIME = experiment_utils.SNAPSHOT_PERIOD\n+MAX_TOTAL_TIME = experiment_utils.get_snapshot_seconds()\ndef do_coverage_run( # pylint: disable=too-many-locals\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/runner.py",
"new_path": "experiment/runner.py",
"diff": "@@ -61,6 +61,8 @@ SEED_CORPUS_ARCHIVE_SUFFIX = '_seed_corpus.zip'\nFile = namedtuple('File', ['path', 'modified_time', 'change_time'])\n+fuzzer_errored_out = False # pylint:disable=invalid-name\n+\ndef _clean_seed_corpus(seed_corpus_dir):\n\"\"\"Moves seed corpus files from sub-directories into the corpus directory\n@@ -207,6 +209,8 @@ def run_fuzzer(max_total_time, log_filename):\nkill_children=True,\nenv=fuzzer_environment)\nexcept subprocess.CalledProcessError:\n+ global fuzzer_errored_out # pylint:disable=invalid-name\n+ fuzzer_errored_out = True\nlogs.error('Fuzz process returned nonzero.')\n@@ -260,7 +264,6 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nargs = (max_total_time, log_file)\nfuzz_thread = threading.Thread(target=run_fuzzer, args=args)\nfuzz_thread.start()\n-\nif environment.get('FUZZ_OUTSIDE_EXPERIMENT'):\n# Hack so that the fuzz_thread has some time to fail if something is\n# wrong. Without this we will sleep for a long time before checking\n@@ -280,20 +283,21 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\n\"\"\"Sleep until it is time to do the next sync.\"\"\"\nif self.last_sync_time is not None:\nnext_sync_time = (self.last_sync_time +\n- experiment_utils.SNAPSHOT_PERIOD)\n+ experiment_utils.get_snapshot_seconds())\nsleep_time = next_sync_time - time.time()\nif sleep_time < 0:\n- # Log error if a sync has taken longer than SNAPSHOT_PERIOD and\n- # messed up our time synchronization.\n+ # Log error if a sync has taken longer than\n+ # get_snapshot_seconds() and messed up our time\n+ # synchronization.\nlogs.warning('Sleep time on cycle %d is %d', self.cycle,\nsleep_time)\nsleep_time = 0\nelse:\n- sleep_time = experiment_utils.SNAPSHOT_PERIOD\n+ sleep_time = experiment_utils.get_snapshot_seconds()\nlogs.debug('Sleeping for %d seconds.', sleep_time)\ntime.sleep(sleep_time)\n# last_sync_time is recorded before the sync so that each sync happens\n- # roughly SNAPSHOT_PERIOD after each other.\n+ # roughly get_snapshot_seconds() after each other.\nself.last_sync_time = time.time()\ndef _set_corpus_dir_contents(self):\n@@ -466,6 +470,8 @@ def main():\n'trial_id': str(environment.get('TRIAL_ID')),\n})\nexperiment_main()\n+ if fuzzer_errored_out:\n+ return 1\nreturn 0\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_measurer.py",
"new_path": "experiment/test_measurer.py",
"diff": "@@ -269,7 +269,7 @@ class TestIntegrationMeasurement:\nsnapshot_measurer.fuzzer, snapshot_measurer.benchmark,\nsnapshot_measurer.trial_num, cycle)\nassert snapshot\n- assert snapshot.time == cycle * experiment_utils.SNAPSHOT_PERIOD\n+ assert snapshot.time == cycle * experiment_utils.get_snapshot_seconds()\nassert snapshot.edges_covered == 3798\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_runner.py",
"new_path": "experiment/test_runner.py",
"diff": "@@ -272,8 +272,8 @@ class TestIntegrationRunner:\nbenchmark)\nwith mock.patch('common.fuzzer_utils.get_fuzz_target_binary',\nreturn_value=str(target_binary_path)):\n- with mock.patch('common.experiment_utils.SNAPSHOT_PERIOD',\n- max_total_time / 10):\n+ with mock.patch('common.experiment_utils.get_snapshot_seconds',\n+ return_value=max_total_time / 10):\nrunner.main()\ngcs_corpus_directory = posixpath.join(gcs_directory, 'corpus')\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/afl/fuzzer.py",
"new_path": "fuzzers/afl/fuzzer.py",
"diff": "@@ -102,7 +102,7 @@ def run_afl_fuzz(input_corpus,\n]\nprint('[run_fuzzer] Running command: ' + ' '.join(command))\noutput_stream = subprocess.DEVNULL if hide_output else None\n- subprocess.call(command, stdout=output_stream, stderr=output_stream)\n+ subprocess.check_call(command, stdout=output_stream, stderr=output_stream)\ndef fuzz(input_corpus, output_corpus, target_binary):\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/eclipser/fuzzer.py",
"new_path": "fuzzers/eclipser/fuzzer.py",
"diff": "@@ -87,7 +87,7 @@ def copy_corpus_directory(encoded_temp_corpus, output_corpus):\n# Wait for initial fuzzer initialization, and after every copy.\ntime.sleep(120)\n- subprocess.call([\n+ subprocess.check_call([\n'dotnet',\n'/Eclipser/build/Eclipser.dll',\n'decode',\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/honggfuzz/fuzzer.py",
"new_path": "fuzzers/honggfuzz/fuzzer.py",
"diff": "@@ -61,4 +61,4 @@ def fuzz(input_corpus, output_corpus, target_binary):\ncommand.extend(['--', target_binary])\nprint('[run_fuzzer] Running command: ' + ' '.join(command))\n- subprocess.call(command)\n+ subprocess.check_call(command)\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/libfuzzer/fuzzer.py",
"new_path": "fuzzers/libfuzzer/fuzzer.py",
"diff": "@@ -70,4 +70,4 @@ def run_fuzzer(input_corpus, output_corpus, target_binary, extra_flags=None):\ncommand = [target_binary, output_corpus, input_corpus] + flags\nprint('[run_fuzzer] Running command: ' + ' '.join(command))\n- subprocess.call(command)\n+ subprocess.check_call(command)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/test_fuzzers.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Tests for fuzzers/.\"\"\"\n+import os\n+import importlib\n+\n+from pyfakefs.fake_filesystem_unittest import Patcher\n+import pytest\n+\n+from common import utils\n+\n+# pylint: disable=invalid-name,unused-argument\n+\n+\n+def get_all_fuzzer_dirs():\n+ \"\"\"Returns the list of all fuzzers.\"\"\"\n+ fuzzers_dir = os.path.join(utils.ROOT_DIR, 'fuzzers')\n+ return [\n+ fuzzer for fuzzer in os.listdir(fuzzers_dir)\n+ if (os.path.isfile(os.path.join(fuzzers_dir, fuzzer, 'fuzzer.py')) and\n+ fuzzer != 'coverage')\n+ ]\n+\n+\n+def _get_fuzzer_module(fuzzer):\n+ \"\"\"Get the module for |fuzzer|'s fuzzer.py.\"\"\"\n+ return 'fuzzers.{}.fuzzer'.format(fuzzer)\n+\n+\n+def _get_all_fuzzer_modules():\n+ \"\"\"Returns the fuzzer.py modules for all fuzzers.\"\"\"\n+ return [\n+ importlib.import_module(_get_fuzzer_module(fuzzer))\n+ for fuzzer in get_all_fuzzer_dirs()\n+ ]\n+\n+\n+def test_build_function_errors():\n+ \"\"\"This test calls fuzzer_module.build() under circumstances in\n+ which it should throw an exception. If the call exceptions, the\n+ test passes, otherwise the test fails. This ensures that we can\n+ properly detect build failures.\"\"\"\n+ for fuzzer_module in _get_all_fuzzer_modules():\n+ with pytest.raises(Exception) as error, Patcher():\n+ fuzzer_module.build()\n+\n+ # Type error probably means module is doing something else\n+ # wrong, so fail if we see one. If that is not the case than\n+ # this assert should be removed.\n+ assert not isinstance(error.value, TypeError)\n+\n+\n+def test_fuzz_function_errors():\n+ \"\"\"This test calls fuzzer_module.fuzz() under circumstances in\n+ which it should throw an exception. If the call exceptions, the\n+ test passes, otherwise the test fails. This ensures that we can\n+ properly detect failures during fuzzing.\"\"\"\n+ for fuzzer_module in _get_all_fuzzer_modules():\n+ with pytest.raises(Exception) as error, Patcher():\n+ fuzzer_module.fuzz('/input-corpus', '/output-corpus',\n+ '/target-binary')\n+\n+ # Type error probably means module is doing something else wrong,\n+ # so fail if we see one. If that is not the case than this assert\n+ # should be removed.\n+ assert not isinstance(error.value, TypeError)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Add short run tests to make and CI and add unittests for fuzzers (#213)
Add test-$fuzzer-$target make target to check fuzzer can
run for 20 seconds. Make this target in CI.
Also add some unittests for each fuzzer module. |
258,388 | 21.04.2020 16:02:41 | 25,200 | 3820d32945d3a603105b6d5f7a3c7c7aa1c19852 | Replace giant rsync in measurer with a cp call for each snapshot.
cp call seems to be stable.
It is more performant and works in large scale experiments (unlike rsync). | [
{
"change_type": "MODIFY",
"old_path": "common/gsutil.py",
"new_path": "common/gsutil.py",
"diff": "@@ -62,6 +62,18 @@ def rm(*rm_arguments, recursive=True, force=False, **kwargs): # pylint: disable\nreturn gsutil_command(command, expect_zero=(not force), **kwargs)\n+def cat(path, must_exist=True, **kwargs):\n+ \"\"\"Runs the cat gsutil subcommand on |path|. Throws a\n+ subprocess.CalledProcessException if |must_exist| and the return code of the\n+ command is nonzero.\"\"\"\n+ command = ['cat', path]\n+ result = gsutil_command(command,\n+ parallel=False,\n+ expect_zero=must_exist,\n+ **kwargs)\n+ return result.retcode, result.output.splitlines()\n+\n+\ndef rsync( # pylint: disable=too-many-arguments\nsource,\ndestination,\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/build/builder.py",
"new_path": "experiment/build/builder.py",
"diff": "@@ -21,17 +21,12 @@ import os\nimport random\nimport subprocess\nimport sys\n-import tarfile\nimport time\nfrom typing import Callable, List, Tuple\n-from common import benchmark_utils\n-from common import experiment_path as exp_path\nfrom common import experiment_utils\nfrom common import filesystem\n-from common import fuzzer_utils\nfrom common import utils\n-from common import gsutil\nfrom common import logs\nfrom experiment.build import build_utils\n@@ -60,37 +55,11 @@ def build_base_images() -> Tuple[int, str]:\nreturn buildlib.build_base_images()\n-def get_coverage_binary(benchmark: str) -> str:\n- \"\"\"Get the coverage binary for benchmark.\"\"\"\n- coverage_binaries_dir = build_utils.get_coverage_binaries_dir()\n- fuzz_target = benchmark_utils.get_fuzz_target(benchmark)\n- return fuzzer_utils.get_fuzz_target_binary(coverage_binaries_dir /\n- benchmark,\n- fuzz_target_name=fuzz_target)\n-\n-\ndef build_measurer(benchmark: str) -> bool:\n\"\"\"Do a coverage build for a benchmark.\"\"\"\ntry:\nlogger.info('Building measurer for benchmark: %s.', benchmark)\nbuildlib.build_coverage(benchmark)\n- docker_name = benchmark_utils.get_docker_name(benchmark)\n- archive_name = 'coverage-build-%s.tar.gz' % docker_name\n-\n- coverage_binaries_dir = build_utils.get_coverage_binaries_dir()\n- benchmark_coverage_binary_dir = coverage_binaries_dir / benchmark\n- os.mkdir(benchmark_coverage_binary_dir)\n- cloud_bucket_archive_path = exp_path.gcs(coverage_binaries_dir /\n- archive_name)\n- gsutil.cp(cloud_bucket_archive_path,\n- str(benchmark_coverage_binary_dir),\n- parallel=False,\n- write_to_stdout=False)\n-\n- archive_path = benchmark_coverage_binary_dir / archive_name\n- tar = tarfile.open(archive_path, 'r:gz')\n- tar.extractall(benchmark_coverage_binary_dir)\n- os.remove(archive_path)\nlogs.info('Done building measurer for benchmark: %s.', benchmark)\nreturn True\nexcept Exception: # pylint: disable=broad-except\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/measurer.py",
"new_path": "experiment/measurer.py",
"diff": "@@ -20,7 +20,6 @@ import multiprocessing\nimport os\nimport pathlib\nimport posixpath\n-import subprocess\nimport sys\nimport tarfile\nimport time\n@@ -30,15 +29,17 @@ import queue\nfrom sqlalchemy import func\nfrom sqlalchemy import orm\n+from common import benchmark_utils\nfrom common import experiment_utils\nfrom common import experiment_path as exp_path\nfrom common import filesystem\n+from common import fuzzer_utils\nfrom common import gsutil\nfrom common import logs\nfrom common import utils\nfrom database import utils as db_utils\nfrom database import models\n-from experiment.build import builder\n+from experiment.build import build_utils\nfrom experiment import run_coverage\nfrom experiment import scheduler\nfrom third_party import sancov\n@@ -72,6 +73,7 @@ def measure_loop(experiment: str, max_total_time: int):\n'component': 'dispatcher',\n})\nwith multiprocessing.Pool() as pool, multiprocessing.Manager() as manager:\n+ set_up_coverage_binaries(pool, experiment)\n# Using Multiprocessing.Queue will fail with a complaint about\n# inheriting queue.\nq = manager.Queue() # pytype: disable=attribute-error\n@@ -106,13 +108,6 @@ def measure_all_trials(experiment: str, max_total_time: int, pool, q) -> bool:\nif not remote_dir_exists(experiment_folders_dir):\nreturn True\n- try:\n- gsutil.rsync(exp_path.gcs(experiment_folders_dir),\n- str(experiment_folders_dir))\n- except subprocess.CalledProcessError:\n- logger.error('Rsyncing experiment folders failed.')\n- return True\n-\nmax_cycle = _time_to_cycle(max_total_time)\nunmeasured_snapshots = get_unmeasured_snapshots(experiment, max_cycle)\n@@ -123,6 +118,7 @@ def measure_all_trials(experiment: str, max_total_time: int, pool, q) -> bool:\n(unmeasured_snapshot, max_cycle, q)\nfor unmeasured_snapshot in unmeasured_snapshots\n]\n+\nresult = pool.starmap_async(measure_trial_coverage,\nmeasure_trial_coverage_args)\n@@ -341,8 +337,8 @@ class SnapshotMeasurer: # pylint: disable=too-many-instance-attributes\n# Used by the runner to signal that there won't be a corpus archive for\n# a cycle because the corpus hasn't changed since the last cycle.\n- self.unchanged_cycles_path = os.path.join(self.trial_dir, 'results',\n- 'unchanged-cycles')\n+ self.unchanged_cycles_bucket_path = exp_path.gcs(\n+ posixpath.join(self.trial_dir, 'results', 'unchanged-cycles'))\ndef initialize_measurement_dirs(self):\n\"\"\"Initialize directories that will be needed for measuring\n@@ -354,7 +350,7 @@ class SnapshotMeasurer: # pylint: disable=too-many-instance-attributes\ndef run_cov_new_units(self):\n\"\"\"Run the coverage binary on new units.\"\"\"\n- coverage_binary = builder.get_coverage_binary(self.benchmark)\n+ coverage_binary = get_coverage_binary(self.benchmark)\ncrashing_units = run_coverage.do_coverage_run(coverage_binary,\nself.corpus_dir,\nself.sancov_dir,\n@@ -397,24 +393,18 @@ class SnapshotMeasurer: # pylint: disable=too-many-instance-attributes\ndef is_cycle_unchanged(self, cycle: int) -> bool:\n\"\"\"Returns True if |cycle| is unchanged according to the\nunchanged-cycles file. This file is written to by the trial's runner.\"\"\"\n- if not os.path.exists(self.unchanged_cycles_path):\n- return False\n- unchanged_cycles = filesystem.read(\n- self.unchanged_cycles_path).splitlines()\n- return str(cycle) in unchanged_cycles\n+ retcode, unchanged_cycles = gsutil.cat(\n+ self.unchanged_cycles_bucket_path,\n+ must_exist=False,\n+ write_to_stdout=False)\n+ return retcode == 0 and str(cycle) in unchanged_cycles\n- def extract_cycle_corpus(self, cycle: int) -> bool:\n+ def extract_corpus(self, corpus_archive_path) -> bool:\n\"\"\"Extract the corpus archive for this cycle if it exists.\"\"\"\n- corpus_archive_path = os.path.join(\n- self.trial_dir, 'corpus',\n- experiment_utils.get_corpus_archive_name(cycle))\n-\nif not os.path.exists(corpus_archive_path):\n- self.logger.warning('Corpus not found for cycle: %d.', cycle)\n+ self.logger.warning('Corpus not found: %s.', corpus_archive_path)\nreturn False\n- self.logger.debug('Corpus found for cycle: %d.', cycle)\n-\nalready_measured_units = set(os.listdir(self.prev_corpus_dir))\ncrash_blacklist = self.UNIT_BLACKLIST[self.benchmark]\nunit_blacklist = already_measured_units.union(crash_blacklist)\n@@ -481,25 +471,37 @@ def measure_snapshot_coverage(fuzzer: str, benchmark: str, trial_num: int,\n})\nsnapshot_measurer = SnapshotMeasurer(fuzzer, benchmark, trial_num,\nsnapshot_logger)\n- if not os.path.exists(snapshot_measurer.trial_dir):\n- snapshot_logger.warning('Trial dir: %s does not exist yet.',\n- snapshot_measurer.trial_dir)\n- return None\n+ snapshot_logger.info('Measuring cycle: %d.', cycle)\nthis_time = cycle * experiment_utils.get_snapshot_seconds()\nif snapshot_measurer.is_cycle_unchanged(cycle):\nsnapshot_logger.info('Cycle: %d is unchanged.', cycle)\n-\ncurrent_pcs = snapshot_measurer.get_current_pcs()\nreturn models.Snapshot(time=this_time,\ntrial_id=trial_num,\nedges_covered=len(current_pcs))\n- snapshot_measurer.initialize_measurement_dirs()\n-\n- if not snapshot_measurer.extract_cycle_corpus(cycle):\n+ corpus_archive_dst = os.path.join(\n+ snapshot_measurer.trial_dir, 'corpus',\n+ experiment_utils.get_corpus_archive_name(cycle))\n+ corpus_archive_src = exp_path.gcs(corpus_archive_dst)\n+\n+ corpus_archive_dir = os.path.dirname(corpus_archive_dst)\n+ if not os.path.exists(corpus_archive_dir):\n+ os.makedirs(corpus_archive_dir)\n+ if gsutil.cp(corpus_archive_src,\n+ corpus_archive_dst,\n+ expect_zero=False,\n+ parallel=False,\n+ write_to_stdout=False)[0] != 0:\n+ snapshot_logger.warning('Corpus not found for cycle: %d.', cycle)\nreturn None\n+ snapshot_measurer.initialize_measurement_dirs()\n+ snapshot_measurer.extract_corpus(corpus_archive_dst)\n+ # Don't keep corpus archives around longer than they need to be.\n+ os.remove(corpus_archive_dst)\n+\n# Get the coverage of the new corpus units.\nsnapshot_measurer.run_cov_new_units()\nall_pcs = snapshot_measurer.merge_new_pcs()\n@@ -518,6 +520,49 @@ def measure_snapshot_coverage(fuzzer: str, benchmark: str, trial_num: int,\nreturn snapshot\n+def set_up_coverage_binaries(pool, experiment):\n+ \"\"\"Set up coverage binaries for all benchmarks in |experiment|.\"\"\"\n+ benchmarks = [\n+ trial.benchmark for trial in db_utils.query(models.Trial).distinct(\n+ models.Trial.benchmark).filter(\n+ models.Trial.experiment == experiment)\n+ ]\n+ coverage_binaries_dir = build_utils.get_coverage_binaries_dir()\n+ if not os.path.exists(coverage_binaries_dir):\n+ os.makedirs(coverage_binaries_dir)\n+ pool.map(set_up_coverage_binary, benchmarks)\n+\n+\n+def set_up_coverage_binary(benchmark):\n+ \"\"\"Set up coverage binaries for |benchmark|.\"\"\"\n+ initialize_logs()\n+ coverage_binaries_dir = build_utils.get_coverage_binaries_dir()\n+ benchmark_coverage_binary_dir = coverage_binaries_dir / benchmark\n+ if not os.path.exists(benchmark_coverage_binary_dir):\n+ os.mkdir(benchmark_coverage_binary_dir)\n+ docker_name = benchmark_utils.get_docker_name(benchmark)\n+ archive_name = 'coverage-build-%s.tar.gz' % docker_name\n+ cloud_bucket_archive_path = exp_path.gcs(coverage_binaries_dir /\n+ archive_name)\n+ gsutil.cp(cloud_bucket_archive_path,\n+ str(benchmark_coverage_binary_dir),\n+ parallel=False,\n+ write_to_stdout=False)\n+ archive_path = benchmark_coverage_binary_dir / archive_name\n+ tar = tarfile.open(archive_path, 'r:gz')\n+ tar.extractall(benchmark_coverage_binary_dir)\n+ os.remove(archive_path)\n+\n+\n+def get_coverage_binary(benchmark: str) -> str:\n+ \"\"\"Get the coverage binary for benchmark.\"\"\"\n+ coverage_binaries_dir = build_utils.get_coverage_binaries_dir()\n+ fuzz_target = benchmark_utils.get_fuzz_target(benchmark)\n+ return fuzzer_utils.get_fuzz_target_binary(coverage_binaries_dir /\n+ benchmark,\n+ fuzz_target_name=fuzz_target)\n+\n+\ndef initialize_logs():\n\"\"\"Initialize logs. This must be called on process start.\"\"\"\nlogs.initialize(default_extras={\n@@ -531,6 +576,7 @@ def main():\nmultiprocessing.set_start_method('spawn')\nexperiment_name = experiment_utils.get_experiment_name()\n+\ntry:\nmeasure_loop(experiment_name, int(sys.argv[1]))\nexcept Exception as error:\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_measurer.py",
"new_path": "experiment/test_measurer.py",
"diff": "@@ -138,38 +138,56 @@ def test_measure_all_trials(_, __, mocked_execute, db, fs):\nassert sorted(actual_ids) == list(range(1, 17))\n-def test_is_cycle_unchanged(fs, experiment):\n+@mock.patch('multiprocessing.pool.ThreadPool', test_utils.MockPool)\n+@mock.patch('common.new_process.execute')\n+@mock.patch('common.filesystem.directories_have_same_files')\n+@pytest.mark.skip(reason=\"See crbug.com/1012329\")\n+def test_measure_all_trials_no_more(mocked_directories_have_same_files,\n+ mocked_execute):\n+ \"\"\"Test measure_all_trials does what is intended when the experiment is\n+ done.\"\"\"\n+ mocked_directories_have_same_files.return_value = True\n+ mocked_execute.return_value = new_process.ProcessResult(0, '', False)\n+ mock_pool = test_utils.MockPool()\n+ assert not measurer.measure_all_trials(\n+ experiment_utils.get_experiment_name(), MAX_TOTAL_TIME, mock_pool,\n+ queue.Queue())\n+\n+\n+@mock.patch('common.gsutil.cat')\n+def test_is_cycle_unchanged(mocked_cat, experiment):\n\"\"\"Test that is_cycle_unchanged can properly determine if a cycle is\nunchanged or not.\"\"\"\nsnapshot_measurer = measurer.SnapshotMeasurer(FUZZER, BENCHMARK, TRIAL_NUM,\nSNAPSHOT_LOGGER)\nthis_cycle = 100\n- unchanged_cycles_path = os.path.join(snapshot_measurer.trial_dir, 'results',\n- 'unchanged-cycles')\nunchange_cycles_file_contents = ('\\n'.join([str(num) for num in range(10)] +\n[str(this_cycle)]))\n- fs.create_file(unchanged_cycles_path,\n- contents=unchange_cycles_file_contents)\n+ mocked_cat.return_value = (0, unchange_cycles_file_contents)\nassert snapshot_measurer.is_cycle_unchanged(this_cycle)\nassert not snapshot_measurer.is_cycle_unchanged(this_cycle + 1)\n- os.remove(unchanged_cycles_path)\n-@mock.patch('common.logs.Logger.warning')\n-def test_is_cycle_unchanged_no_file(mocked_warn, fs, experiment):\n+@mock.patch('common.gsutil.cat')\n+def test_is_cycle_unchanged_no_file(mocked_cat, fs, experiment):\n\"\"\"Test that is_cycle_unchanged returns False when there is no\nunchanged-cycles file.\"\"\"\n# Make sure we log if there is no unchanged-cycles file.\nsnapshot_measurer = measurer.SnapshotMeasurer(FUZZER, BENCHMARK, TRIAL_NUM,\nSNAPSHOT_LOGGER)\n+ mocked_cat.return_value = (1, '0')\nassert not snapshot_measurer.is_cycle_unchanged(0)\n@mock.patch('common.new_process.execute')\ndef test_run_cov_new_units(mocked_execute, fs, environ):\n\"\"\"Tests that run_cov_new_units does a coverage run as we expect.\"\"\"\n- os.environ = {'WORK': '/work'}\n+ os.environ = {\n+ 'WORK': '/work',\n+ 'CLOUD_EXPERIMENT_BUCKET': 'gs://bucket',\n+ 'EXPERIMENT': 'experiment',\n+ }\nmocked_execute.return_value = new_process.ProcessResult(0, '', False)\nsnapshot_measurer = measurer.SnapshotMeasurer(FUZZER, BENCHMARK, TRIAL_NUM,\nSNAPSHOT_LOGGER)\n@@ -196,6 +214,8 @@ def test_run_cov_new_units(mocked_execute, fs, environ):\n'/work/measurement-folders/benchmark-a/fuzzer-a'\n'/trial-12/sancovs'),\n'WORK': '/work',\n+ 'CLOUD_EXPERIMENT_BUCKET': 'gs://bucket',\n+ 'EXPERIMENT': 'experiment',\n},\n'expect_zero': False,\n}\n@@ -261,8 +281,8 @@ class TestIntegrationMeasurement:\nos.makedirs(corpus_dir)\nshutil.copy(archive, corpus_dir)\n- with mock.patch('common.gsutil.rsync') as mocked_rsync:\n- mocked_rsync.return_value = new_process.ProcessResult(0, '', False)\n+ with mock.patch('common.gsutil.cp') as mocked_cp:\n+ mocked_cp.return_value = new_process.ProcessResult(0, '', False)\n# TODO(metzman): Create a system for using actual buckets in\n# integration tests.\nsnapshot = measurer.measure_snapshot_coverage(\n@@ -288,10 +308,11 @@ def test_extract_corpus(archive_name, tmp_path):\n@mock.patch('experiment.scheduler.all_trials_ended')\n+@mock.patch('experiment.measurer.set_up_coverage_binaries')\n@mock.patch('experiment.measurer.measure_all_trials')\n@mock.patch('multiprocessing.Manager')\n@mock.patch('multiprocessing.pool')\n-def test_measure_loop_end(_, mocked_manager, mocked_measure_all_trials,\n+def test_measure_loop_end(_, mocked_manager, mocked_measure_all_trials, __,\nmocked_all_trials_ended):\n\"\"\"Tests that measure_loop stops when there is nothing left to measure.\"\"\"\ncall_count = 0\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Replace giant rsync in measurer with a cp call for each snapshot. (#243)
cp call seems to be stable.
It is more performant and works in large scale experiments (unlike rsync). |
258,388 | 22.04.2020 20:09:26 | 25,200 | 9f6352d899c7e832775c8e1e01bff1186e8af9da | Don't install benchmark specific dependencies in base-builder
Install them in build.sh files since they are benchmark specific. | [
{
"change_type": "MODIFY",
"old_path": "benchmarks/freetype2-2017/build.sh",
"new_path": "benchmarks/freetype2-2017/build.sh",
"diff": ". $(dirname $0)/../common.sh\n+apt-get update && \\\n+ apt-get install -y \\\n+ make \\\n+ autoconf \\\n+ libtool \\\n+ libarchive-dev\n+\nbuild_lib() {\nrm -rf BUILD\ncp -rf SRC BUILD\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/harfbuzz-1.3.2/build.sh",
"new_path": "benchmarks/harfbuzz-1.3.2/build.sh",
"diff": ". $(dirname $0)/../common.sh\n+apt-get update && \\\n+ apt-get install -y \\\n+ make \\\n+ autoconf \\\n+ automake \\\n+ libtool \\\n+ ragel \\\n+ pkg-config \\\n+ libcairo2-dev\n+\nget_git_revision https://github.com/behdad/harfbuzz.git f73a87d9a8c76a181794b74b527ea268048f78e3 SRC\nbuild_lib() {\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/lcms-2017-03-21/build.sh",
"new_path": "benchmarks/lcms-2017-03-21/build.sh",
"diff": ". $(dirname $0)/../common.sh\n+apt-get update && \\\n+ apt-get install -y \\\n+ make \\\n+ automake \\\n+ libtool\n+\nbuild_lib() {\nrm -rf BUILD\ncp -rf SRC BUILD\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/libjpeg-turbo-07-2017/build.sh",
"new_path": "benchmarks/libjpeg-turbo-07-2017/build.sh",
"diff": ". $(dirname $0)/../common.sh\n+apt-get update && \\\n+ apt-get install -y \\\n+ make \\\n+ automake \\\n+ libtool \\\n+ nasm\n+\nbuild_lib() {\nrm -rf BUILD\ncp -rf SRC BUILD\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/libpng-1.2.56/build.sh",
"new_path": "benchmarks/libpng-1.2.56/build.sh",
"diff": ". $(dirname $0)/../common.sh\n+\n+apt-get update && \\\n+ apt-get install -y \\\n+ make \\\n+ autoconf \\\n+ automake \\\n+ libtool \\\n+ zlib1g-dev\n+\n[ ! -e libpng-1.2.56.tar.gz ] && wget https://downloads.sourceforge.net/project/libpng/libpng12/older-releases/1.2.56/libpng-1.2.56.tar.gz\n[ ! -e libpng-1.2.56 ] && tar xf libpng-1.2.56.tar.gz\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/libxml2-v2.9.2/build.sh",
"new_path": "benchmarks/libxml2-v2.9.2/build.sh",
"diff": ". $(dirname $0)/../common.sh\n+apt-get update && \\\n+ apt-get install -y \\\n+ make \\\n+ autoconf \\\n+ automake \\\n+ libtool \\\n+ libglib2.0-dev\n+\nbuild_lib() {\nrm -rf BUILD\ncp -rf SRC BUILD\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/openthread-2019-12-23/build.sh",
"new_path": "benchmarks/openthread-2019-12-23/build.sh",
"diff": ". $(dirname $0)/../common.sh\n+apt-get update && \\\n+ apt-get install -y \\\n+ make \\\n+ automake \\\n+ autoconf \\\n+\nbuild_lib() {\nrm -rf BUILD\ncp -rf SRC BUILD\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/proj4-2017-08-14/build.sh",
"new_path": "benchmarks/proj4-2017-08-14/build.sh",
"diff": ". $(dirname $0)/../common.sh\n+apt-get update && \\\n+ apt-get install -y \\\n+ make \\\n+ automake \\\n+ autoconf \\\n+ libtool \\\n+ sqlite3 \\\n+ libsqlite3-dev\n+\nbuild_lib() {\nrm -rf BUILD\ncp -rf SRC BUILD\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/re2-2014-12-09/build.sh",
"new_path": "benchmarks/re2-2014-12-09/build.sh",
"diff": ". $(dirname $0)/../common.sh\n+apt-get update && \\\n+ apt-get install -y \\\n+ make \\\n+ autoconf \\\n+ automake\n+\n+\nCXXFLAGS=\"${CXXFLAGS} -std=gnu++98\"\nbuild_lib() {\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/vorbis-2017-12-11/build.sh",
"new_path": "benchmarks/vorbis-2017-12-11/build.sh",
"diff": ". $(dirname $0)/../common.sh\n+apt-get update && \\\n+ apt-get install -y \\\n+ make \\\n+ automake \\\n+ autoconf \\\n+ libtool\n+\nreadonly INSTALL_DIR=\"$PWD/INSTALL\"\nbuild_ogg() {\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/woff2-2016-05-06/build.sh",
"new_path": "benchmarks/woff2-2016-05-06/build.sh",
"diff": ". $(dirname $0)/../common.sh\n+apt-get update && \\\n+ apt-get install -y \\\n+ make \\\n+ automake \\\n+ autoconf \\\n+ libtool\n+\nget_git_revision https://github.com/google/woff2.git 9476664fd6931ea6ec532c94b816d8fbbe3aed90 SRC\nget_git_revision https://github.com/google/brotli.git 3a9032ba8733532a6cd6727970bade7f7c0e2f52 BROTLI\nget_git_revision https://github.com/FontFaceKit/roboto.git 0e41bf923e2599d651084eece345701e55a8bfde $OUT/seeds\n"
},
{
"change_type": "MODIFY",
"old_path": "docker/base-builder/Dockerfile",
"new_path": "docker/base-builder/Dockerfile",
"diff": "@@ -17,22 +17,12 @@ FROM gcr.io/oss-fuzz-base/base-clang AS base-clang\nFROM gcr.io/fuzzbench/base-image\n-RUN apt-get update -y && apt-get install -y \\\n- autoconf-archive \\\n+# Don't install recommended packages since x11 seems to get\n+# recommended for some reason.\n+RUN apt-get update -y && apt-get install -y --no-install-recommends \\\nautomake \\\n- cmake \\\ngit \\\n- libarchive-dev \\\n- libboost-dev \\\n- libcairo2-dev \\\n- libdbus-1-dev \\\n- libfreetype6-dev \\\n- libglib2.0-dev \\\nlibtool \\\n- libunwind-dev \\\n- libxml2-dev \\\n- nasm \\\n- ragel \\\nsubversion \\\nwget\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Don't install benchmark specific dependencies in base-builder (#252)
Install them in build.sh files since they are benchmark specific. |
258,388 | 23.04.2020 18:13:39 | 25,200 | 93e8bdc5851e507f8f14f337a2ccb0497e813332 | Name OSS-Fuzz images by benchmark rather than by project
Name OSS-Fuzz images by benchmark rather than by project | [
{
"change_type": "MODIFY",
"old_path": "common/benchmark_utils.py",
"new_path": "common/benchmark_utils.py",
"diff": "@@ -29,13 +29,6 @@ def is_oss_fuzz(benchmark):\nreturn os.path.isfile(oss_fuzz.get_config_file(benchmark))\n-def get_docker_name(benchmark):\n- \"\"\"Returns the name used to represent the benchmark in docker images.\"\"\"\n- if is_oss_fuzz(benchmark):\n- return get_project(benchmark)\n- return benchmark\n-\n-\ndef get_project(benchmark):\n\"\"\"Returns the OSS-Fuzz project of |benchmark| if it is based on an\nOSS-Fuzz project, otherwise raises ValueError.\"\"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "common/test_benchmark_utils.py",
"new_path": "common/test_benchmark_utils.py",
"diff": "@@ -33,15 +33,6 @@ def test_is_oss_fuzz(benchmark, expected_result, oss_fuzz_benchmark):\nassert benchmark_utils.is_oss_fuzz(benchmark) == expected_result\n-@pytest.mark.parametrize(\n- 'benchmark,expected_name',\n- [(conftest.OSS_FUZZ_BENCHMARK_NAME, 'oss-fuzz-project'),\n- (OTHER_BENCHMARK, OTHER_BENCHMARK)])\n-def test_get_docker_name(benchmark, expected_name, oss_fuzz_benchmark):\n- \"\"\"Test that we can get the docker name of a benchmark.\"\"\"\n- assert benchmark_utils.get_docker_name(benchmark) == expected_name\n-\n-\ndef test_get_project_oss_fuzz_benchmark(oss_fuzz_benchmark):\n\"\"\"Test that we can get the project of an OSS-Fuzz benchmark.\"\"\"\nassert benchmark_utils.get_project(\n"
},
{
"change_type": "MODIFY",
"old_path": "docker/benchmark-builder/Dockerfile",
"new_path": "docker/benchmark-builder/Dockerfile",
"diff": "@@ -51,9 +51,6 @@ COPY fuzzers/$fuzzer/fuzzer.py fuzzer.py\n# Copy the entire fuzzers directory tree to allow for module dependencies.\nCOPY fuzzers fuzzers\n-# Create empty __init__.py to allow python deps to work.\n-RUN touch __init__.py\n-\n# Create output directory for build artifacts.\nRUN mkdir -p $OUT\n"
},
{
"change_type": "MODIFY",
"old_path": "docker/build.mk",
"new_path": "docker/build.mk",
"diff": "@@ -201,51 +201,51 @@ define fuzzer_oss_fuzz_benchmark_template\n.$(1)-$(2)-oss-fuzz-builder-intermediate:\ndocker build \\\n- --tag $(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name)-intermediate \\\n+ --tag $(BASE_TAG)/oss-fuzz/builders/$(1)/$(2)-intermediate \\\n--file=fuzzers/$(1)/builder.Dockerfile \\\n--build-arg parent_image=gcr.io/fuzzbench/oss-fuzz/$($(2)-project-name)@sha256:$($(2)-oss-fuzz-builder-hash) \\\n- $(call cache_from,${BASE_TAG}/oss-fuzz/builders/$(1)/$($(2)-project-name)-intermediate) \\\n+ $(call cache_from,${BASE_TAG}/oss-fuzz/builders/$(1)/$(2)-intermediate) \\\nfuzzers/$(1)\n.pull-$(1)-$(2)-oss-fuzz-builder-intermediate:\n- docker pull $(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name)-intermediate\n+ docker pull $(BASE_TAG)/oss-fuzz/builders/$(1)/$(2)-intermediate\n.$(1)-$(2)-oss-fuzz-builder: .$(1)-$(2)-oss-fuzz-builder-intermediate\ndocker build \\\n- --tag $(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name) \\\n+ --tag $(BASE_TAG)/oss-fuzz/builders/$(1)/$(2) \\\n--file=docker/oss-fuzz-builder/Dockerfile \\\n- --build-arg parent_image=$(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name)-intermediate \\\n+ --build-arg parent_image=$(BASE_TAG)/oss-fuzz/builders/$(1)/$(2)-intermediate \\\n--build-arg fuzzer=$(1) \\\n--build-arg benchmark=$(2) \\\n- $(call cache_from,${BASE_TAG}/oss-fuzz/builders/$(1)/$($(2)-project-name)) \\\n+ $(call cache_from,${BASE_TAG}/oss-fuzz/builders/$(1)/$(2)) \\\n.\n.pull-$(1)-$(2)-oss-fuzz-builder: .pull-$(1)-$(2)-oss-fuzz-builder-intermediate\n- docker pull $(BASE_TAG)/oss-fuzz/builders/$(1)/$($(2)-project-name)\n+ docker pull $(BASE_TAG)/oss-fuzz/builders/$(1)/$(2)\nifneq ($(1), coverage)\n.$(1)-$(2)-oss-fuzz-intermediate-runner: base-runner\ndocker build \\\n- --tag $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)-intermediate \\\n+ --tag $(BASE_TAG)/oss-fuzz/runners/$(1)/$(2)-intermediate \\\n--file fuzzers/$(1)/runner.Dockerfile \\\n- $(call cache_from,${BASE_TAG}/oss-fuzz/runners/$(1)/$($(2)-project-name)-intermediate) \\\n+ $(call cache_from,${BASE_TAG}/oss-fuzz/runners/$(1)/$(2)-intermediate) \\\nfuzzers/$(1)\n.pull-$(1)-$(2)-oss-fuzz-intermediate-runner: pull-base-runner\n- docker pull $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)-intermediate\n+ docker pull $(BASE_TAG)/oss-fuzz/runners/$(1)/$(2)-intermediate\n.$(1)-$(2)-oss-fuzz-runner: .$(1)-$(2)-oss-fuzz-builder .$(1)-$(2)-oss-fuzz-intermediate-runner\ndocker build \\\n- --tag $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name) \\\n+ --tag $(BASE_TAG)/oss-fuzz/runners/$(1)/$(2) \\\n--build-arg fuzzer=$(1) \\\n- --build-arg oss_fuzz_project=$($(2)-project-name) \\\n- $(call cache_from,${BASE_TAG}/oss-fuzz/runners/$(1)/$($(2)-project-name)) \\\n+ --build-arg oss_fuzz_project=$(2) \\\n+ $(call cache_from,${BASE_TAG}/oss-fuzz/runners/$(1)/$(2)) \\\n--file docker/oss-fuzz-runner/Dockerfile \\\n.\n.pull-$(1)-$(2)-oss-fuzz-runner: .pull-$(1)-$(2)-oss-fuzz-builder .pull-$(1)-$(2)-oss-fuzz-intermediate-runner\n- docker pull $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)\n+ docker pull $(BASE_TAG)/oss-fuzz/runners/$(1)/$(2)\nbuild-$(1)-$(2): .$(1)-$(2)-oss-fuzz-runner\n@@ -261,7 +261,7 @@ run-$(1)-$(2): .$(1)-$(2)-oss-fuzz-runner\n-e FUZZER=$(1) \\\n-e BENCHMARK=$(2) \\\n-e FUZZ_TARGET=$($(2)-fuzz-target) \\\n- -it $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)\n+ -it $(BASE_TAG)/oss-fuzz/runners/$(1)/$(2)\ntest-run-$(1)-$(2): .$(1)-$(2)-oss-fuzz-runner\ndocker run \\\n@@ -274,7 +274,7 @@ test-run-$(1)-$(2): .$(1)-$(2)-oss-fuzz-runner\n-e FUZZ_TARGET=$($(2)-fuzz-target) \\\n-e MAX_TOTAL_TIME=20 \\\n-e SNAPSHOT_PERIOD=10 \\\n- $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)\n+ $(BASE_TAG)/oss-fuzz/runners/$(1)/$(2)\ndebug-$(1)-$(2): .$(1)-$(2)-oss-fuzz-runner\ndocker run \\\n@@ -287,7 +287,7 @@ debug-$(1)-$(2): .$(1)-$(2)-oss-fuzz-runner\n-e BENCHMARK=$(2) \\\n-e FUZZ_TARGET=$($(2)-fuzz-target) \\\n--entrypoint \"/bin/bash\" \\\n- -it $(BASE_TAG)/oss-fuzz/runners/$(1)/$($(2)-project-name)\n+ -it $(BASE_TAG)/oss-fuzz/runners/$(1)/$(2)\nelse\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/build/gcb_build.py",
"new_path": "experiment/build/gcb_build.py",
"diff": "@@ -99,8 +99,8 @@ def _build_oss_fuzz_project_coverage(benchmark: str) -> Tuple[int, str]:\nbuild_utils.get_coverage_binaries_dir())\nsubstitutions = {\n'_GCS_COVERAGE_BINARIES_DIR': coverage_binaries_dir,\n- '_OSS_FUZZ_PROJECT': project,\n'_BENCHMARK': benchmark,\n+ '_OSS_FUZZ_PROJECT': project,\n'_OSS_FUZZ_BUILDER_HASH': oss_fuzz_builder_hash,\n}\nconfig_file = get_build_config_file('oss-fuzz-coverage.yaml')\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/build/local_build.py",
"new_path": "experiment/build/local_build.py",
"diff": "@@ -72,8 +72,7 @@ def copy_coverage_binaries(benchmark):\nmount_arg = '{0}:{0}'.format(shared_coverage_binaries_dir)\nbuilder_image_url = benchmark_utils.get_builder_image_url(\nbenchmark, 'coverage', environment.get('CLOUD_PROJECT'))\n- docker_name = benchmark_utils.get_docker_name(benchmark)\n- coverage_build_archive = 'coverage-build-{}.tar.gz'.format(docker_name)\n+ coverage_build_archive = 'coverage-build-{}.tar.gz'.format(benchmark)\ncoverage_build_archive_shared_dir_path = os.path.join(\nshared_coverage_binaries_dir, coverage_build_archive)\ncommand = 'cd /out; tar -czvf {} *'.format(\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/gcb/oss-fuzz-coverage.yaml",
"new_path": "experiment/gcb/oss-fuzz-coverage.yaml",
"diff": "@@ -19,7 +19,7 @@ steps:\nargs:\n- '-c'\n- |\n- docker pull ${_REPO}/oss-fuzz/builders/coverage/${_OSS_FUZZ_PROJECT}-intermediate || exit 0\n+ docker pull ${_REPO}/oss-fuzz/builders/coverage/${_BENCHMARK}-intermediate || exit 0\n- name: 'gcr.io/cloud-builders/docker'\nargs: [\n@@ -28,15 +28,15 @@ steps:\n# Use two tags so that the image builds properly and we can push it to the\n# correct location.\n'--tag',\n- 'gcr.io/fuzzbench/oss-fuzz/builders/coverage/${_OSS_FUZZ_PROJECT}-intermediate',\n+ 'gcr.io/fuzzbench/oss-fuzz/builders/coverage/${_BENCHMARK}-intermediate',\n'--tag',\n- '${_REPO}/oss-fuzz/builders/coverage/${_OSS_FUZZ_PROJECT}-intermediate',\n+ '${_REPO}/oss-fuzz/builders/coverage/${_BENCHMARK}-intermediate',\n'--file=fuzzers/coverage/builder.Dockerfile',\n'--cache-from',\n- '${_REPO}/oss-fuzz/builders/coverage/${_OSS_FUZZ_PROJECT}-intermediate',\n+ '${_REPO}/oss-fuzz/builders/coverage/${_BENCHMARK}-intermediate',\n# Use a hardcoded repo because the parent image is pinned by SHA. Users\n# won't have it.\n@@ -52,7 +52,7 @@ steps:\nargs:\n- '-c'\n- |\n- docker pull ${_REPO}/oss-fuzz/builders/coverage/${_OSS_FUZZ_PROJECT} || exit 0\n+ docker pull ${_REPO}/oss-fuzz/builders/coverage/${_BENCHMARK} || exit 0\nid: 'pull-coverage-benchmark-builder'\nwait_for: ['-']\n@@ -61,18 +61,18 @@ steps:\n'build',\n'--tag',\n- 'gcr.io/fuzzbench/oss-fuzz/builders/coverage/${_OSS_FUZZ_PROJECT}',\n+ 'gcr.io/fuzzbench/oss-fuzz/builders/coverage/${_BENCHMARK}',\n'--tag',\n- '${_REPO}/oss-fuzz/builders/coverage/${_OSS_FUZZ_PROJECT}',\n+ '${_REPO}/oss-fuzz/builders/coverage/${_BENCHMARK}',\n'--file=docker/oss-fuzz-builder/Dockerfile',\n'--cache-from',\n- '${_REPO}/oss-fuzz/builders/coverage/${_OSS_FUZZ_PROJECT}',\n+ '${_REPO}/oss-fuzz/builders/coverage/${_BENCHMARK}',\n'--build-arg',\n- 'parent_image=${_REPO}/oss-fuzz/builders/coverage/${_OSS_FUZZ_PROJECT}-intermediate',\n+ 'parent_image=${_REPO}/oss-fuzz/builders/coverage/${_BENCHMARK}-intermediate',\n'--build-arg',\n'fuzzer=coverage',\n@@ -89,20 +89,20 @@ steps:\n'run',\n'-v',\n'/workspace/out:/host-out',\n- '${_REPO}/oss-fuzz/builders/coverage/${_OSS_FUZZ_PROJECT}',\n+ '${_REPO}/oss-fuzz/builders/coverage/${_BENCHMARK}',\n'/bin/bash',\n'-c',\n- 'cd /out; tar -czvf /host-out/coverage-build-${_OSS_FUZZ_PROJECT}.tar.gz *'\n+ 'cd /out; tar -czvf /host-out/coverage-build-${_BENCHMARK}.tar.gz *'\n]\n- name: 'gcr.io/cloud-builders/gsutil'\nargs: [\n'-m',\n'cp',\n- '/workspace/out/coverage-build-${_OSS_FUZZ_PROJECT}.tar.gz',\n+ '/workspace/out/coverage-build-${_BENCHMARK}.tar.gz',\n'${_GCS_COVERAGE_BINARIES_DIR}/',\n]\nimages:\n- - '${_REPO}/oss-fuzz/builders/coverage/${_OSS_FUZZ_PROJECT}-intermediate'\n- - '${_REPO}/oss-fuzz/builders/coverage/${_OSS_FUZZ_PROJECT}'\n+ - '${_REPO}/oss-fuzz/builders/coverage/${_BENCHMARK}-intermediate'\n+ - '${_REPO}/oss-fuzz/builders/coverage/${_BENCHMARK}'\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/gcb/oss-fuzz-fuzzer.yaml",
"new_path": "experiment/gcb/oss-fuzz-fuzzer.yaml",
"diff": "@@ -19,22 +19,22 @@ steps:\nargs:\n- '-c'\n- |\n- docker pull ${_REPO}/oss-fuzz/builders/${_FUZZER}/${_OSS_FUZZ_PROJECT}-intermediate || exit 0\n+ docker pull ${_REPO}/oss-fuzz/builders/${_FUZZER}/${_BENCHMARK}-intermediate || exit 0\n- name: 'gcr.io/cloud-builders/docker'\nargs: [\n'build',\n'--tag',\n- 'gcr.io/fuzzbench/oss-fuzz/builders/${_FUZZER}/${_OSS_FUZZ_PROJECT}-intermediate',\n+ 'gcr.io/fuzzbench/oss-fuzz/builders/${_FUZZER}/${_BENCHMARK}-intermediate',\n'--tag',\n- '${_REPO}/oss-fuzz/builders/${_FUZZER}/${_OSS_FUZZ_PROJECT}-intermediate',\n+ '${_REPO}/oss-fuzz/builders/${_FUZZER}/${_BENCHMARK}-intermediate',\n'--file=fuzzers/${_FUZZER}/builder.Dockerfile',\n'--cache-from',\n- '${_REPO}/oss-fuzz/builders/${_FUZZER}/${_OSS_FUZZ_PROJECT}-intermediate',\n+ '${_REPO}/oss-fuzz/builders/${_FUZZER}/${_BENCHMARK}-intermediate',\n# Use a hardcoded repo because the parent image is pinned by SHA. Users\n# won't have it.\n@@ -50,7 +50,7 @@ steps:\nargs:\n- '-c'\n- |\n- docker pull ${_REPO}/oss-fuzz/builders/${_FUZZER}/${_OSS_FUZZ_PROJECT} || exit 0\n+ docker pull ${_REPO}/oss-fuzz/builders/${_FUZZER}/${_BENCHMARK} || exit 0\nid: 'pull-fuzzer-benchmark-builder'\nwait_for: ['-']\n@@ -59,18 +59,18 @@ steps:\n'build',\n'--tag',\n- 'gcr.io/fuzzbench/oss-fuzz/builders/${_FUZZER}/${_OSS_FUZZ_PROJECT}',\n+ 'gcr.io/fuzzbench/oss-fuzz/builders/${_FUZZER}/${_BENCHMARK}',\n'--tag',\n- '${_REPO}/oss-fuzz/builders/${_FUZZER}/${_OSS_FUZZ_PROJECT}',\n+ '${_REPO}/oss-fuzz/builders/${_FUZZER}/${_BENCHMARK}',\n'--file=docker/oss-fuzz-builder/Dockerfile',\n'--cache-from',\n- '${_REPO}/oss-fuzz/builders/${_FUZZER}/${_OSS_FUZZ_PROJECT}',\n+ '${_REPO}/oss-fuzz/builders/${_FUZZER}/${_BENCHMARK}',\n'--build-arg',\n- 'parent_image=${_REPO}/oss-fuzz/builders/${_FUZZER}/${_OSS_FUZZ_PROJECT}-intermediate',\n+ 'parent_image=${_REPO}/oss-fuzz/builders/${_FUZZER}/${_BENCHMARK}-intermediate',\n'--build-arg',\n'fuzzer=${_FUZZER}',\n@@ -88,7 +88,7 @@ steps:\nargs:\n- '-c'\n- |\n- docker pull ${_REPO}/oss-fuzz/builders/${_FUZZER}/${_OSS_FUZZ_PROJECT}-intermediate || exit 0\n+ docker pull ${_REPO}/oss-fuzz/builders/${_FUZZER}/${_BENCHMARK}-intermediate || exit 0\nid: 'pull-fuzzer-benchmark-runner-intermediate'\nwait_for: ['-']\n@@ -97,16 +97,16 @@ steps:\n'build',\n'--tag',\n- 'gcr.io/fuzzbench/oss-fuzz/runners/${_FUZZER}/${_OSS_FUZZ_PROJECT}-intermediate',\n+ 'gcr.io/fuzzbench/oss-fuzz/runners/${_FUZZER}/${_BENCHMARK}-intermediate',\n'--tag',\n- '${_REPO}/oss-fuzz/runners/${_FUZZER}/${_OSS_FUZZ_PROJECT}-intermediate',\n+ '${_REPO}/oss-fuzz/runners/${_FUZZER}/${_BENCHMARK}-intermediate',\n'--file',\n'fuzzers/${_FUZZER}/runner.Dockerfile',\n'--cache-from',\n- '${_REPO}/oss-fuzz/runners/${_FUZZER}/${_OSS_FUZZ_PROJECT}-intermediate',\n+ '${_REPO}/oss-fuzz/runners/${_FUZZER}/${_BENCHMARK}-intermediate',\n'fuzzers/${_FUZZER}',\n]\n@@ -118,7 +118,7 @@ steps:\nargs:\n- '-c'\n- |\n- docker pull ${_REPO}/oss-fuzz/builders/${_FUZZER}/${_OSS_FUZZ_PROJECT} || exit 0\n+ docker pull ${_REPO}/oss-fuzz/builders/${_FUZZER}/${_BENCHMARK} || exit 0\nid: 'pull-fuzzer-benchmark-runner'\nwait_for: ['-']\n@@ -128,19 +128,19 @@ steps:\n'build',\n'--tag',\n- 'gcr.io/fuzzbench/oss-fuzz/runners/${_FUZZER}/${_OSS_FUZZ_PROJECT}',\n+ 'gcr.io/fuzzbench/oss-fuzz/runners/${_FUZZER}/${_BENCHMARK}',\n'--tag',\n- '${_REPO}/oss-fuzz/runners/${_FUZZER}/${_OSS_FUZZ_PROJECT}',\n+ '${_REPO}/oss-fuzz/runners/${_FUZZER}/${_BENCHMARK}',\n'--build-arg',\n'fuzzer=${_FUZZER}',\n'--cache-from',\n- '${_REPO}/oss-fuzz/runners/${_FUZZER}/${_OSS_FUZZ_PROJECT}',\n+ '${_REPO}/oss-fuzz/runners/${_FUZZER}/${_BENCHMARK}',\n'--build-arg',\n- 'oss_fuzz_project=${_OSS_FUZZ_PROJECT}',\n+ 'oss_fuzz_project=${_BENCHMARK}',\n'--file',\n'docker/oss-fuzz-runner/Dockerfile',\n@@ -150,7 +150,7 @@ steps:\nwait_for: ['pull-fuzzer-benchmark-runner', 'build-fuzzer-benchmark-runner-intermediate']\nimages:\n- - '${_REPO}/oss-fuzz/builders/${_FUZZER}/${_OSS_FUZZ_PROJECT}-intermediate'\n- - '${_REPO}/oss-fuzz/builders/${_FUZZER}/${_OSS_FUZZ_PROJECT}'\n- - '${_REPO}/oss-fuzz/runners/${_FUZZER}/${_OSS_FUZZ_PROJECT}-intermediate'\n- - '${_REPO}/oss-fuzz/runners/${_FUZZER}/${_OSS_FUZZ_PROJECT}'\n+ - '${_REPO}/oss-fuzz/builders/${_FUZZER}/${_BENCHMARK}-intermediate'\n+ - '${_REPO}/oss-fuzz/builders/${_FUZZER}/${_BENCHMARK}'\n+ - '${_REPO}/oss-fuzz/runners/${_FUZZER}/${_BENCHMARK}-intermediate'\n+ - '${_REPO}/oss-fuzz/runners/${_FUZZER}/${_BENCHMARK}'\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/measurer.py",
"new_path": "experiment/measurer.py",
"diff": "@@ -540,8 +540,7 @@ def set_up_coverage_binary(benchmark):\nbenchmark_coverage_binary_dir = coverage_binaries_dir / benchmark\nif not os.path.exists(benchmark_coverage_binary_dir):\nos.mkdir(benchmark_coverage_binary_dir)\n- docker_name = benchmark_utils.get_docker_name(benchmark)\n- archive_name = 'coverage-build-%s.tar.gz' % docker_name\n+ archive_name = 'coverage-build-%s.tar.gz' % benchmark\ncloud_bucket_archive_path = exp_path.gcs(coverage_binaries_dir /\narchive_name)\ngsutil.cp(cloud_bucket_archive_path,\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Name OSS-Fuzz images by benchmark rather than by project (#254)
Name OSS-Fuzz images by benchmark rather than by project |
258,388 | 27.04.2020 11:23:00 | 25,200 | 980b0a62fb8674df64cbf702ab608f059822c358 | [generate_report] Add --end-time argument to limit reports to time periods
Add end_time argument so that one can specify a time limit on snapshots
they want in the report. For example, this allows one to get a report
from the first 6 hours of an experiment. | [
{
"change_type": "MODIFY",
"old_path": "analysis/data_utils.py",
"new_path": "analysis/data_utils.py",
"diff": "@@ -62,6 +62,12 @@ def label_fuzzers_by_experiment(experiment_df):\nreturn experiment_df\n+def filter_max_time(experiment_df, max_time):\n+ \"\"\"Returns table with snapshots that have time less than or equal to\n+ |max_time|.\"\"\"\n+ return experiment_df[experiment_df['time'] <= max_time]\n+\n+\n# Creating \"snapshots\" (see README.md for definition).\n_DEFAULT_BENCHMARK_SAMPLE_NUM_THRESHOLD = 0.8\n"
},
{
"change_type": "MODIFY",
"old_path": "analysis/generate_report.py",
"new_path": "analysis/generate_report.py",
"diff": "@@ -58,6 +58,13 @@ def get_arg_parser():\n'--benchmarks',\nnargs='*',\nhelp='Names of the benchmarks to include in the report.')\n+ parser.add_argument(\n+ '-e',\n+ '--end-time',\n+ default=None,\n+ type=int,\n+ help=('The last time (in seconds) during an experiment to include in '\n+ 'the report.'))\nparser.add_argument('-f',\n'--fuzzers',\nnargs='*',\n@@ -90,7 +97,8 @@ def generate_report(experiment_names,\nreport_type='default',\nquick=False,\nfrom_cached_data=False,\n- in_progress=False):\n+ in_progress=False,\n+ end_time=None):\n\"\"\"Generate report helper.\"\"\"\nreport_name = report_name or experiment_names[0]\n@@ -115,6 +123,9 @@ def generate_report(experiment_names,\nif label_by_experiment:\nexperiment_df = data_utils.label_fuzzers_by_experiment(experiment_df)\n+ if end_time is not None:\n+ experiment_df = data_utils.filter_max_time(experiment_df, end_time)\n+\nfuzzer_names = experiment_df.fuzzer.unique()\nplotter = plotting.Plotter(fuzzer_names, quick)\nexperiment_ctx = experiment_results.ExperimentResults(\n@@ -135,9 +146,16 @@ def main():\nparser = get_arg_parser()\nargs = parser.parse_args()\n- generate_report(args.experiments, args.report_dir, args.report_name,\n- args.label_by_experiment, args.benchmarks, args.fuzzers,\n- args.report_type, args.quick, args.from_cached_data)\n+ generate_report(experiment_names=args.experiments,\n+ report_directory=args.report_dir,\n+ report_name=args.report_name,\n+ label_by_experiment=args.label_by_experiment,\n+ benchmarks=args.benchmarks,\n+ fuzzers=args.fuzzers,\n+ report_type=args.report_type,\n+ quick=args.quick,\n+ from_cached_data=args.from_cached_data,\n+ end_time=args.end_time)\nif __name__ == '__main__':\n"
},
{
"change_type": "MODIFY",
"old_path": "analysis/test_data_utils.py",
"new_path": "analysis/test_data_utils.py",
"diff": "@@ -94,6 +94,14 @@ def test_label_fuzzers_by_experiment():\nassert labeled_df.fuzzer.unique().tolist() == expected_fuzzer_names\n+def test_filter_max_time():\n+ experiment_df = create_experiment_data()\n+ max_time = 5\n+ filtered_df = data_utils.filter_max_time(experiment_df, max_time)\n+ expected_times = range(max_time + 1)\n+ assert filtered_df.time.unique().tolist() == list(expected_times)\n+\n+\ndef test_benchmark_snapshot():\n\"\"\"Tests that the snapshot data contains only the latest timestamp for all\ntrials, in case all trials have the same lengths.\"\"\"\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [generate_report] Add --end-time argument to limit reports to time periods (#277)
Add end_time argument so that one can specify a time limit on snapshots
they want in the report. For example, this allows one to get a report
from the first 6 hours of an experiment. |
258,387 | 27.04.2020 19:14:14 | 14,400 | 1464eb567fdc0457aa656df3b0e0bdfbf97a2c79 | [fastcgs] Huge page versions | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/fastcgs_lm_huge/builder.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+ARG parent_image=gcr.io/fuzzbench/base-builder\n+FROM $parent_image\n+\n+# Install wget to download afl_driver.cpp. Install libstdc++ to use llvm_mode.\n+RUN apt-get update && \\\n+ apt-get install wget libstdc++-5-dev -y\n+\n+# Download and compile afl++ (v2.62d).\n+# Build without Python support as we don't need it.\n+# Set AFL_NO_X86 to skip flaky tests.\n+\n+RUN rm -rf /afl && git clone https://github.com/alifahmed/aflmod /afl && \\\n+ cd /afl && \\\n+ git checkout 44d0c09e2690f2b95aec8ab410a4b3274dc154f8 && \\\n+ AFL_NO_X86=1 make\n+\n+# Use afl_driver.cpp from LLVM as our fuzzing library.\n+RUN cd /afl && clang++ -stdlib=libc++ -std=c++11 -O3 -c cgs_driver.cpp && \\\n+ clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -O3 -I/afl && \\\n+ ar r /libAFL.a *.o\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/fastcgs_lm_huge/fuzzer.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Integration code for MOpt fuzzer.\"\"\"\n+\n+from fuzzers.afl import fuzzer as afl_fuzzer\n+\n+\n+def build():\n+ \"\"\"Build benchmark.\"\"\"\n+ afl_fuzzer.build()\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\"\"\"\n+ afl_fuzzer.prepare_fuzz_environment(input_corpus)\n+\n+ afl_fuzzer.run_afl_fuzz(\n+ input_corpus,\n+ output_corpus,\n+ target_binary,\n+ additional_flags=[\n+ # Enable Mopt mutator with pacemaker fuzzing mode at first. This\n+ # is also recommended in a short-time scale evaluation.\n+ '-L',\n+ '0',\n+ ])\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/fastcgs_lm_huge/runner.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+FROM gcr.io/fuzzbench/base-runner\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [fastcgs] Huge page versions (#258) |
258,376 | 29.04.2020 01:04:12 | -36,000 | b936e0c15736f1687819c73ea8ffe3306f6e0288 | Add input models to fuzz Freetype2 and Vorbis | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflsmart/README.md",
"new_path": "fuzzers/aflsmart/README.md",
"diff": "3. libpcap_fuzz_both\n+4. freetype2-2017\n+\n+5. vorbis-2017-12-11\n+\nSince the experiment summary diagram of the default FuzzBench report is automatically generated based on the results of all benchmarks, many of them have not been supported by AFLSmart, the ranking of AFLSmart in that diagram may not be correct.\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflsmart/builder.Dockerfile",
"new_path": "fuzzers/aflsmart/builder.Dockerfile",
"diff": "@@ -38,7 +38,7 @@ RUN add-apt-repository --keyserver hkps://keyserver.ubuntu.com:443 ppa:ubuntu-to\n# Download and compile AFLSmart\nRUN git clone https://github.com/aflsmart/aflsmart /afl && \\\ncd /afl && \\\n- git checkout df095901ea379f033d4d82345023de004f28b9a7 && \\\n+ git checkout 5fb84f3b6a0ec24059958c498fc691de01bc5fcc && \\\nAFL_NO_X86=1 make\n# Setup Peach.\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflsmart/fuzzer.py",
"new_path": "fuzzers/aflsmart/fuzzer.py",
"diff": "@@ -49,6 +49,10 @@ def fuzz(input_corpus, output_corpus, target_binary):\ninput_model = 'pcap.xml'\nif benchmark_name == 'libjpeg-turbo-07-2017':\ninput_model = 'jpeg.xml'\n+ if benchmark_name == 'freetype2-2017':\n+ input_model = 'xtf.xml'\n+ if benchmark_name == 'vorbis-2017-12-11':\n+ input_model = 'ogg.xml'\nif input_model != '':\nafl_fuzzer.run_afl_fuzz(\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Add input models to fuzz Freetype2 and Vorbis (#280) |
258,388 | 28.04.2020 09:48:37 | 25,200 | 506a5395c6d48036c66a58aeb03cab25f31827fa | Add some small optimizations to the measurer
1. Optimize check on unchanged-cycles so we aren't getting it unnecessarily.
2. Keep a list of files we've already measured rather than keeping them in a directory
3. Log the amount of time it takes to measure each benchmark. | [
{
"change_type": "MODIFY",
"old_path": "common/gsutil.py",
"new_path": "common/gsutil.py",
"diff": "@@ -62,18 +62,6 @@ def rm(*rm_arguments, recursive=True, force=False, **kwargs): # pylint: disable\nreturn gsutil_command(command, expect_zero=(not force), **kwargs)\n-def cat(path, must_exist=True, **kwargs):\n- \"\"\"Runs the cat gsutil subcommand on |path|. Throws a\n- subprocess.CalledProcessException if |must_exist| and the return code of the\n- command is nonzero.\"\"\"\n- command = ['cat', path]\n- result = gsutil_command(command,\n- parallel=False,\n- expect_zero=must_exist,\n- **kwargs)\n- return result.retcode, result.output.splitlines()\n-\n-\ndef rsync( # pylint: disable=too-many-arguments\nsource,\ndestination,\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/measurer.py",
"new_path": "experiment/measurer.py",
"diff": "@@ -317,14 +317,6 @@ class SnapshotMeasurer: # pylint: disable=too-many-instance-attributes\nself.benchmark_fuzzer_trial_dir)\nself.corpus_dir = os.path.join(measurement_dir, 'corpus')\n- # Keep a directory containing all the corpus units we've already seen.\n- # This is an easy to implement way of storing this info such that\n- # the measurer can restart and continue where it left off.\n- # A better solution could involve using a file to store this info\n- # instead. Another problem with it is it assumes the measurer is running\n- # on one machine.\n- self.prev_corpus_dir = os.path.join(measurement_dir, 'prev-corpus')\n-\nself.crashes_dir = os.path.join(measurement_dir, 'crashes')\nself.sancov_dir = os.path.join(measurement_dir, 'sancovs')\nself.report_dir = os.path.join(measurement_dir, 'reports')\n@@ -335,18 +327,21 @@ class SnapshotMeasurer: # pylint: disable=too-many-instance-attributes\nself.covered_pcs_filename = os.path.join(self.report_dir,\n'covered-pcs.txt')\n+ # Stores the files that have already been measured for a trial.\n+ self.measured_files_path = os.path.join(self.report_dir,\n+ 'measured-files.txt')\n+\n# Used by the runner to signal that there won't be a corpus archive for\n# a cycle because the corpus hasn't changed since the last cycle.\n- self.unchanged_cycles_bucket_path = exp_path.gcs(\n- posixpath.join(self.trial_dir, 'results', 'unchanged-cycles'))\n+ self.unchanged_cycles_path = os.path.join(self.trial_dir, 'results',\n+ 'unchanged-cycles')\ndef initialize_measurement_dirs(self):\n\"\"\"Initialize directories that will be needed for measuring\ncoverage.\"\"\"\nfor directory in [self.corpus_dir, self.sancov_dir, self.crashes_dir]:\nfilesystem.recreate_directory(directory)\n- for directory in [self.report_dir, self.prev_corpus_dir]:\n- pathlib.Path(directory).mkdir(exist_ok=True)\n+ filesystem.create_directory(self.report_dir)\ndef run_cov_new_units(self):\n\"\"\"Run the coverage binary on new units.\"\"\"\n@@ -393,11 +388,36 @@ class SnapshotMeasurer: # pylint: disable=too-many-instance-attributes\ndef is_cycle_unchanged(self, cycle: int) -> bool:\n\"\"\"Returns True if |cycle| is unchanged according to the\nunchanged-cycles file. This file is written to by the trial's runner.\"\"\"\n- retcode, unchanged_cycles = gsutil.cat(\n- self.unchanged_cycles_bucket_path,\n- must_exist=False,\n- write_to_stdout=False)\n- return retcode == 0 and str(cycle) in unchanged_cycles\n+\n+ def copy_unchanged_cycles_file():\n+ result = gsutil.cp(exp_path.gcs(self.unchanged_cycles_path),\n+ self.unchanged_cycles_path)\n+ return result.retcode == 0\n+\n+ if not os.path.exists(self.unchanged_cycles_path):\n+ if not copy_unchanged_cycles_file():\n+ return False\n+\n+ def get_unchanged_cycles():\n+ return [\n+ int(cycle) for cycle in filesystem.read(\n+ self.unchanged_cycles_path).splitlines()\n+ ]\n+\n+ unchanged_cycles = get_unchanged_cycles()\n+ if cycle in unchanged_cycles:\n+ return True\n+\n+ if cycle < max(unchanged_cycles):\n+ # If the last/max unchanged cycle is greater than |cycle| then we\n+ # don't need to copy the file again.\n+ return False\n+\n+ if not copy_unchanged_cycles_file():\n+ return False\n+\n+ unchanged_cycles = get_unchanged_cycles()\n+ return cycle in unchanged_cycles\ndef extract_corpus(self, corpus_archive_path) -> bool:\n\"\"\"Extract the corpus archive for this cycle if it exists.\"\"\"\n@@ -405,12 +425,11 @@ class SnapshotMeasurer: # pylint: disable=too-many-instance-attributes\nself.logger.warning('Corpus not found: %s.', corpus_archive_path)\nreturn False\n- already_measured_units = set(os.listdir(self.prev_corpus_dir))\n+ already_measured_units = self.get_measured_files()\ncrash_blacklist = self.UNIT_BLACKLIST[self.benchmark]\nunit_blacklist = already_measured_units.union(crash_blacklist)\nextract_corpus(corpus_archive_path, unit_blacklist, self.corpus_dir)\n-\nreturn True\ndef archive_crashes(self, cycle):\n@@ -431,6 +450,21 @@ class SnapshotMeasurer: # pylint: disable=too-many-instance-attributes\ngsutil.cp(archive, gcs_path)\nos.remove(archive)\n+ def update_measured_files(self):\n+ \"\"\"Updates the measured-files.txt file for this trial with\n+ files measured in this snapshot.\"\"\"\n+ current_files = set(os.listdir(self.corpus_dir))\n+ already_measured = self.get_measured_files()\n+ filesystem.write(self.measured_files_path,\n+ '\\n'.join(current_files.union(already_measured)))\n+\n+ def get_measured_files(self):\n+ \"\"\"Returns a the set of files that have been measured for this\n+ snapshot's trials.\"\"\"\n+ if not os.path.exists(self.measured_files_path):\n+ return set()\n+ return set(filesystem.read(self.measured_files_path).splitlines())\n+\ndef measure_trial_coverage( # pylint: disable=invalid-name\nmeasure_req, max_cycle: int,\n@@ -472,6 +506,7 @@ def measure_snapshot_coverage(fuzzer: str, benchmark: str, trial_num: int,\nsnapshot_measurer = SnapshotMeasurer(fuzzer, benchmark, trial_num,\nsnapshot_logger)\n+ measuring_start_time = time.time()\nsnapshot_logger.info('Measuring cycle: %d.', cycle)\nthis_time = cycle * experiment_utils.get_snapshot_seconds()\nif snapshot_measurer.is_cycle_unchanged(cycle):\n@@ -509,14 +544,15 @@ def measure_snapshot_coverage(fuzzer: str, benchmark: str, trial_num: int,\ntrial_id=trial_num,\nedges_covered=len(all_pcs))\n- # Save the new corpus.\n- filesystem.replace_dir(snapshot_measurer.corpus_dir,\n- snapshot_measurer.prev_corpus_dir)\n+ # Record the new corpus files.\n+ snapshot_measurer.update_measured_files()\n# Archive crashes directory.\nsnapshot_measurer.archive_crashes(cycle)\n- snapshot_logger.info('Measured cycle: %d.', cycle)\n+ measuring_time = round(time.time() - measuring_start_time, 2)\n+ snapshot_logger.info('Measured cycle: %d in %d seconds.', cycle,\n+ measuring_time)\nreturn snapshot\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_measurer.py",
"new_path": "experiment/test_measurer.py",
"diff": "@@ -154,29 +154,68 @@ def test_measure_all_trials_no_more(mocked_directories_have_same_files,\nqueue.Queue())\n-@mock.patch('common.gsutil.cat')\n-def test_is_cycle_unchanged(mocked_cat, experiment):\n+@mock.patch('common.gsutil.cp')\n+@mock.patch('common.filesystem.read')\n+def test_is_cycle_unchanged_first_copy(mocked_read, mocked_cp, experiment):\n\"\"\"Test that is_cycle_unchanged can properly determine if a cycle is\n- unchanged or not.\"\"\"\n+ unchanged or not when it needs to copy the file for the first time.\"\"\"\nsnapshot_measurer = measurer.SnapshotMeasurer(FUZZER, BENCHMARK, TRIAL_NUM,\nSNAPSHOT_LOGGER)\nthis_cycle = 100\n- unchange_cycles_file_contents = ('\\n'.join([str(num) for num in range(10)] +\n- [str(this_cycle)]))\n- mocked_cat.return_value = (0, unchange_cycles_file_contents)\n+ unchanged_cycles_file_contents = (\n+ '\\n'.join([str(num) for num in range(10)] + [str(this_cycle)]))\n+ mocked_read.return_value = unchanged_cycles_file_contents\n+ mocked_cp.return_value = new_process.ProcessResult(0, '', False)\nassert snapshot_measurer.is_cycle_unchanged(this_cycle)\nassert not snapshot_measurer.is_cycle_unchanged(this_cycle + 1)\n-@mock.patch('common.gsutil.cat')\n-def test_is_cycle_unchanged_no_file(mocked_cat, fs, experiment):\n+def test_is_cycle_unchanged_update(fs, experiment):\n+ \"\"\"Test that is_cycle_unchanged can properly determine that a\n+ cycle has changed when it has the file but needs to update it.\"\"\"\n+ snapshot_measurer = measurer.SnapshotMeasurer(FUZZER, BENCHMARK, TRIAL_NUM,\n+ SNAPSHOT_LOGGER)\n+\n+ this_cycle = 100\n+ initial_unchanged_cycles_file_contents = (\n+ '\\n'.join([str(num) for num in range(10)] + [str(this_cycle)]))\n+ fs.create_file(snapshot_measurer.unchanged_cycles_path,\n+ contents=initial_unchanged_cycles_file_contents)\n+\n+ next_cycle = this_cycle + 1\n+ unchanged_cycles_file_contents = (initial_unchanged_cycles_file_contents +\n+ '\\n' + str(next_cycle))\n+ assert snapshot_measurer.is_cycle_unchanged(this_cycle)\n+ with mock.patch('common.gsutil.cp') as mocked_cp:\n+ with mock.patch('common.filesystem.read') as mocked_read:\n+ mocked_cp.return_value = new_process.ProcessResult(0, '', False)\n+ mocked_read.return_value = unchanged_cycles_file_contents\n+ assert snapshot_measurer.is_cycle_unchanged(next_cycle)\n+\n+\n+@mock.patch('common.gsutil.cp')\n+def test_is_cycle_unchanged_skip_cp(mocked_cp, fs, experiment):\n+ \"\"\"Check that is_cycle_unchanged doesn't call gsutil.cp unnecessarily.\"\"\"\n+ snapshot_measurer = measurer.SnapshotMeasurer(FUZZER, BENCHMARK, TRIAL_NUM,\n+ SNAPSHOT_LOGGER)\n+ this_cycle = 100\n+ initial_unchanged_cycles_file_contents = (\n+ '\\n'.join([str(num) for num in range(10)] + [str(this_cycle + 1)]))\n+ fs.create_file(snapshot_measurer.unchanged_cycles_path,\n+ contents=initial_unchanged_cycles_file_contents)\n+ assert not snapshot_measurer.is_cycle_unchanged(this_cycle)\n+ mocked_cp.assert_not_called()\n+\n+\n+@mock.patch('common.gsutil.cp')\n+def test_is_cycle_unchanged_no_file(mocked_cp, fs, experiment):\n\"\"\"Test that is_cycle_unchanged returns False when there is no\nunchanged-cycles file.\"\"\"\n# Make sure we log if there is no unchanged-cycles file.\nsnapshot_measurer = measurer.SnapshotMeasurer(FUZZER, BENCHMARK, TRIAL_NUM,\nSNAPSHOT_LOGGER)\n- mocked_cat.return_value = (1, '0')\n+ mocked_cp.return_value = new_process.ProcessResult(1, '', False)\nassert not snapshot_measurer.is_cycle_unchanged(0)\n@@ -193,9 +232,11 @@ def test_run_cov_new_units(mocked_execute, fs, environ):\nSNAPSHOT_LOGGER)\nsnapshot_measurer.initialize_measurement_dirs()\nshared_units = ['shared1', 'shared2']\n+ fs.create_file(snapshot_measurer.measured_files_path,\n+ contents='\\n'.join(shared_units))\nfor unit in shared_units:\n- fs.create_file(os.path.join(snapshot_measurer.prev_corpus_dir, unit))\nfs.create_file(os.path.join(snapshot_measurer.corpus_dir, unit))\n+\nnew_units = ['new1', 'new2']\nfor unit in new_units:\nfs.create_file(os.path.join(snapshot_measurer.corpus_dir, unit))\n@@ -247,8 +288,11 @@ def create_measurer(experiment):\nclass TestIntegrationMeasurement:\n\"\"\"Integration tests for measurement.\"\"\"\n- def test_measure_snapshot_coverage(self, create_measurer, db, experiment):\n+ @mock.patch('experiment.measurer.SnapshotMeasurer.is_cycle_unchanged')\n+ def test_measure_snapshot_coverage( # pylint: disable=too-many-locals\n+ self, mocked_is_cycle_unchanged, create_measurer, db, experiment):\n\"\"\"Integration test for measure_snapshot_coverage.\"\"\"\n+ mocked_is_cycle_unchanged.return_value = False\n# Set up the coverage binary.\nbenchmark = 'freetype2-2017'\ncoverage_binary_src = get_test_data_path(\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Add some small optimizations to the measurer (#270)
1. Optimize check on unchanged-cycles so we aren't getting it unnecessarily.
2. Keep a list of files we've already measured rather than keeping them in a directory
3. Log the amount of time it takes to measure each benchmark. |
258,388 | 29.04.2020 09:14:48 | 25,200 | 890fb3a746572a8d44edbe0067d1cc0a7ccceb1b | Be more explicit about presubmit errors
Explicitly say that there are errors so that errors are easier to spot when
viewing CI output.
Also update google-auth library to get rid of error when installing requirements.txt | [
{
"change_type": "MODIFY",
"old_path": "experiment/test_runner.py",
"new_path": "experiment/test_runner.py",
"diff": "@@ -57,7 +57,6 @@ BENCHMARK = 'benchmark-1'\nEXPERIMENT = 'experiment-name'\nTRIAL_NUM = 1\nFUZZER = 'fuzzer-name-a'\n-FULL_FUZZER_NAME = FUZZER\n@pytest.yield_fixture\n@@ -65,7 +64,6 @@ def trial_runner(fs, environ):\n\"\"\"Fixture that creates a TrialRunner object.\"\"\"\nos.environ.update({\n'BENCHMARK': BENCHMARK,\n- 'FUZZER_VARIANT_NAME': FULL_FUZZER_NAME,\n'EXPERIMENT': EXPERIMENT,\n'TRIAL_ID': str(TRIAL_NUM),\n'FUZZER': FUZZER,\n@@ -240,7 +238,6 @@ class TestIntegrationRunner:\nos.environ['OUTPUT_CORPUS_DIR'] = str(output_corpus_dir)\nfuzzer = 'libfuzzer'\n- fuzzer_variant = fuzzer + '_variant'\nfuzzer_parent_path = root_dir / 'fuzzers' / fuzzer\nbenchmark = 'MultipleConstraintsOnSmallInputTest'\n@@ -248,8 +245,7 @@ class TestIntegrationRunner:\nexperiment = 'integration-test-experiment'\ngcs_directory = posixpath.join(test_experiment_bucket, experiment,\n'experiment-folders',\n- '%s-%s' % (benchmark, fuzzer_variant),\n- 'trial-1')\n+ '%s-%s' % (benchmark, fuzzer), 'trial-1')\ngsutil.rm(gcs_directory, force=True)\n# Add fuzzer directory to make it easy to run fuzzer.py in local\n# configuration.\n@@ -258,7 +254,6 @@ class TestIntegrationRunner:\n# Set env variables that would set by the scheduler.\nos.environ['FUZZER'] = fuzzer\n- os.environ['FUZZER_VARIANT_NAME'] = fuzzer_variant\nos.environ['BENCHMARK'] = benchmark\nos.environ['CLOUD_EXPERIMENT_BUCKET'] = test_experiment_bucket\nos.environ['EXPERIMENT'] = experiment\n"
},
{
"change_type": "MODIFY",
"old_path": "presubmit.py",
"new_path": "presubmit.py",
"diff": "@@ -305,6 +305,7 @@ def do_checks(changed_files: List[Path]) -> bool:\nfor check in [license_check, yapf, lint, pytype]:\nif not check(changed_files):\n+ print('ERROR: %s failed, see errors above.' % check.__name__)\nsuccess = False\nif not do_tests():\n@@ -338,27 +339,24 @@ def main() -> int:\nos.chdir(_SRC_ROOT)\nchanged_files = get_changed_files()\n- if args.command == 'format':\n- success = yapf(changed_files, False)\n- return bool_to_returncode(success)\n-\n- if args.command == 'lint':\n- success = lint(changed_files)\n- return bool_to_returncode(success)\n-\n- if args.command == 'typecheck':\n- success = pytype(changed_files)\n- return bool_to_returncode(success)\n-\n- if args.command == 'licensecheck':\n- success = license_check(changed_files)\n+ if not args.command:\n+ success = do_checks(changed_files)\nreturn bool_to_returncode(success)\n- if args.command == 'test_changed_integrations':\n- success = test_changed_integrations(changed_files)\n- return bool_to_returncode(success)\n+ command_check_mapping = {\n+ 'format': yapf,\n+ 'lint': lint,\n+ 'typecheck': pytype,\n+ 'test_changed_integrations': test_changed_integrations\n+ }\n- success = do_checks(changed_files)\n+ check = command_check_mapping[args.command]\n+ if args.command == 'format':\n+ success = check(changed_files, False)\n+ else:\n+ success = check(changed_files)\n+ if not success:\n+ print('ERROR: %s failed, see errors above.' % check.__name__)\nreturn bool_to_returncode(success)\n"
},
{
"change_type": "MODIFY",
"old_path": "requirements.txt",
"new_path": "requirements.txt",
"diff": "alembic==1.4.0\n-google-auth==1.11.0\n+google-auth==1.14.0\ngoogle-cloud-error-reporting==0.33.0\ngoogle-cloud-logging==1.14.0\nJinja2==2.11.1\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Be more explicit about presubmit errors (#284)
Explicitly say that there are errors so that errors are easier to spot when
viewing CI output.
Also update google-auth library to get rid of error when installing requirements.txt |
258,387 | 01.05.2020 10:24:50 | 14,400 | 4eeeb72b84b994337181bd452172c64e98b7e805 | [fastcgs] Removed fastcgs_br temporary fuzzer | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -35,7 +35,6 @@ jobs:\n- fairfuzz\n- fastcgs\n- fastcgs_lm\n- - fastcgs_br\n- honggfuzz\n- lafintel\n- libfuzzer\n"
},
{
"change_type": "DELETE",
"old_path": "fuzzers/fastcgs_br/builder.Dockerfile",
"new_path": null,
"diff": "-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\n-ARG parent_image=gcr.io/fuzzbench/base-builder\n-FROM $parent_image\n-\n-# Install wget to download afl_driver.cpp. Install libstdc++ to use llvm_mode.\n-RUN apt-get update && \\\n- apt-get install wget libstdc++-5-dev -y\n-\n-# Download and compile afl++ (v2.62d).\n-# Build without Python support as we don't need it.\n-# Set AFL_NO_X86 to skip flaky tests.\n-\n-RUN rm -rf /afl && git clone https://github.com/alifahmed/aflmod /afl && \\\n- cd /afl && \\\n- git checkout 7968f079c28977aa38bb08a64ebfc273807724ec && \\\n- AFL_NO_X86=1 make\n-\n-# Use afl_driver.cpp from LLVM as our fuzzing library.\n-RUN cd /afl && clang++ -stdlib=libc++ -std=c++11 -O3 -c cgs_driver.cpp && \\\n- clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -O3 -I/afl && \\\n- ar r /libAFL.a *.o\n"
},
{
"change_type": "DELETE",
"old_path": "fuzzers/fastcgs_br/fuzzer.py",
"new_path": null,
"diff": "-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\"\"\"Integration code for MOpt fuzzer.\"\"\"\n-\n-from fuzzers.afl import fuzzer as afl_fuzzer\n-\n-\n-def build():\n- \"\"\"Build benchmark.\"\"\"\n- afl_fuzzer.build()\n-\n-\n-def fuzz(input_corpus, output_corpus, target_binary):\n- \"\"\"Run fuzzer.\"\"\"\n- afl_fuzzer.prepare_fuzz_environment(input_corpus)\n-\n- afl_fuzzer.run_afl_fuzz(\n- input_corpus,\n- output_corpus,\n- target_binary,\n- additional_flags=[\n- # Enable Mopt mutator with pacemaker fuzzing mode at first. This\n- # is also recommended in a short-time scale evaluation.\n- '-L',\n- '0',\n- ])\n"
},
{
"change_type": "DELETE",
"old_path": "fuzzers/fastcgs_br/runner.Dockerfile",
"new_path": null,
"diff": "-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\n-FROM gcr.io/fuzzbench/base-runner\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [fastcgs] Removed fastcgs_br temporary fuzzer (#287) |
258,388 | 01.05.2020 16:11:01 | 25,200 | c791a0d43c5e946d153c5479d214f37c97d06b92 | Fix bug copying unchanged-cycles in measurer
Don't assume unchanged-cycles file exists. | [
{
"change_type": "MODIFY",
"old_path": "experiment/measurer.py",
"new_path": "experiment/measurer.py",
"diff": "@@ -391,7 +391,8 @@ class SnapshotMeasurer: # pylint: disable=too-many-instance-attributes\ndef copy_unchanged_cycles_file():\nresult = gsutil.cp(exp_path.gcs(self.unchanged_cycles_path),\n- self.unchanged_cycles_path)\n+ self.unchanged_cycles_path,\n+ expect_zero=False)\nreturn result.retcode == 0\nif not os.path.exists(self.unchanged_cycles_path):\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_measurer.py",
"new_path": "experiment/test_measurer.py",
"diff": "@@ -154,6 +154,16 @@ def test_measure_all_trials_no_more(mocked_directories_have_same_files,\nqueue.Queue())\n+def test_is_cycle_unchanged_doesnt_exist(experiment):\n+ \"\"\"Test that is_cycle_unchanged can properly determine if a cycle is\n+ unchanged or not when it needs to copy the file for the first time.\"\"\"\n+ snapshot_measurer = measurer.SnapshotMeasurer(FUZZER, BENCHMARK, TRIAL_NUM,\n+ SNAPSHOT_LOGGER)\n+ this_cycle = 1\n+ with test_utils.mock_popen_ctx_mgr(returncode=1):\n+ assert not snapshot_measurer.is_cycle_unchanged(this_cycle)\n+\n+\n@mock.patch('common.gsutil.cp')\n@mock.patch('common.filesystem.read')\ndef test_is_cycle_unchanged_first_copy(mocked_read, mocked_cp, experiment):\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix bug copying unchanged-cycles in measurer (#293)
Don't assume unchanged-cycles file exists. |
258,388 | 05.05.2020 08:24:40 | 25,200 | 76f90be5aee15297eb0b6e3ffa7b8b6828f3d50d | Remove fastcgs and fastcgs_lm_huge.
Remove temporary fuzzer fastcgs_lm_huge.
It was tested in
It also depends on which was reverted in
Also remove fastcgs | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -33,7 +33,6 @@ jobs:\n- eclipser\n- entropic\n- fairfuzz\n- - fastcgs\n- fastcgs_lm\n- honggfuzz\n- lafintel\n"
},
{
"change_type": "DELETE",
"old_path": "fuzzers/fastcgs/builder.Dockerfile",
"new_path": null,
"diff": "-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\n-ARG parent_image=gcr.io/fuzzbench/base-builder\n-FROM $parent_image\n-\n-# Install wget to download afl_driver.cpp. Install libstdc++ to use llvm_mode.\n-RUN apt-get update && \\\n- apt-get install wget libstdc++-5-dev -y\n-\n-# Download and compile afl++ (v2.62d).\n-# Build without Python support as we don't need it.\n-# Set AFL_NO_X86 to skip flaky tests.\n-\n-RUN rm -rf /afl && git clone https://github.com/alifahmed/aflmod /afl && \\\n- cd /afl && \\\n- git checkout 2e944408d2fcf9333962faf0374a5efac82b4eed && \\\n- AFL_NO_X86=1 make\n-\n-# Use afl_driver.cpp from LLVM as our fuzzing library.\n-RUN cd /afl && clang++ -stdlib=libc++ -std=c++11 -O3 -c cgs_driver.cpp && \\\n- clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -O3 -I/afl && \\\n- ar r /libAFL.a *.o\n"
},
{
"change_type": "DELETE",
"old_path": "fuzzers/fastcgs/fuzzer.py",
"new_path": null,
"diff": "-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\"\"\"Integration code for MOpt fuzzer.\"\"\"\n-\n-from fuzzers.afl import fuzzer as afl_fuzzer\n-\n-\n-def build():\n- \"\"\"Build benchmark.\"\"\"\n- afl_fuzzer.build()\n-\n-\n-def fuzz(input_corpus, output_corpus, target_binary):\n- \"\"\"Run fuzzer.\"\"\"\n- afl_fuzzer.prepare_fuzz_environment(input_corpus)\n-\n- afl_fuzzer.run_afl_fuzz(\n- input_corpus,\n- output_corpus,\n- target_binary,\n- additional_flags=[\n- # Enable Mopt mutator with pacemaker fuzzing mode at first. This\n- # is also recommended in a short-time scale evaluation.\n- '-L',\n- '0',\n- ])\n"
},
{
"change_type": "DELETE",
"old_path": "fuzzers/fastcgs/runner.Dockerfile",
"new_path": null,
"diff": "-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\n-FROM gcr.io/fuzzbench/base-runner\n"
},
{
"change_type": "DELETE",
"old_path": "fuzzers/fastcgs_lm_huge/builder.Dockerfile",
"new_path": null,
"diff": "-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\n-ARG parent_image=gcr.io/fuzzbench/base-builder\n-FROM $parent_image\n-\n-# Install wget to download afl_driver.cpp. Install libstdc++ to use llvm_mode.\n-RUN apt-get update && \\\n- apt-get install wget libstdc++-5-dev -y\n-\n-# Download and compile afl++ (v2.62d).\n-# Build without Python support as we don't need it.\n-# Set AFL_NO_X86 to skip flaky tests.\n-\n-RUN rm -rf /afl && git clone https://github.com/alifahmed/aflmod /afl && \\\n- cd /afl && \\\n- git checkout 44d0c09e2690f2b95aec8ab410a4b3274dc154f8 && \\\n- AFL_NO_X86=1 make\n-\n-# Use afl_driver.cpp from LLVM as our fuzzing library.\n-RUN cd /afl && clang++ -stdlib=libc++ -std=c++11 -O3 -c cgs_driver.cpp && \\\n- clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -O3 -I/afl && \\\n- ar r /libAFL.a *.o\n"
},
{
"change_type": "DELETE",
"old_path": "fuzzers/fastcgs_lm_huge/fuzzer.py",
"new_path": null,
"diff": "-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\"\"\"Integration code for MOpt fuzzer.\"\"\"\n-\n-from fuzzers.afl import fuzzer as afl_fuzzer\n-\n-\n-def build():\n- \"\"\"Build benchmark.\"\"\"\n- afl_fuzzer.build()\n-\n-\n-def fuzz(input_corpus, output_corpus, target_binary):\n- \"\"\"Run fuzzer.\"\"\"\n- afl_fuzzer.prepare_fuzz_environment(input_corpus)\n-\n- afl_fuzzer.run_afl_fuzz(\n- input_corpus,\n- output_corpus,\n- target_binary,\n- additional_flags=[\n- # Enable Mopt mutator with pacemaker fuzzing mode at first. This\n- # is also recommended in a short-time scale evaluation.\n- '-L',\n- '0',\n- ])\n"
},
{
"change_type": "DELETE",
"old_path": "fuzzers/fastcgs_lm_huge/runner.Dockerfile",
"new_path": null,
"diff": "-# Copyright 2020 Google LLC\n-#\n-# Licensed under the Apache License, Version 2.0 (the \"License\");\n-# you may not use this file except in compliance with the License.\n-# You may obtain a copy of the License at\n-#\n-# http://www.apache.org/licenses/LICENSE-2.0\n-#\n-# Unless required by applicable law or agreed to in writing, software\n-# distributed under the License is distributed on an \"AS IS\" BASIS,\n-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-# See the License for the specific language governing permissions and\n-# limitations under the License.\n-\n-FROM gcr.io/fuzzbench/base-runner\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Remove fastcgs and fastcgs_lm_huge. (#301)
Remove temporary fuzzer fastcgs_lm_huge.
It was tested in
https://www.fuzzbench.com/reports/2020-05-01-fastcgs/index.html
It also depends on #247 which was reverted in #294.
Also remove fastcgs |
258,372 | 05.05.2020 19:19:29 | 14,400 | 41aa9b4267907185bd51514a6fb335ff70f4990d | Fix memleak in the recently added benchmarks
Remove dupe call to pcap_datalink(). Add free() to pathname in delete_file(). Some spacing. | [
{
"change_type": "MODIFY",
"old_path": "benchmarks/jasper-1.701.0/jasper_fuzz.cc",
"new_path": "benchmarks/jasper-1.701.0/jasper_fuzz.cc",
"diff": "@@ -46,6 +46,7 @@ delete_file(const char *pathname)\nif (ret == -1) {\nwarn(\"failed to delete \\\"%s\\\"\", pathname);\n}\n+ free((void *)pathname);\nreturn ret;\n#endif\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/perl-5.21.7/perl_fuzz.cc",
"new_path": "benchmarks/perl-5.21.7/perl_fuzz.cc",
"diff": "@@ -46,6 +46,7 @@ delete_file(const char *pathname)\nif (ret == -1) {\nwarn(\"failed to delete \\\"%s\\\"\", pathname);\n}\n+ free((void *)pathname);\nreturn ret;\n#endif\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/tcpdump-4.9.0/tcpdump_fuzz.cc",
"new_path": "benchmarks/tcpdump-4.9.0/tcpdump_fuzz.cc",
"diff": "@@ -53,6 +53,7 @@ delete_file(const char *pathname)\nif (ret == -1) {\nwarn(\"failed to delete \\\"%s\\\"\", pathname);\n}\n+ free((void *)pathname);\nreturn ret;\n#endif\n}\n@@ -158,7 +159,6 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)\nreturn 0;\n}\n- dlt = pcap_datalink(pd);\ndlt = pcap_datalink(pd);\nndo->ndo_if_printer = get_if_printer(ndo, dlt);\ncallback = print_packet;\n@@ -167,9 +167,7 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)\nif (dlt_name == NULL) {\nfprintf(stderr, \"reading from file %s, link-type %u\\n\", in, dlt);\n} else {\n- fprintf(stderr,\n- \"reading from file %s, link-type %s (%s)\\n\",\n- in, dlt_name,\n+ fprintf(stderr, \"reading from file %s, link-type %s (%s)\\n\",in, dlt_name,\npcap_datalink_val_to_description(dlt));\n}\nstatus = pcap_loop(pd, 0, callback, pcap_userdata);\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix memleak in the recently added benchmarks (#305)
Remove dupe call to pcap_datalink(). Add free() to pathname in delete_file(). Some spacing. |
258,399 | 06.05.2020 21:37:00 | 18,000 | c5977212fd94ac9f4e2367d92922f36fd8d4ba5f | update prerequisites.md
Update outdated link and add Python dependencies install instructions | [
{
"change_type": "MODIFY",
"old_path": "docs/getting-started/prerequisites.md",
"new_path": "docs/getting-started/prerequisites.md",
"diff": "@@ -35,7 +35,7 @@ Install Docker using the instructions\nGooglers can visit [go/installdocker](https://goto.google.com/installdocker).\nIf you want to run `docker` without `sudo`, you can\n-[create a docker group](https://docs.docker.com/engine/installation/linux/ubuntulinux/#/create-a-docker-group).\n+[create a docker group](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user).\n**Note:** Docker images can consume significant disk space. Clean up unused\ndocker images periodically.\n@@ -61,6 +61,7 @@ If you already have Python installed, you can verify its version by running\nInstall the python dependencies by running the following command:\n```bash\n+sudo apt-get install python3-dev python3-venv\nmake install-dependencies\n```\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | update prerequisites.md (#310)
Update outdated link and add Python dependencies install instructions |
258,388 | 07.05.2020 10:17:31 | 25,200 | a7d3b22f28dcc371f1467b535f83e2034d03d1dd | Dont run test_measure_snapshot_coverage by default
Don't run test_measure_snapshot_coverage by default
The test relies on a binary that may not run on everyone's machine.
Run it in CI though.
Also, avoid using tmp_path with fakefs. Change the experiment
fixture to not use tmp_path. Combining the two causes weird errors. | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/presubmit.yml",
"new_path": ".github/workflows/presubmit.yml",
"diff": "@@ -16,4 +16,4 @@ jobs:\npython-version: 3.7\n- name: Run presubmit checks\nrun: |\n- make presubmit\n+ FUZZBENCH_TEST_INTEGRATION=1 make presubmit\n"
},
{
"change_type": "MODIFY",
"old_path": "common/test_filesystem.py",
"new_path": "common/test_filesystem.py",
"diff": "@@ -25,10 +25,10 @@ DESTINATION_DIR = 'dst'\n# pylint: disable=invalid-name,unused-argument\n-def test_recreate_directory_existing(tmp_path):\n+def test_recreate_directory_existing(fs):\n\"\"\"Tests that recreate_directory recreates a directory that already\nexists.\"\"\"\n- new_directory = os.path.join(tmp_path, 'new-directory')\n+ new_directory = 'new-directory'\nos.mkdir(new_directory)\nnew_file = os.path.join(new_directory, 'file')\nwith open(new_file, 'w') as file_handle:\n@@ -39,10 +39,10 @@ def test_recreate_directory_existing(tmp_path):\nassert not os.path.exists(new_file)\n-def test_recreate_directory_not_existing(tmp_path):\n+def test_recreate_directory_not_existing(fs):\n\"\"\"Tests that recreate_directory creates a directory that does not already\nexist.\"\"\"\n- new_directory = os.path.join(tmp_path, 'new-directory')\n+ new_directory = 'new-directory'\nfilesystem.recreate_directory(new_directory)\nassert os.path.exists(new_directory)\n"
},
{
"change_type": "MODIFY",
"old_path": "conftest.py",
"new_path": "conftest.py",
"diff": "@@ -73,9 +73,9 @@ def environ():\n@pytest.fixture\n-def experiment(tmp_path, environ): # pylint: disable=redefined-outer-name,unused-argument\n+def experiment(environ): # pylint: disable=redefined-outer-name,unused-argument\n\"\"\"Mock an experiment.\"\"\"\n- os.environ['WORK'] = str(tmp_path)\n+ os.environ['WORK'] = '/work'\nos.environ['EXPERIMENT'] = 'test-experiment'\nos.environ['CLOUD_EXPERIMENT_BUCKET'] = 'gs://experiment-data'\nos.environ['CLOUD_WEB_BUCKET'] = 'gs://web-bucket'\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/build/test_builder.py",
"new_path": "experiment/build/test_builder.py",
"diff": "@@ -19,6 +19,7 @@ from unittest import mock\nimport pytest\n+from common import utils\nfrom experiment.build import builder\nSRC_ROOT = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)\n@@ -65,9 +66,10 @@ def get_benchmarks_or_fuzzers(benchmarks_or_fuzzers_directory, filename,\n@mock.patch('time.sleep')\n@pytest.mark.parametrize('build_measurer_return_value', [True, False])\ndef test_build_all_measurers(_, mocked_build_measurer,\n- build_measurer_return_value, experiment):\n+ build_measurer_return_value, experiment, fs):\n\"\"\"Tests that build_all_measurers works as intendend when build_measurer\ncalls fail.\"\"\"\n+ fs.add_real_directory(utils.ROOT_DIR)\nmocked_build_measurer.return_value = build_measurer_return_value\nbenchmarks = get_regular_benchmarks()\nresult = builder.build_all_measurers(benchmarks)\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_measurer.py",
"new_path": "experiment/test_measurer.py",
"diff": "@@ -280,28 +280,23 @@ def get_test_data_path(*subpaths):\nreturn os.path.join(TEST_DATA_PATH, *subpaths)\n-@pytest.fixture\n-def create_measurer(experiment):\n- \"\"\"Fixture that provides a function for creating a SnapshotMeasurer.\"\"\"\n- os.mkdir(build_utils.get_coverage_binaries_dir())\n-\n- def _create_measurer(fuzzer, benchmark, trial_num):\n- return measurer.SnapshotMeasurer(fuzzer, benchmark, trial_num,\n- SNAPSHOT_LOGGER)\n-\n- yield _create_measurer\n-\n-\n# pylint: disable=no-self-use\nclass TestIntegrationMeasurement:\n\"\"\"Integration tests for measurement.\"\"\"\n+ # TODO(metzman): Get this test working everywhere by using docker or a more\n+ # portable binary.\n+ @pytest.mark.skipif(not os.getenv('FUZZBENCH_TEST_INTEGRATION'),\n+ reason='Not running integration tests.')\n@mock.patch('experiment.measurer.SnapshotMeasurer.is_cycle_unchanged')\ndef test_measure_snapshot_coverage( # pylint: disable=too-many-locals\n- self, mocked_is_cycle_unchanged, create_measurer, db, experiment):\n+ self, mocked_is_cycle_unchanged, db, experiment, tmp_path):\n\"\"\"Integration test for measure_snapshot_coverage.\"\"\"\n+ # WORK is set by experiment to a directory that only makes sense in a\n+ # fakefs.\n+ os.environ['WORK'] = str(tmp_path)\nmocked_is_cycle_unchanged.return_value = False\n# Set up the coverage binary.\nbenchmark = 'freetype2-2017'\n@@ -324,8 +319,9 @@ class TestIntegrationMeasurement:\nexperiment=os.environ['EXPERIMENT'])\ndb_utils.add_all([trial])\n- snapshot_measurer = create_measurer(trial.fuzzer, trial.benchmark,\n- trial.id)\n+ snapshot_measurer = measurer.SnapshotMeasurer(trial.fuzzer,\n+ trial.benchmark, trial.id,\n+ SNAPSHOT_LOGGER)\n# Set up the snapshot archive.\ncycle = 1\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_run_coverage.py",
"new_path": "experiment/test_run_coverage.py",
"diff": "@@ -31,14 +31,14 @@ def _get_test_data_dir(directory):\ndef _make_crashes_dir(parent_path):\n- \"\"\"Makes a crashes dir in |tmp_path| and returns it.\"\"\"\n+ \"\"\"Makes a crashes dir in |parent_path| and returns it.\"\"\"\ncrashes_dir = os.path.join(str(parent_path), 'crashes')\nos.mkdir(crashes_dir)\nreturn crashes_dir\ndef _make_sancov_dir(parent_path):\n- \"\"\"Makes a sancov dir in |tmp_path| and returns it.\"\"\"\n+ \"\"\"Makes a sancov dir in |parent_path| and returns it.\"\"\"\nsancov_dir = os.path.join(str(parent_path), 'sancov')\nos.mkdir(sancov_dir)\nreturn sancov_dir\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_runner.py",
"new_path": "experiment/test_runner.py",
"diff": "@@ -298,10 +298,10 @@ class TestIntegrationRunner:\nmocked_error.assert_not_called()\n-def test_clean_seed_corpus(tmp_path, fs):\n+def test_clean_seed_corpus(fs):\n\"\"\"Test that seed corpus files are moved to root directory and deletes files\nexceeding 1 MB limit.\"\"\"\n- seed_corpus_dir = tmp_path / 'seeds'\n+ seed_corpus_dir = '/seeds'\nfs.create_dir(seed_corpus_dir)\nfs.create_file(os.path.join(seed_corpus_dir, 'a', 'abc'), contents='abc')\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Dont run test_measure_snapshot_coverage by default (#309)
Don't run test_measure_snapshot_coverage by default
The test relies on a binary that may not run on everyone's machine.
Run it in CI though.
Also, avoid using tmp_path with fakefs. Change the experiment
fixture to not use tmp_path. Combining the two causes weird errors. |
258,388 | 07.05.2020 12:10:00 | 25,200 | 06a16cdacf9031d2045d11d15687ff043794b97a | Don't start trials for failed builds
Don't start trials for failed builds and skip builds we know fail
Don't start a trial (or save it to the db) for a fuzzer-benchmark
if the build failed (not counting builds that fail but succeed on a
retry). | [
{
"change_type": "MODIFY",
"old_path": "experiment/build/builder.py",
"new_path": "experiment/build/builder.py",
"diff": "@@ -68,15 +68,16 @@ def build_measurer(benchmark: str) -> bool:\ndef build_all_measurers(benchmarks: List[str]) -> List[str]:\n- \"\"\"Build measurers for benchmarks.\"\"\"\n+ \"\"\"Build measurers for each benchmark in |benchmarks| in parallel\n+ Returns a list of benchmarks built successfully.\"\"\"\nlogger.info('Building measurers.')\nfilesystem.recreate_directory(build_utils.get_coverage_binaries_dir())\n- benchmarks = [(benchmark,) for benchmark in benchmarks]\n- results = retry_build_loop(build_measurer, benchmarks)\n+ build_measurer_args = [(benchmark,) for benchmark in benchmarks]\n+ successful_calls = retry_build_loop(build_measurer, build_measurer_args)\nlogger.info('Done building measurers.')\n# Return list of benchmarks (like the list we were passed as an argument)\n# instead of returning a list of tuples each containing a benchmark.\n- return [result[0] for result in results]\n+ return [successful_call[0] for successful_call in successful_calls]\ndef split_successes_and_failures(inputs: List,\n@@ -96,8 +97,9 @@ def split_successes_and_failures(inputs: List,\ndef retry_build_loop(build_func: Callable, inputs: List[Tuple]) -> List:\n- \"\"\"Call |build_func| concurrently on |inputs|. Repeat on failures up to\n- |NUM_BUILD_RETRIES| times.\"\"\"\n+ \"\"\"Calls |build_func| in parallel on |inputs|. Repeat on failures up to\n+ |NUM_BUILD_RETRIES| times. Returns the list of inputs that |build_func| was\n+ called successfully on.\"\"\"\nsuccesses = []\nwith mp_pool.ThreadPool(MAX_CONCURRENT_BUILDS) as pool:\nfor _ in range(NUM_BUILD_RETRIES):\n@@ -122,7 +124,8 @@ def retry_build_loop(build_func: Callable, inputs: List[Tuple]) -> List:\ndef build_fuzzer_benchmark(fuzzer: str, benchmark: str) -> bool:\n\"\"\"Wrapper around buildlib.build_fuzzer_benchmark that logs and catches\n- exceptions.\"\"\"\n+ exceptions. buildlib.build_fuzzer_benchmark builds an image for |fuzzer|\n+ to fuzz |benchmark|.\"\"\"\nlogger.info('Building benchmark: %s, fuzzer: %s.', benchmark, fuzzer)\ntry:\nbuildlib.build_fuzzer_benchmark(fuzzer, benchmark)\n@@ -136,15 +139,17 @@ def build_fuzzer_benchmark(fuzzer: str, benchmark: str) -> bool:\ndef build_all_fuzzer_benchmarks(fuzzers: List[str],\nbenchmarks: List[str]) -> List[str]:\n- \"\"\"Call buildlib.build_fuzzer_benchmark on each fuzzer,benchmark pair\n- concurrently.\"\"\"\n+ \"\"\"Build fuzzer,benchmark images for all pairs of |fuzzers| and |benchmarks|\n+ in parallel. Returns a list of fuzzer,benchmark pairs that built\n+ successfully.\"\"\"\nlogger.info('Building all fuzzer benchmarks.')\n- product = list(itertools.product(fuzzers, benchmarks))\n+ build_fuzzer_benchmark_args = list(itertools.product(fuzzers, benchmarks))\n# TODO(metzman): Use an asynchronous unordered map variant to schedule\n# eagerly.\n- results = retry_build_loop(build_fuzzer_benchmark, product)\n+ successful_calls = retry_build_loop(build_fuzzer_benchmark,\n+ build_fuzzer_benchmark_args)\nlogger.info('Done building fuzzer benchmarks.')\n- return results\n+ return successful_calls\ndef main():\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/dispatcher.py",
"new_path": "experiment/dispatcher.py",
"diff": "configuration, spawns a runner VM for each benchmark-fuzzer combo, and then\nrecords coverage data received from the runner VMs.\"\"\"\n-import itertools\nimport multiprocessing\nimport os\nimport posixpath\n@@ -48,8 +47,7 @@ def create_work_subdirs(subdirs: List[str]):\ndef _initialize_experiment_in_db(experiment: str, git_hash: str,\n- benchmarks: List[str], fuzzers: List[str],\n- num_trials: int):\n+ trials: List[models.Trial]):\n\"\"\"Initializes |experiment| in the database by creating the experiment\nentity and entities for each trial in the experiment.\"\"\"\ndb_utils.add_all([\n@@ -58,12 +56,6 @@ def _initialize_experiment_in_db(experiment: str, git_hash: str,\ngit_hash=git_hash)\n])\n- trials_args = itertools.product(sorted(benchmarks), range(num_trials),\n- sorted(fuzzers))\n- trials = [\n- models.Trial(fuzzer=fuzzer, experiment=experiment, benchmark=benchmark)\n- for benchmark, _, fuzzer in trials_args\n- ]\n# TODO(metzman): Consider doing this without sqlalchemy. This can get\n# slow with SQLalchemy (it's much worse with add_all).\ndb_utils.bulk_save(trials)\n@@ -75,22 +67,44 @@ class Experiment:\ndef __init__(self, experiment_config_filepath: str):\nself.config = yaml_utils.read(experiment_config_filepath)\n- benchmarks = self.config['benchmarks'].split(',')\n- self.benchmarks = builder.build_all_measurers(benchmarks)\n+ self.benchmarks = self.config['benchmarks'].split(',')\nself.fuzzers = [\nfuzzer_config_utils.get_fuzzer_name(filename) for filename in\nos.listdir(fuzzer_config_utils.get_fuzzer_configs_dir())\n]\n-\n- _initialize_experiment_in_db(self.config['experiment'],\n- self.config['git_hash'], self.benchmarks,\n- self.fuzzers, self.config['trials'])\n+ self.num_trials = self.config['trials']\n+ self.experiment_name = self.config['experiment']\n+ self.git_hash = self.config['git_hash']\nself.web_bucket = posixpath.join(self.config['cloud_web_bucket'],\nexperiment_utils.get_experiment_name())\n+def build_images_for_trials(fuzzers: List[str], benchmarks: List[str],\n+ num_trials: int) -> List[models.Trial]:\n+ \"\"\"Builds the images needed to run |experiment| and returns a list of trials\n+ that can be run for experiment. This is the number of trials specified in\n+ experiment times each pair of fuzzer+benchmark that builds successfully.\"\"\"\n+ # This call will raise an exception if the images can't be built which will\n+ # halt the experiment.\n+ builder.build_base_images()\n+\n+ # Only build fuzzers for benchmarks whose measurers built successfully.\n+ benchmarks = builder.build_all_measurers(benchmarks)\n+ build_successes = builder.build_all_fuzzer_benchmarks(fuzzers, benchmarks)\n+ experiment_name = experiment_utils.get_experiment_name()\n+ trials = []\n+ for fuzzer, benchmark in build_successes:\n+ fuzzer_benchmark_trials = [\n+ models.Trial(fuzzer=fuzzer,\n+ experiment=experiment_name,\n+ benchmark=benchmark) for _ in range(num_trials)\n+ ]\n+ trials.extend(fuzzer_benchmark_trials)\n+ return trials\n+\n+\ndef dispatcher_main():\n\"\"\"Do the experiment and report results.\"\"\"\nlogs.info('Starting experiment.')\n@@ -102,13 +116,13 @@ def dispatcher_main():\nif os.getenv('LOCAL_EXPERIMENT'):\nmodels.Base.metadata.create_all(db_utils.engine)\n- builder.build_base_images()\n-\nexperiment_config_file_path = os.path.join(fuzzer_config_utils.get_dir(),\n'experiment.yaml')\nexperiment = Experiment(experiment_config_file_path)\n- builder.build_all_fuzzer_benchmarks(experiment.fuzzers,\n- experiment.benchmarks)\n+ trials = build_images_for_trials(experiment.fuzzers, experiment.benchmarks,\n+ experiment.num_trials)\n+ _initialize_experiment_in_db(experiment.experiment_name,\n+ experiment.git_hash, trials)\ncreate_work_subdirs(['experiment-folders', 'measurement-folders'])\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_dispatcher.py",
"new_path": "experiment/test_dispatcher.py",
"diff": "# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"Tests for dispatcher.py.\"\"\"\n+import itertools\nimport os\nfrom unittest import mock\n@@ -27,7 +28,7 @@ from test_libs import utils as test_utils\nTEST_DATA_PATH = os.path.join(os.path.dirname(__file__), 'test_data')\nSANCOV_DIR = '/sancov'\n-# pylint: disable=invalid-name,redefined-outer-name,unused-argument\n+# pylint: disable=invalid-name,redefined-outer-name,unused-argument,protected-access\ndef get_test_data_path(*subpaths):\n@@ -51,6 +52,7 @@ def mock_split_successes_and_failures(inputs, results):\nmock_split_successes_and_failures)\ndef dispatcher_experiment(fs, db, experiment):\n\"\"\"Creates a dispatcher.Experiment object.\"\"\"\n+ fs.create_dir(os.environ['WORK'])\nexperiment_config_filepath = get_test_data_path('experiment-config.yaml')\nfs.add_real_file(experiment_config_filepath)\nfor fuzzer in FUZZERS:\n@@ -67,6 +69,23 @@ def test_experiment(dispatcher_experiment):\nassert dispatcher_experiment.fuzzers == FUZZERS\nassert (\ndispatcher_experiment.web_bucket == 'gs://web-reports/test-experiment')\n+\n+\n+def test_initialize_experiment_in_db(dispatcher_experiment):\n+ \"\"\"Tests that _initialize_experiment_in_db adds the right things to the\n+ database.\"\"\"\n+ trials_args = itertools.product(dispatcher_experiment.benchmarks,\n+ range(dispatcher_experiment.num_trials),\n+ dispatcher_experiment.fuzzers)\n+ trials = [\n+ models.Trial(fuzzer=fuzzer,\n+ experiment=dispatcher_experiment.experiment_name,\n+ benchmark=benchmark)\n+ for benchmark, _, fuzzer in trials_args\n+ ]\n+ dispatcher._initialize_experiment_in_db(\n+ dispatcher_experiment.experiment_name, dispatcher_experiment.git_hash,\n+ trials)\ndb_experiments = db_utils.query(models.Experiment).all()\nassert len(db_experiments) == 1\ndb_experiment = db_experiments[0]\n@@ -78,3 +97,105 @@ def test_experiment(dispatcher_experiment):\n('benchmark-1', 'fuzzer-b')] *\n4) + [('benchmark-2', 'fuzzer-a'),\n('benchmark-2', 'fuzzer-b')] * 4\n+\n+\n+@mock.patch('experiment.build.builder.build_base_images', side_effect=Exception)\n+def test_build_images_for_trials_base_images_fail(dispatcher_experiment):\n+ \"\"\"Tests that build_for_trial raises an exception when base images can't be\n+ built. This is important because the experiment should not proceed.\"\"\"\n+ with pytest.raises(Exception):\n+ dispatcher.build_images_for_trials(dispatcher_experiment.fuzzers,\n+ dispatcher_experiment.benchmarks,\n+ dispatcher_experiment.num_trials)\n+\n+\n+@mock.patch('experiment.build.builder.build_base_images')\n+def test_build_images_for_trials_build_success(_, dispatcher_experiment):\n+ \"\"\"Tests that build_for_trial returns all trials we expect to run in an\n+ experiment when builds are successful.\"\"\"\n+ fuzzer_benchmarks = list(\n+ itertools.product(dispatcher_experiment.fuzzers,\n+ dispatcher_experiment.benchmarks))\n+ with mock.patch('experiment.build.builder.build_all_measurers',\n+ return_value=dispatcher_experiment.benchmarks):\n+ with mock.patch('experiment.build.builder.build_all_fuzzer_benchmarks',\n+ return_value=fuzzer_benchmarks):\n+ trials = dispatcher.build_images_for_trials(\n+ dispatcher_experiment.fuzzers, dispatcher_experiment.benchmarks,\n+ dispatcher_experiment.num_trials)\n+ trial_fuzzer_benchmarks = [\n+ (trial.fuzzer, trial.benchmark) for trial in trials\n+ ]\n+ expected_trial_fuzzer_benchmarks = [\n+ fuzzer_benchmark for fuzzer_benchmark in fuzzer_benchmarks\n+ for _ in range(dispatcher_experiment.num_trials)\n+ ]\n+ assert (sorted(expected_trial_fuzzer_benchmarks) == sorted(\n+ trial_fuzzer_benchmarks))\n+\n+\n+@mock.patch('experiment.build.builder.build_base_images')\n+def test_build_images_for_trials_benchmark_fail(_, dispatcher_experiment):\n+ \"\"\"Tests that build_for_trial doesn't return trials or try to build fuzzers\n+ for a benchmark whose coverage build failed.\"\"\"\n+ successful_benchmark = 'benchmark-1'\n+\n+ def mocked_build_all_fuzzer_benchmarks(fuzzers, benchmarks):\n+ assert benchmarks == [successful_benchmark]\n+ return list(itertools.product(fuzzers, benchmarks))\n+\n+ with mock.patch('experiment.build.builder.build_all_measurers',\n+ return_value=[successful_benchmark]):\n+ with mock.patch('experiment.build.builder.build_all_fuzzer_benchmarks',\n+ side_effect=mocked_build_all_fuzzer_benchmarks):\n+ # Sanity check this test so that we know we are actually testing\n+ # behavior when benchmarks fail.\n+ assert len(set(dispatcher_experiment.benchmarks)) > 1\n+ trials = dispatcher.build_images_for_trials(\n+ dispatcher_experiment.fuzzers, dispatcher_experiment.benchmarks,\n+ dispatcher_experiment.num_trials)\n+ for trial in trials:\n+ assert trial.benchmark == successful_benchmark\n+\n+\n+@mock.patch('experiment.build.builder.build_base_images')\n+def test_build_images_for_trials_fuzzer_fail(_, dispatcher_experiment):\n+ \"\"\"Tests that build_for_trial doesn't return trials a fuzzer whose build\n+ failed on a benchmark.\"\"\"\n+ successful_fuzzer = 'fuzzer-a'\n+ fail_fuzzer = 'fuzzer-b'\n+ fuzzers = [successful_fuzzer, fail_fuzzer]\n+ successful_benchmark_for_fail_fuzzer = 'benchmark-1'\n+ fail_benchmark_for_fail_fuzzer = 'benchmark-2'\n+ benchmarks = [\n+ successful_benchmark_for_fail_fuzzer, fail_benchmark_for_fail_fuzzer\n+ ]\n+ successful_builds = [(successful_fuzzer, fail_benchmark_for_fail_fuzzer),\n+ (successful_fuzzer,\n+ successful_benchmark_for_fail_fuzzer),\n+ (fail_fuzzer, successful_benchmark_for_fail_fuzzer)]\n+ num_trials = 10\n+\n+ def mocked_build_all_fuzzer_benchmarks(fuzzers, benchmarks):\n+ # Sanity check this test so that we know we are actually testing\n+ # behavior when fuzzers fail.\n+ assert sorted(fuzzers) == sorted([successful_fuzzer, fail_fuzzer])\n+ assert successful_benchmark_for_fail_fuzzer in benchmarks\n+ return successful_builds\n+\n+ with mock.patch('experiment.build.builder.build_all_measurers',\n+ return_value=benchmarks):\n+ with mock.patch('experiment.build.builder.build_all_fuzzer_benchmarks',\n+ side_effect=mocked_build_all_fuzzer_benchmarks):\n+ trials = dispatcher.build_images_for_trials(fuzzers, benchmarks,\n+ num_trials)\n+\n+ trial_fuzzer_benchmarks = [\n+ (trial.fuzzer, trial.benchmark) for trial in trials\n+ ]\n+ expected_trial_fuzzer_benchmarks = [\n+ fuzzer_benchmark for fuzzer_benchmark in successful_builds\n+ for _ in range(num_trials)\n+ ]\n+ assert (sorted(expected_trial_fuzzer_benchmarks) == sorted(\n+ trial_fuzzer_benchmarks))\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Don't start trials for failed builds (#307)
Don't start trials for failed builds and skip builds we know fail
Don't start a trial (or save it to the db) for a fuzzer-benchmark
if the build failed (not counting builds that fail but succeed on a
retry). |
258,388 | 08.05.2020 09:06:41 | 25,200 | 44fad335cf5d0161f20f4f4f31a2ccb65d45443f | Fix regex excluding OSS-Fuzz project builds
Fix regex excluding OSS-Fuzz project builds | [
{
"change_type": "MODIFY",
"old_path": "experiment/run_experiment.py",
"new_path": "experiment/run_experiment.py",
"diff": "@@ -260,7 +260,7 @@ def copy_resources_to_bucket(config_dir: str, config: Dict):\noptions = [\n'-x',\n('^\\\\.git/|^\\\\.pytype/|^\\\\.venv/|^.*\\\\.pyc$|^__pycache__/'\n- '|.*~$|\\\\.pytest_cache/|.*/test_data/|^third_party/oss-fuzz/out/'\n+ '|.*~$|\\\\.pytest_cache/|.*/test_data/|^third_party/oss-fuzz/build/'\n'|^docs/')\n]\ndestination = os.path.join(base_destination, 'src')\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_run_experiment.py",
"new_path": "experiment/test_run_experiment.py",
"diff": "@@ -216,7 +216,7 @@ def test_copy_resources_to_bucket():\n'-x',\n('^\\\\.git/|^\\\\.pytype/|^\\\\.venv/|^.*\\\\.pyc$|^__pycache__/|'\n'.*~$|\\\\.pytest_cache/|.*/test_data/|'\n- '^third_party/oss-fuzz/out/|^docs/')\n+ '^third_party/oss-fuzz/build/|^docs/')\n],\nparallel=True)\nmocked_rsync.assert_any_call(\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix regex excluding OSS-Fuzz project builds (#314)
Fix regex excluding OSS-Fuzz project builds |
258,388 | 14.05.2020 09:45:01 | 25,200 | fe3b005a6d89df7557faa91753d4d957c70a4d9d | Add instructions on testing new benchmarks in CI to docs. | [
{
"change_type": "MODIFY",
"old_path": "docs/developing-fuzzbench/adding_a_new_benchmark.md",
"new_path": "docs/developing-fuzzbench/adding_a_new_benchmark.md",
"diff": "@@ -126,5 +126,11 @@ make build-$FUZZER_NAME-$BENCHMARK_NAME\nmake run-$FUZZER_NAME-$BENCHMARK_NAME\n```\n+## Testing the benchmark in CI\n+\n+Add your benchmark to the `STANDARD_BENCHMARKS` list in\n+[test_fuzzer_benchmarks.py](https://github.com/google/fuzzbench/blob/master/.github/workflows/test_fuzzer_benchmarks.py)\n+so that it will be tested in CI.\n+\nIf everything works, submit the integration in a\n[GitHub pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Add instructions on testing new benchmarks in CI to docs. (#335) |
258,388 | 14.05.2020 14:33:38 | 25,200 | 056f224685a3682e9bbb04b2a927e82dc7a82274 | [builder] Raise GCB timeout to 4 hours | [
{
"change_type": "MODIFY",
"old_path": "experiment/build/gcb_build.py",
"new_path": "experiment/build/gcb_build.py",
"diff": "@@ -35,7 +35,7 @@ BUILDER_STEP_IDS = [\nCONFIG_DIR = 'config'\n# Maximum time to wait for a GCB config to finish build.\n-GCB_BUILD_TIMEOUT = 2 * 60 * 60 # 2 hours.\n+GCB_BUILD_TIMEOUT = 4 * 60 * 60 # 4 hours.\n# High cpu configuration for faster builds.\nGCB_MACHINE_TYPE = 'n1-highcpu-8'\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [builder] Raise GCB timeout to 4 hours (#340) |
258,388 | 18.05.2020 16:49:57 | 25,200 | f387ba05de20e0762a6f8ed34900c7cc7c609117 | [presubmit] Add options for verbose logging and running on all files. | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -2,7 +2,7 @@ name: Build fuzzers\non:\npull_request:\npaths:\n- - 'docker/**' # Base images changes.\n+ - 'docker/**' # Base image changes.\n- 'fuzzers/**' # Changes to fuzzers themselves.\n- 'benchmarks/**' # Changes to benchmarks.\n- 'src_analysis/**' # Changes that affect what gets built.\n"
},
{
"change_type": "MODIFY",
"old_path": "common/filesystem.py",
"new_path": "common/filesystem.py",
"diff": "@@ -25,6 +25,8 @@ def create_directory(directory):\ndef is_subpath(path, possible_subpath):\n\"\"\"Returns True if |possible_subpath| is a subpath of |path|.\"\"\"\n+ path = str(path)\n+ possible_subpath = str(possible_subpath)\ncommon_path = os.path.commonpath([path, possible_subpath])\nreturn common_path == path\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/lafintel/fuzzer.py",
"new_path": "fuzzers/lafintel/fuzzer.py",
"diff": "@@ -20,6 +20,7 @@ from fuzzers import utils\nfrom fuzzers.afl import fuzzer as afl_fuzzer\n+\ndef prepare_build_environment():\n\"\"\"Set environment variables used to build benchmark.\"\"\"\n# In php benchmark, there is a call to __builtin_cpu_supports(\"ssse3\")\n"
},
{
"change_type": "MODIFY",
"old_path": "presubmit.py",
"new_path": "presubmit.py",
"diff": "\"\"\"Presubmit script for fuzzbench.\"\"\"\nimport argparse\n+import logging\nimport os\nfrom pathlib import Path\nimport subprocess\n@@ -22,8 +23,9 @@ import sys\nfrom typing import List, Optional\nfrom common import benchmark_utils\n-from common import logs\nfrom common import fuzzer_utils\n+from common import filesystem\n+from common import logs\nfrom src_analysis import change_utils\nfrom src_analysis import diff_utils\n@@ -42,12 +44,13 @@ _LICENSE_CHECK_EXTENSIONS = [\n'.py',\n'.sh',\n]\n-_LICENSE_CHECK_IGNORE_DIRECTORIES = [\n- 'alembic',\n- 'third_party',\n-]\n_LICENSE_CHECK_STRING = 'http://www.apache.org/licenses/LICENSE-2.0'\n+\n_SRC_ROOT = Path(__file__).absolute().parent\n+_IGNORE_DIRECTORIES = [\n+ os.path.join(_SRC_ROOT, 'database', 'alembic'),\n+ os.path.join(_SRC_ROOT, 'third_party'),\n+]\nBASE_PYTEST_COMMAND = ['python3', '-m', 'pytest', '-vv']\n@@ -126,12 +129,12 @@ class FuzzerAndBenchmarkValidator:\nprint(benchmark, 'is not valid.')\nreturn False\n- def validate(self, changed_file: Path) -> bool:\n- \"\"\"If |changed_file| is in an invalid fuzzer or benchmark then return\n+ def validate(self, file_path: Path) -> bool:\n+ \"\"\"If |file_path| is in an invalid fuzzer or benchmark then return\nFalse. If the fuzzer or benchmark is not in |self.invalid_dirs|, then\nprint an error message and it to |self.invalid_dirs|.\"\"\"\n- return (self.validate_fuzzer(changed_file) and\n- self.validate_benchmark(changed_file))\n+ return (self.validate_fuzzer(file_path) and\n+ self.validate_benchmark(file_path))\ndef is_python(path: Path) -> bool:\n@@ -227,6 +230,14 @@ def yapf(paths: List[Path], validate: bool = True) -> bool:\nreturn returncode == 0\n+def is_path_in_ignore_directory(path: Path) -> bool:\n+ \"\"\"Returns True if |path| is a subpath of an ignored directory.\"\"\"\n+ for ignore_directory in _IGNORE_DIRECTORIES:\n+ if filesystem.is_subpath(ignore_directory, path):\n+ return True\n+ return False\n+\n+\ndef license_check(paths: List[Path]) -> bool:\n\"\"\"Validate license header.\"\"\"\nif not paths:\n@@ -240,9 +251,7 @@ def license_check(paths: List[Path]) -> bool:\nextension not in _LICENSE_CHECK_EXTENSIONS):\ncontinue\n- path_directories = str(path).split(os.sep)\n- if any(d in _LICENSE_CHECK_IGNORE_DIRECTORIES\n- for d in path_directories):\n+ if is_path_in_ignore_directory(path):\ncontinue\nwith open(path) as file_handle:\n@@ -253,25 +262,39 @@ def license_check(paths: List[Path]) -> bool:\nreturn success\n+def get_all_files() -> List[Path]:\n+ \"\"\"Returns a list of absolute paths of files in this repo.\"\"\"\n+ get_all_files_command = ['git', 'ls-files']\n+ output = subprocess.check_output(\n+ get_all_files_command).decode().splitlines()\n+ return [Path(path).absolute() for path in output if Path(path).is_file()]\n+\n+\n+def filter_ignored_files(paths: List[Path]) -> List[Path]:\n+ \"\"\"Returns a list of absolute paths of files in this repo that can be\n+ checked statically.\"\"\"\n+ return [path for path in paths if not is_path_in_ignore_directory(path)]\n+\n+\ndef do_tests() -> bool:\n\"\"\"Run all unittests.\"\"\"\nreturncode = subprocess.run(BASE_PYTEST_COMMAND, check=False).returncode\nreturn returncode == 0\n-def do_checks(changed_files: List[Path]) -> bool:\n+def do_checks(file_paths: List[Path]) -> bool:\n\"\"\"Return False if any presubmit check fails.\"\"\"\nsuccess = True\nfuzzer_and_benchmark_validator = FuzzerAndBenchmarkValidator()\n- if not all([\n- fuzzer_and_benchmark_validator.validate(path)\n- for path in changed_files\n- ]):\n+ path_valid_statuses = [\n+ fuzzer_and_benchmark_validator.validate(path) for path in file_paths\n+ ]\n+ if not all(path_valid_statuses):\nsuccess = False\nfor check in [license_check, yapf, lint, pytype]:\n- if not check(changed_files):\n+ if not check(file_paths):\nprint('ERROR: %s failed, see errors above.' % check.__name__)\nsuccess = False\n@@ -293,21 +316,44 @@ def bool_to_returncode(success: bool) -> int:\ndef main() -> int:\n\"\"\"Check that this branch conforms to the standards of fuzzbench.\"\"\"\n- logs.initialize()\nparser = argparse.ArgumentParser(\ndescription='Presubmit script for fuzzbench.')\nchoices = [\n'format', 'lint', 'typecheck', 'licensecheck',\n'test_changed_integrations'\n]\n- parser.add_argument('command', choices=choices, nargs='?')\n+ parser.add_argument(\n+ 'command',\n+ choices=choices,\n+ nargs='?',\n+ help='The presubmit check to run. Defaults to all of them')\n+ parser.add_argument('--all-files',\n+ action='store_true',\n+ help='Run presubmit check(s) on all files',\n+ default=False)\n+ parser.add_argument('-v', '--verbose', action='store_true', default=False)\nargs = parser.parse_args()\n+\nos.chdir(_SRC_ROOT)\n- changed_files = [Path(path) for path in diff_utils.get_changed_files()]\n+\n+ if not args.verbose:\n+ logs.initialize()\n+ else:\n+ logs.initialize(log_level=logging.DEBUG)\n+\n+ if not args.all_files:\n+ relevant_files = [Path(path) for path in diff_utils.get_changed_files()]\n+ else:\n+ relevant_files = get_all_files()\n+\n+ relevant_files = filter_ignored_files(relevant_files)\n+\n+ logs.debug('Running presubmit check(s) on: %s',\n+ ' '.join(str(path) for path in relevant_files))\nif not args.command:\n- success = do_checks(changed_files)\n+ success = do_checks(relevant_files)\nreturn bool_to_returncode(success)\ncommand_check_mapping = {\n@@ -319,9 +365,9 @@ def main() -> int:\ncheck = command_check_mapping[args.command]\nif args.command == 'format':\n- success = check(changed_files, False)\n+ success = check(relevant_files, False)\nelse:\n- success = check(changed_files)\n+ success = check(relevant_files)\nif not success:\nprint('ERROR: %s failed, see errors above.' % check.__name__)\nreturn bool_to_returncode(success)\n"
},
{
"change_type": "MODIFY",
"old_path": "third_party/sancov.py",
"new_path": "third_party/sancov.py",
"diff": "# either print them (as hex) or dump them into another file.\n# Local modifications:\n-# - PrintFiles -> GetPCs function that yields PCs instead of printing them.\n+# - PrintFiles Replace with GetPCs function that yields PCs instead of printing\n+# them. GetPCs isn't available from the command line.\n# - ReadOneFile, Merge -> remove prints to stderr.\nimport array\n@@ -245,9 +246,7 @@ if __name__ == '__main__':\nif not file_list:\nUsage()\n- if sys.argv[1] == \"print\":\n- PrintFiles(file_list)\n- elif sys.argv[1] == \"merge\":\n+ if sys.argv[1] == \"merge\":\nMergeAndPrint(file_list)\nelif sys.argv[1] == \"unpack\":\nUnpack(file_list)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [presubmit] Add options for verbose logging and running on all files. (#344) |
258,388 | 19.05.2020 21:57:09 | 25,200 | 49958597046f65aaec02148f0ba50594fc65c3d4 | [run_experiment] Only permit selecting fuzzers in the repo. | [
{
"change_type": "MODIFY",
"old_path": "experiment/run_experiment.py",
"new_path": "experiment/run_experiment.py",
"diff": "@@ -466,6 +466,7 @@ def main():\n'more benchmarks.')\nall_benchmarks = benchmark_utils.get_all_benchmarks()\n+ all_fuzzers = fuzzer_utils.get_fuzzer_names()\nparser.add_argument('-b',\n'--benchmarks',\n@@ -488,7 +489,8 @@ def main():\nhelp='Fuzzers to use.',\nnargs='+',\nrequired=False,\n- default=None)\n+ default=None,\n+ choices=all_fuzzers)\nfuzzers_group.add_argument('-fc',\n'--fuzzer-configs',\nhelp='Fuzzer configurations to use.',\n@@ -520,7 +522,7 @@ def main():\nreturn 1\nelse:\nfuzzers = args.fuzzers\n- fuzzer_configs = fuzzer_utils.get_fuzzer_configs(fuzzers=fuzzers)\n+ fuzzer_configs = fuzzer_utils.get_fuzzer_configs(fuzzers)\nstart_experiment(args.experiment_name, args.experiment_config,\nargs.benchmarks, fuzzer_configs)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [run_experiment] Only permit selecting fuzzers in the repo. (#359) |
258,399 | 21.05.2020 02:39:52 | 0 | 54f7364fd1525663d5d9c14dacdf006836c126b4 | [doc] test-run | [
{
"change_type": "MODIFY",
"old_path": "docs/getting-started/adding_a_new_fuzzer.md",
"new_path": "docs/getting-started/adding_a_new_fuzzer.md",
"diff": "@@ -237,6 +237,12 @@ make build-$FUZZER_NAME-$BENCHMARK_NAME\nmake run-$FUZZER_NAME-$BENCHMARK_NAME\n```\n+* Or use a quicker test run mode:\n+\n+```shell\n+make test-run-$FUZZER_NAME-$BENCHMARK_NAME\n+```\n+\n* Building all benchmarks for a fuzzer:\n```shell\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [doc] test-run (#363) |
258,388 | 26.05.2020 12:19:00 | 25,200 | 8028c6ae16f331310d39340f3400610b9bf6f473 | Add pull-clang as depdendency of base-builder.
Otherwise, a stale clang might be used that is different from the one
used in CI and in experiments. | [
{
"change_type": "MODIFY",
"old_path": "docker/build.mk",
"new_path": "docker/build.mk",
"diff": "@@ -39,16 +39,16 @@ base-image:\npull-base-image:\ndocker pull $(BASE_TAG)/base-image\n-base-builder: base-image\n+pull-base-clang:\n+ docker pull gcr.io/oss-fuzz-base/base-clang\n+\n+base-builder: base-image pull-base-clang\ndocker build \\\n--tag $(BASE_TAG)/base-builder \\\n$(call cache_from_base,${BASE_TAG}/base-builder) \\\n$(call cache_from_base,gcr.io/oss-fuzz-base/base-clang) \\\ndocker/base-builder\n-pull-base-clang:\n- docker pull gcr.io/oss-fuzz-base/base-clang\n-\npull-base-builder: pull-base-image pull-base-clang\ndocker pull $(BASE_TAG)/base-builder\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Add pull-clang as depdendency of base-builder. (#371)
Otherwise, a stale clang might be used that is different from the one
used in CI and in experiments. |
258,388 | 26.05.2020 12:21:35 | 25,200 | ec2f795a7302cd956c27b339b6d27764ab8068aa | Create an image for the measurer's worker and add steps to build it.
Create an image for the measurer's worker and add steps to build it.
Also:
Add .dockerignore
Add some more files to .gitignore
Remove some unneeded patterns from .gitignore. | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".dockerignore",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+# Mostly copied from gitignore.\n+\n+# Byte-compiled / optimized / DLL files.\n+__pycache__/\n+*.py[cod]\n+*$py.class\n+\n+.pytype/\n+\n+# Virtualenv.\n+.venv\n+\n+# Reports generated by FuzzBench.\n+report/\n+\n+# Emacs backup files.\n+*~\n+\\#*\\#\n+\n+# TODO(metzman): Put main code in subdirectories of src/ so that we don't need\n+# to enumerate useless directories.\n+docs/\n"
},
{
"change_type": "MODIFY",
"old_path": ".gitignore",
"new_path": ".gitignore",
"diff": "@@ -19,12 +19,8 @@ __pycache__/\n.pytype/\n-# Virtual environments.\n-.env\n+# Virtualenv.\n.venv\n-env/\n-venv/\n-ENV/\n# Reports generated by FuzzBench.\nreport/\n@@ -33,3 +29,7 @@ report/\n.bundle/\ndocs/_site/\ndocs/vendor/\n+\n+# Emacs backup files.\n+*~\n+\\#*\\#\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "docker/build.mk",
"new_path": "docker/build.mk",
"diff": "@@ -68,6 +68,15 @@ dispatcher-image: base-image\n$(call cache_from,${BASE_TAG}/dispatcher-image) \\\ndocker/dispatcher-image\n+measure-worker: base-runner\n+ docker build \\\n+ --tag $(BASE_TAG)/measure-worker \\\n+ $(call cache_from_base,${BASE_TAG}/measure-worker) \\\n+ --file docker/measure-worker/Dockerfile \\\n+ .\n+\n+pull-measure-worker: pull-measure-worker\n+ docker pull $(BASE_TAG)/measure-worker\ndefine fuzzer_template\n"
},
{
"change_type": "MODIFY",
"old_path": "docker/gcb/base-images.yaml",
"new_path": "docker/gcb/base-images.yaml",
"diff": "@@ -109,7 +109,38 @@ steps:\n# Wait for pull and building base-image to finish.\nwait_for: ['base-image', 'base-runner-pull']\n+\n+# Pull base-runner to fill cache.\n+- name: 'gcr.io/cloud-builders/docker'\n+ entrypoint: 'bash'\n+ args:\n+ - '-c'\n+ - |\n+ docker pull ${_REPO}/measure-worker || exit 0\n+ id: 'measure-worker-pull'\n+ wait_for: ['-'] # Start this immediately.\n+\n+- name: 'gcr.io/cloud-builders/docker'\n+ args: [\n+ 'build',\n+\n+ '--tag',\n+ 'gcr.io/fuzzbench/measure-worker',\n+\n+ '--tag',\n+ '${_REPO}/measure-worker',\n+\n+ '--cache-from',\n+ '${_REPO}/measure-worker',\n+\n+ '.'\n+ ]\n+ # Wait for pull and building base-image to finish.\n+ wait_for: ['base-runner', 'measure-worker-pull']\n+\n+\nimages:\n- '${_REPO}/base-image'\n- '${_REPO}/base-builder'\n- '${_REPO}/base-runner'\n+ - '${_REPO}/measure-worker'\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "docker/measure-worker/Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+FROM gcr.io/fuzzbench/base-runner\n+\n+ENV WORK /work\n+WORKDIR $WORK\n+\n+ENV VIRTUALENV_DIR $WORK/.venv\n+\n+RUN mkdir -p /work && virtualenv --python=$(which python3) $VIRTUALENV_DIR\n+\n+ENV SRC $WORK/src\n+\n+# Copy requirements.txt and install dependencies before copying all of the\n+# source code so the cache hits more often.\n+COPY requirements.txt $SRC/\n+ENV PYTHONPATH=$SRC\n+RUN /bin/bash -c \"source $VIRTUALENV_DIR/bin/activate && \\\n+ pip3 install -r $SRC/requirements.txt\"\n+\n+ADD . $SRC/\n+\n+ENTRYPOINT /bin/bash $SRC/docker/measure-worker/startup-worker.sh\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "docker/measure-worker/startup-worker.sh",
"diff": "+#! /bin/bash\n+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+source $VIRTUALENV_DIR/bin/activate\n+rq worker --url redis://$REDIS_HOST:6379\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Create an image for the measurer's worker and add steps to build it. (#372)
Create an image for the measurer's worker and add steps to build it.
Also:
Add .dockerignore
Add some more files to .gitignore
Remove some unneeded patterns from .gitignore. |
258,399 | 26.05.2020 22:21:19 | 0 | 0ad99c056eeaef1fdc6ebf534b5d89ed23558659 | [Ankou] Initial fuzzer integration | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -20,6 +20,7 @@ jobs:\n- aflplusplus_optimal\n- aflplusplus_shmem\n- aflsmart\n+ - ankou\n- eclipser\n- entropic\n- fairfuzz\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/_data/fuzzers.yaml",
"new_path": "docs/_data/fuzzers.yaml",
"diff": "@@ -57,7 +57,7 @@ Fuzzers:\nurl: https://www.jiliac.com/files/ankou-icse2020.pdf\ndblp:\nrepo: https://github.com/SoftSec-KAIST/Ankou\n- dir:\n+ dir: ankou\nissue: https://github.com/google/fuzzbench/issues/198\n- name: Manul\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/ankou/builder.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+ARG parent_image=gcr.io/fuzzbench/base-builder\n+FROM $parent_image\n+\n+# Install Go.\n+RUN mkdir -p /application\n+RUN apt-get update && \\\n+ apt-get install wget -y && \\\n+ wget https://dl.google.com/go/go1.14.3.linux-amd64.tar.gz\n+RUN tar -C /application -xzf go1.14.3.linux-amd64.tar.gz\n+\n+# Clone Ankou and its dependencies.\n+RUN cd / && /application/go/bin/go get github.com/SoftSec-KAIST/Ankou\n+# Compile Ankou.\n+RUN cd / && /application/go/bin/go build github.com/SoftSec-KAIST/Ankou\n+\n+# Download and compile AFL.\n+# Set AFL_NO_X86 to skip flaky tests.\n+RUN cd / && wget http://lcamtuf.coredump.cx/afl/releases/afl-latest.tgz && \\\n+ tar xf afl-latest.tgz && \\\n+ mv afl-2.52b afl && \\\n+ cd /afl && \\\n+ AFL_NO_X86=1 make\n+\n+# Use afl_driver.cpp from LLVM as our fuzzing library.\n+RUN cd / && wget https://raw.githubusercontent.com/llvm/llvm-project/5feb80e748924606531ba28c97fe65145c65372e/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /afl/afl_driver.cpp && \\\n+ clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -I/afl && \\\n+ clang++ -stdlib=libc++ -std=c++11 -O2 -c /afl/afl_driver.cpp && \\\n+ ar r /libAFL.a *.o\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/ankou/fuzzer.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Integration code for ankou fuzzer.\"\"\"\n+\n+import shutil\n+import subprocess\n+import os\n+\n+from fuzzers import utils\n+from fuzzers.afl import fuzzer as afl_fuzzer\n+\n+# OUT environment variable is the location of build directory (default is /out).\n+\n+\n+def build():\n+ \"\"\"Build benchmark.\"\"\"\n+ afl_fuzzer.prepare_build_environment()\n+\n+ utils.build_benchmark()\n+\n+ print('[post_build] Copying Ankou to $OUT directory')\n+ shutil.copy('/Ankou', os.environ['OUT'])\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run Ankou on target.\"\"\"\n+ afl_fuzzer.prepare_fuzz_environment(input_corpus)\n+\n+ print('[run_fuzzer] Running target with Ankou')\n+ command = [\n+ './Ankou', '-app', target_binary, '-i', input_corpus, '-o',\n+ output_corpus\n+ ]\n+ # \"-dict\" option may not work for format mismatching.\n+\n+ print('[run_fuzzer] Running command: ' + ' '.join(command))\n+ subprocess.check_call(command)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/ankou/runner.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+FROM gcr.io/fuzzbench/base-runner\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [Ankou] Initial fuzzer integration (#364) |
258,399 | 04.06.2020 17:32:06 | 0 | d618fe043fe30cf6cef769290ce4c7b2500ed2a3 | Refactor gsutils to filestore_utils
This is first step towards abstracting away file store operations to support other systems than Google Cloud Storage, i.e. local storage. | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "common/filestore_utils.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Helper functions for interacting with the file storage.\"\"\"\n+\n+from common import logs\n+from common import experiment_utils\n+\n+logger = logs.Logger('filestore_utils')\n+\n+\n+def _using_gsutil():\n+ \"\"\"Returns True if using Google Cloud Storage for filestore.\"\"\"\n+ try:\n+ experiment_path_format = experiment_utils.get_cloud_experiment_path()\n+ except KeyError:\n+ return True\n+\n+ return experiment_path_format.startswith('gs://')\n+\n+\n+if _using_gsutil():\n+ from common import gsutil as filestore_utils_impl\n+else:\n+ # When gsutil is not used in the context, here it should use local_utils.\n+ # TODO(zhichengcai): local_utils\n+ from common import gsutil as filestore_utils_impl\n+\n+\n+def cp(*cp_arguments, **kwargs): # pylint: disable=invalid-name\n+ \"\"\"Copy source to destination.\"\"\"\n+ return filestore_utils_impl.cp(*cp_arguments, **kwargs)\n+\n+\n+def ls(*ls_arguments, must_exist=True, **kwargs): # pylint: disable=invalid-name\n+ \"\"\"List files or folders.\"\"\"\n+ return filestore_utils_impl.ls(*ls_arguments, must_exist, **kwargs)\n+\n+\n+def rm(*rm_arguments, recursive=True, force=False, **kwargs): # pylint: disable=invalid-name\n+ \"\"\"Remove files or folders.\"\"\"\n+ return filestore_utils_impl.rm(*rm_arguments, recursive, force, **kwargs)\n+\n+\n+def rsync( # pylint: disable=too-many-arguments\n+ source,\n+ destination,\n+ delete=True,\n+ recursive=True,\n+ gsutil_options=None,\n+ options=None,\n+ **kwargs):\n+ \"\"\"Synchronize source and destination folders.\"\"\"\n+ return filestore_utils_impl.rsync(source, destination, delete, recursive,\n+ gsutil_options, options, **kwargs)\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/build/build_utils.py",
"new_path": "experiment/build/build_utils.py",
"diff": "import tempfile\nfrom common import experiment_path as exp_path\n-from common import gsutil\n+from common import filestore_utils\ndef store_build_logs(build_config, build_result):\n@@ -28,8 +28,9 @@ def store_build_logs(build_config, build_result):\ntmp.flush()\nbuild_log_filename = build_config + '.txt'\n- gsutil.cp(tmp.name,\n- exp_path.gcs(get_build_logs_dir() / build_log_filename),\n+ filestore_utils.cp(tmp.name,\n+ exp_path.gcs(get_build_logs_dir() /\n+ build_log_filename),\nwrite_to_stdout=False)\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/build/local_build.py",
"new_path": "experiment/build/local_build.py",
"diff": "@@ -21,7 +21,7 @@ from typing import Tuple\nfrom common import benchmark_utils\nfrom common import environment\nfrom common import experiment_path as exp_path\n-from common import gsutil\n+from common import filestore_utils\nfrom common import logs\nfrom common import new_process\nfrom common import utils\n@@ -85,7 +85,7 @@ def copy_coverage_binaries(benchmark):\ncoverage_build_archive_gcs_path = posixpath.join(\nexp_path.gcs(coverage_binaries_dir), coverage_build_archive)\n- return gsutil.cp(coverage_build_archive_shared_dir_path,\n+ return filestore_utils.cp(coverage_build_archive_shared_dir_path,\ncoverage_build_archive_gcs_path)\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/measurer.py",
"new_path": "experiment/measurer.py",
"diff": "@@ -34,7 +34,7 @@ from common import experiment_utils\nfrom common import experiment_path as exp_path\nfrom common import filesystem\nfrom common import fuzzer_utils\n-from common import gsutil\n+from common import filestore_utils\nfrom common import logs\nfrom common import utils\nfrom database import utils as db_utils\n@@ -63,7 +63,7 @@ def get_experiment_folders_dir():\ndef remote_dir_exists(directory: pathlib.Path) -> bool:\n\"\"\"Does |directory| exist in the CLOUD_EXPERIMENT_BUCKET.\"\"\"\n- return gsutil.ls(exp_path.gcs(directory), must_exist=False)[0] == 0\n+ return filestore_utils.ls(exp_path.gcs(directory), must_exist=False)[0] == 0\ndef measure_loop(experiment: str, max_total_time: int):\n@@ -396,7 +396,8 @@ class SnapshotMeasurer: # pylint: disable=too-many-instance-attributes\nunchanged-cycles file. This file is written to by the trial's runner.\"\"\"\ndef copy_unchanged_cycles_file():\n- result = gsutil.cp(exp_path.gcs(self.unchanged_cycles_path),\n+ result = filestore_utils.cp(exp_path.gcs(\n+ self.unchanged_cycles_path),\nself.unchanged_cycles_path,\nexpect_zero=False)\nreturn result.retcode == 0\n@@ -454,7 +455,7 @@ class SnapshotMeasurer: # pylint: disable=too-many-instance-attributes\narcname=os.path.basename(self.crashes_dir))\ngcs_path = exp_path.gcs(\nposixpath.join(self.trial_dir, 'crashes', crashes_archive_name))\n- gsutil.cp(archive, gcs_path)\n+ filestore_utils.cp(archive, gcs_path)\nos.remove(archive)\ndef update_measured_files(self):\n@@ -533,7 +534,7 @@ def measure_snapshot_coverage(fuzzer: str, benchmark: str, trial_num: int,\ncorpus_archive_dir = os.path.dirname(corpus_archive_dst)\nif not os.path.exists(corpus_archive_dir):\nos.makedirs(corpus_archive_dir)\n- if gsutil.cp(corpus_archive_src,\n+ if filestore_utils.cp(corpus_archive_src,\ncorpus_archive_dst,\nexpect_zero=False,\nwrite_to_stdout=False)[0] != 0:\n@@ -587,7 +588,7 @@ def set_up_coverage_binary(benchmark):\narchive_name = 'coverage-build-%s.tar.gz' % benchmark\ncloud_bucket_archive_path = exp_path.gcs(coverage_binaries_dir /\narchive_name)\n- gsutil.cp(cloud_bucket_archive_path,\n+ filestore_utils.cp(cloud_bucket_archive_path,\nstr(benchmark_coverage_binary_dir),\nwrite_to_stdout=False)\narchive_path = benchmark_coverage_binary_dir / archive_name\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/reporter.py",
"new_path": "experiment/reporter.py",
"diff": "@@ -18,7 +18,7 @@ reports.\"\"\"\nfrom common import experiment_utils\nfrom common import experiment_path as exp_path\nfrom common import filesystem\n-from common import gsutil\n+from common import filestore_utils\nfrom common import logs\nfrom analysis import generate_report\nfrom analysis import data_utils\n@@ -42,10 +42,11 @@ def output_report(web_bucket, in_progress=False):\ngenerate_report.generate_report([experiment_name],\nstr(reports_dir),\nin_progress=in_progress)\n- gsutil.rsync(str(reports_dir),\n+ filestore_utils.rsync(str(reports_dir),\nweb_bucket,\ngsutil_options=[\n- '-h', 'Cache-Control:public,max-age=0,no-transform'\n+ '-h',\n+ 'Cache-Control:public,max-age=0,no-transform'\n])\nlogger.debug('Done generating report.')\nexcept data_utils.EmptyDataError:\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/run_experiment.py",
"new_path": "experiment/run_experiment.py",
"diff": "@@ -30,7 +30,7 @@ from common import experiment_utils\nfrom common import filesystem\nfrom common import fuzzer_utils\nfrom common import gcloud\n-from common import gsutil\n+from common import filestore_utils\nfrom common import logs\nfrom common import new_process\nfrom common import utils\n@@ -279,12 +279,12 @@ def copy_resources_to_bucket(config_dir: str, config: Dict):\nsource_archive = 'src.tar.gz'\nwith tarfile.open(source_archive, 'w:gz') as tar:\ntar.add(utils.ROOT_DIR, arcname='', recursive=True, filter=filter_file)\n- gsutil.cp(source_archive, base_destination + '/', parallel=True)\n+ filestore_utils.cp(source_archive, base_destination + '/', parallel=True)\nos.remove(source_archive)\n# Send config files.\ndestination = os.path.join(base_destination, 'config')\n- gsutil.rsync(config_dir, destination, parallel=True)\n+ filestore_utils.rsync(config_dir, destination, parallel=True)\nclass BaseDispatcher:\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/runner.py",
"new_path": "experiment/runner.py",
"diff": "@@ -30,7 +30,7 @@ from common import environment\nfrom common import experiment_utils\nfrom common import filesystem\nfrom common import fuzzer_utils\n-from common import gsutil\n+from common import filestore_utils\nfrom common import logs\nfrom common import new_process\nfrom common import retry\n@@ -224,7 +224,7 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\ntrial_id = environment.get('TRIAL_ID')\nself.gcs_sync_dir = experiment_utils.get_trial_bucket_dir(\nfuzzer, benchmark, trial_id)\n- gsutil.rm(self.gcs_sync_dir, force=True, parallel=True)\n+ filestore_utils.rm(self.gcs_sync_dir, force=True, parallel=True)\nelse:\nself.gcs_sync_dir = None\n@@ -371,7 +371,7 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\ngcs_path = posixpath.join(self.gcs_sync_dir, self.corpus_dir, basename)\n# Don't use parallel to avoid stability issues.\n- gsutil.cp(archive, gcs_path)\n+ filestore_utils.cp(archive, gcs_path)\n# Delete corpus archive so disk doesn't fill up.\nos.remove(archive)\n@@ -394,8 +394,8 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\n# in size because the log file containing the fuzzer's output is in this\n# directory and can be written to by the fuzzer at any time.\nresults_copy = filesystem.make_dir_copy(self.results_dir)\n- gsutil.rsync(results_copy,\n- posixpath.join(self.gcs_sync_dir, self.results_dir))\n+ filestore_utils.rsync(\n+ results_copy, posixpath.join(self.gcs_sync_dir, self.results_dir))\ndef archive_directories(directories, archive_path):\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_measurer.py",
"new_path": "experiment/test_measurer.py",
"diff": "@@ -100,8 +100,8 @@ def test_measure_trial_coverage(mocked_measure_snapshot_coverage, mocked_queue,\nassert mocked_measure_snapshot_coverage.call_args_list == expected_calls\n-@mock.patch('common.gsutil.ls')\n-@mock.patch('common.gsutil.rsync')\n+@mock.patch('common.filestore_utils.ls')\n+@mock.patch('common.filestore_utils.rsync')\ndef test_measure_all_trials_not_ready(mocked_rsync, mocked_ls, experiment):\n\"\"\"Test running measure_all_trials before it is ready works as intended.\"\"\"\nmocked_ls.return_value = ([], 1)\n@@ -137,7 +137,7 @@ def test_is_cycle_unchanged_doesnt_exist(experiment):\nassert not snapshot_measurer.is_cycle_unchanged(this_cycle)\n-@mock.patch('common.gsutil.cp')\n+@mock.patch('common.filestore_utils.cp')\n@mock.patch('common.filesystem.read')\ndef test_is_cycle_unchanged_first_copy(mocked_read, mocked_cp, experiment):\n\"\"\"Test that is_cycle_unchanged can properly determine if a cycle is\n@@ -170,16 +170,17 @@ def test_is_cycle_unchanged_update(fs, experiment):\nunchanged_cycles_file_contents = (initial_unchanged_cycles_file_contents +\n'\\n' + str(next_cycle))\nassert snapshot_measurer.is_cycle_unchanged(this_cycle)\n- with mock.patch('common.gsutil.cp') as mocked_cp:\n+ with mock.patch('common.filestore_utils.cp') as mocked_cp:\nwith mock.patch('common.filesystem.read') as mocked_read:\nmocked_cp.return_value = new_process.ProcessResult(0, '', False)\nmocked_read.return_value = unchanged_cycles_file_contents\nassert snapshot_measurer.is_cycle_unchanged(next_cycle)\n-@mock.patch('common.gsutil.cp')\n+@mock.patch('common.filestore_utils.cp')\ndef test_is_cycle_unchanged_skip_cp(mocked_cp, fs, experiment):\n- \"\"\"Check that is_cycle_unchanged doesn't call gsutil.cp unnecessarily.\"\"\"\n+ \"\"\"Check that is_cycle_unchanged doesn't call filestore_utils.cp\n+ unnecessarily.\"\"\"\nsnapshot_measurer = measurer.SnapshotMeasurer(FUZZER, BENCHMARK, TRIAL_NUM,\nSNAPSHOT_LOGGER)\nthis_cycle = 100\n@@ -191,7 +192,7 @@ def test_is_cycle_unchanged_skip_cp(mocked_cp, fs, experiment):\nmocked_cp.assert_not_called()\n-@mock.patch('common.gsutil.cp')\n+@mock.patch('common.filestore_utils.cp')\ndef test_is_cycle_unchanged_no_file(mocked_cp, fs, experiment):\n\"\"\"Test that is_cycle_unchanged returns False when there is no\nunchanged-cycles file.\"\"\"\n@@ -304,7 +305,7 @@ class TestIntegrationMeasurement:\nos.makedirs(corpus_dir)\nshutil.copy(archive, corpus_dir)\n- with mock.patch('common.gsutil.cp') as mocked_cp:\n+ with mock.patch('common.filestore_utils.cp') as mocked_cp:\nmocked_cp.return_value = new_process.ProcessResult(0, '', False)\n# TODO(metzman): Create a system for using actual buckets in\n# integration tests.\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_run_experiment.py",
"new_path": "experiment/test_run_experiment.py",
"diff": "@@ -207,8 +207,8 @@ def test_copy_resources_to_bucket():\n'cloud_experiment_bucket': 'gs://gsutil-bucket',\n'experiment': 'experiment'\n}\n- with mock.patch('common.gsutil.rsync') as mocked_rsync:\n- with mock.patch('common.gsutil.cp') as mocked_cp:\n+ with mock.patch('common.filestore_utils.rsync') as mocked_rsync:\n+ with mock.patch('common.filestore_utils.cp') as mocked_cp:\nrun_experiment.copy_resources_to_bucket(config_dir, config)\nmocked_cp.assert_called_once_with(\n'src.tar.gz',\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_runner.py",
"new_path": "experiment/test_runner.py",
"diff": "@@ -20,7 +20,7 @@ from unittest import mock\nimport pytest\n-from common import gsutil\n+from common import filestore_utils\nfrom common import new_process\nfrom experiment import runner\nfrom test_libs import utils as test_utils\n@@ -71,7 +71,7 @@ def trial_runner(fs, environ):\n'MAX_TOTAL_TIME': str(MAX_TOTAL_TIME)\n})\n- with mock.patch('common.gsutil.rm'):\n+ with mock.patch('common.filestore_utils.rm'):\ntrial_runner = runner.TrialRunner()\ntrial_runner.initialize_directories()\nyield trial_runner\n@@ -246,7 +246,7 @@ class TestIntegrationRunner:\ngcs_directory = posixpath.join(test_experiment_bucket, experiment,\n'experiment-folders',\n'%s-%s' % (benchmark, fuzzer), 'trial-1')\n- gsutil.rm(gcs_directory, force=True)\n+ filestore_utils.rm(gcs_directory, force=True)\n# Add fuzzer directory to make it easy to run fuzzer.py in local\n# configuration.\nos.environ['PYTHONPATH'] = ':'.join(\n@@ -272,7 +272,7 @@ class TestIntegrationRunner:\nrunner.main()\ngcs_corpus_directory = posixpath.join(gcs_directory, 'corpus')\n- returncode, snapshots = gsutil.ls(gcs_corpus_directory)\n+ returncode, snapshots = filestore_utils.ls(gcs_corpus_directory)\n# Ensure that test works.\nassert returncode == 0, 'gsutil ls %s failed.' % gcs_corpus_directory\n@@ -285,7 +285,7 @@ class TestIntegrationRunner:\nlocal_gcs_corpus_dir_copy = tmp_path / 'gcs_corpus_dir'\nos.mkdir(local_gcs_corpus_dir_copy)\n- gsutil.cp('-r',\n+ filestore_utils.cp('-r',\nposixpath.join(gcs_corpus_directory, '*'),\nstr(local_gcs_corpus_dir_copy),\nparallel=True)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Refactor gsutils to filestore_utils (#394)
This is first step towards abstracting away file store operations to support other systems than Google Cloud Storage, i.e. local storage. |
258,388 | 08.06.2020 11:53:40 | 25,200 | cb0af301e4869c10c122b01e31a8dffdb776a0af | [NFC] Replace uses of side_effect with return_value.
return_value is clearer and simpler and can be used in these cases. | [
{
"change_type": "MODIFY",
"old_path": "experiment/test_run_experiment.py",
"new_path": "experiment/test_run_experiment.py",
"diff": "@@ -64,7 +64,7 @@ class TestReadAndValdiateExperimentConfig(unittest.TestCase):\n# All but cloud_compute_zone.\ndel self.config['cloud_compute_zone']\nwith mock.patch('common.yaml_utils.read') as mocked_read_yaml:\n- mocked_read_yaml.side_effect = lambda config_filename: self.config\n+ mocked_read_yaml.return_value = self.config\nwith pytest.raises(run_experiment.ValidationError):\nrun_experiment.read_and_validate_experiment_config(\n'config_file')\n@@ -100,7 +100,7 @@ class TestReadAndValdiateExperimentConfig(unittest.TestCase):\nself.config['cloud_experiment_bucket'] = 1\nself.config['cloud_web_bucket'] = None\nwith mock.patch('common.yaml_utils.read') as mocked_read_yaml:\n- mocked_read_yaml.side_effect = lambda config_filename: self.config\n+ mocked_read_yaml.return_value = self.config\nwith pytest.raises(run_experiment.ValidationError):\nrun_experiment.read_and_validate_experiment_config(\n'config_file')\n@@ -119,7 +119,7 @@ class TestReadAndValdiateExperimentConfig(unittest.TestCase):\n# Don't parameterize this function, it would be too messsy.\nself.config[param] = value\nwith mock.patch('common.yaml_utils.read') as mocked_read_yaml:\n- mocked_read_yaml.side_effect = lambda config_filename: self.config\n+ mocked_read_yaml.return_value = self.config\nwith pytest.raises(run_experiment.ValidationError):\nrun_experiment.read_and_validate_experiment_config(\n'config_file')\n@@ -130,7 +130,7 @@ class TestReadAndValdiateExperimentConfig(unittest.TestCase):\n\"\"\"Tests that read_and_validat_experiment_config works as intended when\nconfig is valid.\"\"\"\nwith mock.patch('common.yaml_utils.read') as mocked_read_yaml:\n- mocked_read_yaml.side_effect = lambda config_filename: self.config\n+ mocked_read_yaml.return_value = self.config\nassert (self.config == run_experiment.\nread_and_validate_experiment_config('config_file'))\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [NFC] Replace uses of side_effect with return_value. (#409)
return_value is clearer and simpler and can be used in these cases. |
258,388 | 08.06.2020 13:38:20 | 25,200 | 99256e13720d5f42d957ba0cdbfdec827f1cf3f5 | [NFC] Remove unused logger. | [
{
"change_type": "MODIFY",
"old_path": "common/filestore_utils.py",
"new_path": "common/filestore_utils.py",
"diff": "# limitations under the License.\n\"\"\"Helper functions for interacting with the file storage.\"\"\"\n-from common import logs\nfrom common import experiment_utils\n-logger = logs.Logger('filestore_utils')\n-\ndef _using_gsutil():\n\"\"\"Returns True if using Google Cloud Storage for filestore.\"\"\"\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [NFC] Remove unused logger. (#410) |
258,388 | 10.06.2020 10:11:12 | 25,200 | 6cdf384a19a43310a3d3e72795c1df0919b2f0ab | [make][runner] Use FORCE_LOCAL in debug-, test-run-, run- make targets
They targets are only used locally, and FORCE_LOCAL won't be propagated
from the user's environment to the docker container unless we do this.
So best to assume it is needed. | [
{
"change_type": "MODIFY",
"old_path": "docker/generate_makefile.py",
"new_path": "docker/generate_makefile.py",
"diff": "@@ -184,6 +184,7 @@ run-{fuzzer}-{benchmark}: .{fuzzer}-{benchmark}-oss-fuzz-runner\n--cap-add SYS_NICE \\\\\n--cap-add SYS_PTRACE \\\\\n-e FUZZ_OUTSIDE_EXPERIMENT=1 \\\\\n+ -e FORCE_LOCAL=1 \\\\\n-e TRIAL_ID=1 \\\\\n-e FUZZER={fuzzer} \\\\\n-e BENCHMARK={benchmark} \\\\\n@@ -195,6 +196,7 @@ test-run-{fuzzer}-{benchmark}: .{fuzzer}-{benchmark}-oss-fuzz-runner\n--cap-add SYS_NICE \\\\\n--cap-add SYS_PTRACE \\\\\n-e FUZZ_OUTSIDE_EXPERIMENT=1 \\\\\n+ -e FORCE_LOCAL=1 \\\\\n-e TRIAL_ID=1 \\\\\n-e FUZZER={fuzzer} \\\\\n-e BENCHMARK={benchmark} \\\\\n@@ -209,6 +211,7 @@ debug-{fuzzer}-{benchmark}: .{fuzzer}-{benchmark}-oss-fuzz-runner\n--cap-add SYS_NICE \\\\\n--cap-add SYS_PTRACE \\\\\n-e FUZZ_OUTSIDE_EXPERIMENT=1 \\\\\n+ -e FORCE_LOCAL=1 \\\\\n-e TRIAL_ID=1 \\\\\n-e FUZZER={fuzzer} \\\\\n-e BENCHMARK={benchmark} \\\\\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [make][runner] Use FORCE_LOCAL in debug-, test-run-, run- make targets (#418)
They targets are only used locally, and FORCE_LOCAL won't be propagated
from the user's environment to the docker container unless we do this.
So best to assume it is needed. |
258,370 | 10.06.2020 23:01:15 | 14,400 | 416d49ae13ce4cb05f46a7c5c71daa3b37359c10 | Manul - Initial Integration | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -30,6 +30,7 @@ jobs:\n- honggfuzz\n- lafintel\n- libfuzzer\n+ - manul\n- mopt\nbenchmark_type:\n"
},
{
"change_type": "MODIFY",
"old_path": "docker/base-runner/Dockerfile",
"new_path": "docker/base-runner/Dockerfile",
"diff": "@@ -21,5 +21,6 @@ RUN apt-get update -y && apt-get install -y \\\nlibarchive13 \\\nlibgss3\n-ENV WORKDIR /out\n+ENV OUT /out\n+ENV WORKDIR $OUT\nWORKDIR $WORKDIR\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/manul/builder.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+ARG parent_image=gcr.io/fuzzbench/base-builder\n+FROM $parent_image\n+\n+RUN cd / && git clone https://github.com/mxmssh/manul /manul && \\\n+ cd /manul && sed -i \"s/mutator_weights=afl:10,radamsa:0/mutator_weights=afl:3,radamsa:7/\" manul_lin.config\n+\n+RUN cd / && git clone https://github.com/google/AFL.git /afl && \\\n+ cd /afl && \\\n+ git checkout 8da80951dd7eeeb3e3b5a3bcd36c485045f40274 && \\\n+ AFL_NO_X86=1 make\n+\n+RUN apt update && apt install -y wget && \\\n+ wget https://raw.githubusercontent.com/llvm/llvm-project/5feb80e748924606531ba28c97fe65145c65372e/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /afl/afl_driver.cpp && \\\n+ clang -Wno-pointer-sign -c /afl/llvm_mode/afl-llvm-rt.o.c -I/afl && \\\n+ clang++ -stdlib=libc++ -std=c++11 -O2 -c /afl/afl_driver.cpp && \\\n+ ar r /libAFL.a *.o\n+\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/manul/fuzzer.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Manul Integration\"\"\"\n+import os\n+import subprocess\n+import shutil\n+from fuzzers import utils\n+from fuzzers.afl import fuzzer as afl_fuzzer\n+\n+\n+def build():\n+ \"\"\"Build benchmark and copy fuzzer to $OUT.\"\"\"\n+ afl_fuzzer.prepare_build_environment()\n+ utils.build_benchmark()\n+ # Move manul base to /out.\n+ shutil.move('/manul', os.environ['OUT'])\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\n+\n+ Arguments:\n+ input_corpus: Directory containing the initial seed corpus for\n+ the benchmark.\n+ output_corpus: Output directory to place the newly generated corpus\n+ from fuzzer run.\n+ target_binary: Absolute path to the fuzz target binary.\n+ \"\"\"\n+ afl_fuzzer.prepare_fuzz_environment(input_corpus)\n+ # Run fuzzer on the benchmark.\n+ manul_directory = os.path.join(os.environ['OUT'], 'manul')\n+ command = ([\n+ 'python3', 'manul.py', '-i', input_corpus, '-o', output_corpus, '-c',\n+ os.path.join(manul_directory, 'manul_lin.config'), target_binary + ' @@'\n+ ])\n+ subprocess.check_call(command, cwd=manul_directory)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/manul/runner.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+FROM gcr.io/fuzzbench/base-runner\n+RUN python3 -m pip install psutil\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Manul - Initial Integration (#419) |
258,388 | 11.06.2020 15:52:14 | 25,200 | 8a93b2ba97015c6f25a9b85a4e9c7d11bb9eea07 | Ensure FORCE_LOCAL=1 for presubmit.
Ensure FORCE_LOCAL=1 for presubmit.
Many googlers using Google Cloud for development need this and it will probably never hurt
to have.
Also add assertion that FORCE_LOCAL and FORCE_NOT_LOCAL aren't both enabled | [
{
"change_type": "MODIFY",
"old_path": "common/utils.py",
"new_path": "common/utils.py",
"diff": "@@ -20,12 +20,17 @@ import urllib.error\nROOT_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))\n+assert not (os.getenv('FORCE_NOT_LOCAL') and os.getenv('FORCE_LOCAL')), (\n+ 'You can\\'t set FORCE_LOCAL and FORCE_NOT_LOCAL environment variables to '\n+ 'True at the same time. If you haven\\'t set either of these and/or don\\'t '\n+ 'understand why this is happening please file a bug.')\n+\n# pylint: disable=invalid-name\n_is_local = None\nif os.getenv('FORCE_NOT_LOCAL'):\n# Allow local users to force is_local to return False. This allows things\n- # like stackdriver logging to happen when running code locally.\n+ # like logging to happen when running code locally.\n_is_local = False\nif os.getenv('FORCE_LOCAL'):\n"
},
{
"change_type": "MODIFY",
"old_path": "presubmit.py",
"new_path": "presubmit.py",
"diff": "# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"Presubmit script for fuzzbench.\"\"\"\n+# pylint: disable=wrong-import-position\n+import os\n+\n+# Many users need this if they are using a Google Cloud instance for development\n+# or if their system has a weird setup that makes FuzzBench think it is running\n+# on Google Cloud. It's unlikely that setting this will mess anything up so set\n+# it.\n+# TODO(metzman): Make local the default setting and propagate 'NOT_LOCAL' to all\n+# production environments so we don't need to worry about this any more.\n+os.environ['FORCE_LOCAL'] = '1'\nimport argparse\nimport logging\n-import os\nfrom pathlib import Path\nimport subprocess\nimport sys\n@@ -227,7 +236,10 @@ def yapf(paths: List[Path], validate: bool = True) -> bool:\ncommand = ['yapf', validate_argument, '-p']\ncommand.extend(paths)\nreturncode = subprocess.run(command, check=False).returncode\n- return returncode == 0\n+ success = returncode == 0\n+ if not success:\n+ print('Code is not formatted correctly, please run \\'make format\\'')\n+ return success\ndef is_path_in_ignore_directory(path: Path) -> bool:\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Ensure FORCE_LOCAL=1 for presubmit. (#426)
Ensure FORCE_LOCAL=1 for presubmit.
Many googlers using Google Cloud for development need this and it will probably never hurt
to have.
Also add assertion that FORCE_LOCAL and FORCE_NOT_LOCAL aren't both enabled |
258,388 | 12.06.2020 12:51:55 | 25,200 | d075d3365e33af64287dad1049080bc2a8443f25 | [libfuzzer] Add libfuzzer variant that doesn't use cmp instrumentation
[libfuzzer] Add libfuzzer variant that doesn't use cmp instrumentation | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -31,6 +31,7 @@ jobs:\n- honggfuzz\n- lafintel\n- libfuzzer\n+ - libfuzzer_nocmp\n- manul\n- mopt\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/libfuzzer_nocmp/builder.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+ARG parent_image=gcr.io/fuzzbench/base-builder\n+FROM $parent_image\n+\n+RUN git clone https://github.com/llvm/llvm-project.git /llvm-project && \\\n+ cd /llvm-project/ && \\\n+ git checkout d8981ce5b9f8caa567613b2bf5aa3095e0156130 && \\\n+ cd compiler-rt/lib/fuzzer && \\\n+ (for f in *.cpp; do \\\n+ clang++ -stdlib=libc++ -fPIC -O2 -std=c++11 $f -c & \\\n+ done && wait) && \\\n+ ar r /usr/lib/libFuzzer.a *.o\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/libfuzzer_nocmp/fuzzer.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Integration code for libFuzzer fuzzer.\"\"\"\n+\n+import os\n+\n+from fuzzers import utils\n+from fuzzers.libfuzzer import fuzzer as libfuzzer_fuzzer\n+\n+\n+def build():\n+ \"\"\"Build benchmark.\"\"\"\n+ # With LibFuzzer we use -fsanitize=fuzzer-no-link for build CFLAGS and then\n+ # /usr/lib/libFuzzer.a as the FUZZER_LIB for the main fuzzing binary. This\n+ # allows us to link against a version of LibFuzzer that we specify.\n+ cflags = ['-fsanitize=fuzzer-no-link', '-fno-sanitize-coverage=trace-cmp']\n+ utils.append_flags('CFLAGS', cflags)\n+ utils.append_flags('CXXFLAGS', cflags)\n+\n+ os.environ['CC'] = 'clang'\n+ os.environ['CXX'] = 'clang++'\n+ os.environ['FUZZER_LIB'] = '/usr/lib/libFuzzer.a'\n+\n+ utils.build_benchmark()\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer. Wrapper that uses the defaults when calling\n+ run_fuzzer.\"\"\"\n+ libfuzzer_fuzzer.fuzz(input_corpus, output_corpus, target_binary)\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/libfuzzer_nocmp/runner.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+FROM gcr.io/fuzzbench/base-runner\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [libfuzzer] Add libfuzzer variant that doesn't use cmp instrumentation (#432)
[libfuzzer] Add libfuzzer variant that doesn't use cmp instrumentation |
258,388 | 12.06.2020 17:58:09 | 25,200 | f810d635aeb68f3b5cbb405143035aa5ac5de56d | Make automatic_run_experiment run experiments based on requests
This functionality will be tested by fuzzbench maintainers. It isn't for users yet. | [
{
"change_type": "MODIFY",
"old_path": "presubmit.py",
"new_path": "presubmit.py",
"diff": "@@ -31,10 +31,14 @@ import subprocess\nimport sys\nfrom typing import List, Optional\n+import yaml\n+\nfrom common import benchmark_utils\nfrom common import fuzzer_utils\nfrom common import filesystem\nfrom common import logs\n+from common import yaml_utils\n+from service import automatic_run_experiment\nfrom src_analysis import change_utils\nfrom src_analysis import diff_utils\n@@ -242,6 +246,30 @@ def yapf(paths: List[Path], validate: bool = True) -> bool:\nreturn success\n+def validate_experiment_requests(paths: List[Path]):\n+ \"\"\"Returns False if service/experiment-requests.yaml it is in |paths| and is\n+ not valid.\"\"\"\n+ if Path(automatic_run_experiment.REQUESTED_EXPERIMENTS_PATH) not in paths:\n+ return True\n+\n+ try:\n+ experiment_requests = yaml_utils.read(\n+ automatic_run_experiment.REQUESTED_EXPERIMENTS_PATH)\n+ except yaml.parser.ParserError:\n+ print('Error parsing %s.' %\n+ automatic_run_experiment.REQUESTED_EXPERIMENTS_PATH)\n+ return False\n+\n+ result = automatic_run_experiment.validate_experiment_requests(\n+ experiment_requests)\n+\n+ if not result:\n+ print('%s is not valid.' %\n+ automatic_run_experiment.REQUESTED_EXPERIMENTS_PATH)\n+\n+ return result\n+\n+\ndef is_path_in_ignore_directory(path: Path) -> bool:\n\"\"\"Returns True if |path| is a subpath of an ignored directory.\"\"\"\nfor ignore_directory in _IGNORE_DIRECTORIES:\n@@ -305,7 +333,8 @@ def do_checks(file_paths: List[Path]) -> bool:\nif not all(path_valid_statuses):\nsuccess = False\n- for check in [license_check, yapf, lint, pytype]:\n+ checks = [license_check, yapf, lint, pytype, validate_experiment_requests]\n+ for check in checks:\nif not check(file_paths):\nprint('ERROR: %s failed, see errors above.' % check.__name__)\nsuccess = False\n@@ -330,13 +359,16 @@ def main() -> int:\n\"\"\"Check that this branch conforms to the standards of fuzzbench.\"\"\"\nparser = argparse.ArgumentParser(\ndescription='Presubmit script for fuzzbench.')\n- choices = [\n- 'format', 'lint', 'typecheck', 'licensecheck',\n- 'test_changed_integrations'\n- ]\n+ command_check_mapping = {\n+ 'format': yapf,\n+ 'lint': lint,\n+ 'typecheck': pytype,\n+ 'validate_experiment_requests': validate_experiment_requests,\n+ 'test_changed_integrations': test_changed_integrations\n+ }\nparser.add_argument(\n'command',\n- choices=choices,\n+ choices=command_check_mapping.keys(),\nnargs='?',\nhelp='The presubmit check to run. Defaults to all of them')\nparser.add_argument('--all-files',\n@@ -368,13 +400,6 @@ def main() -> int:\nsuccess = do_checks(relevant_files)\nreturn bool_to_returncode(success)\n- command_check_mapping = {\n- 'format': yapf,\n- 'lint': lint,\n- 'typecheck': pytype,\n- 'test_changed_integrations': test_changed_integrations\n- }\n-\ncheck = command_check_mapping[args.command]\nif args.command == 'format':\nsuccess = check(relevant_files, False)\n"
},
{
"change_type": "MODIFY",
"old_path": "service/automatic_run_experiment.py",
"new_path": "service/automatic_run_experiment.py",
"diff": "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n-\"\"\"Determines if an experiment should be run and runs one if necessary.\n-Note that this code uses a config file for experiments that is not generic.\n-Thus, it only works on the official fuzzbench service. This script can be\n-run manually but is intended to be run by a cronjob.\"\"\"\n+\"\"\"Reads experiment-requests.yaml and determines if there is a new experiment\n+and runs it if needed. Note that this code uses a config file for experiments\n+that is specific to the FuzzBench service. Therefore this code will break if\n+others try to run it.\"\"\"\nimport argparse\n-import datetime\n+import collections\nimport os\n+import re\nimport sys\n-import pytz\n-\nfrom common import logs\nfrom common import fuzzer_utils\nfrom common import utils\n+from common import yaml_utils\n+from database import models\n+from database import utils as db_utils\nfrom experiment import run_experiment\nfrom experiment import stop_experiment\n-from src_analysis import experiment_changes\n+\n+logger = logs.Logger('automatic_run_experiment') # pylint: disable=invalid-name\nEXPERIMENT_CONFIG_FILE = os.path.join(utils.ROOT_DIR, 'service',\n'experiment-config.yaml')\n+REQUESTED_EXPERIMENTS_PATH = os.path.join(utils.ROOT_DIR, 'service',\n+ 'experiment-requests.yaml')\n+\n+# Don't run an experiment if we have a \"request\" just containing this keyword.\n+# TODO(metzman): Look into replacing this mechanism for pausing the service.\n+PAUSE_SERVICE_KEYWORD = 'PAUSE_SERVICE'\n+\n+EXPERIMENT_NAME_REGEX = re.compile(r'^\\d{4}-\\d{2}-\\d{2}.*')\n+\n# TODO(metzman): Stop hardcoding benchmarks and support marking benchmarks as\n# disabled using a config file in each benchmark.\nBENCHMARKS = [\n@@ -62,26 +74,135 @@ BENCHMARKS = [\n]\n-def get_experiment_name():\n- \"\"\"Returns the name of the experiment to run.\"\"\"\n- timezone = pytz.timezone('America/Los_Angeles')\n- time_now = datetime.datetime.now(timezone)\n- return time_now.strftime('%Y-%m-%d')\n-\n-\n-def run_diff_experiment(dry_run):\n- \"\"\"Run a diff experiment. This is an experiment that runs only on\n- fuzzers that have changed since the last experiment.\"\"\"\n- fuzzers = experiment_changes.get_fuzzers_changed_since_last()\n- logs.info('Running experiment with fuzzers: %s.', ' '.join(fuzzers))\n+def _get_experiment_name(experiment_config: dict) -> str:\n+ \"\"\"Returns the name of the experiment described by experiment_config as a\n+ string.\"\"\"\n+ # Use str because the yaml parser will parse things like `2020-05-06` as\n+ # a datetime if not included in quotes.\n+ return str(experiment_config['experiment'])\n+\n+\n+def validate_experiment_name(experiment_name):\n+ \"\"\"Returns True if |experiment_name| is valid.\"\"\"\n+ return EXPERIMENT_NAME_REGEX.match(experiment_name) is not None\n+\n+\n+def _validate_individual_experiment_requests(experiment_requests):\n+ \"\"\"Returns True if all requests in |experiment_request| are valid in\n+ isolation. Does not account for PAUSE_SERVICE_KEYWORD or duplicates.\"\"\"\n+ all_fuzzers = set(fuzzer_utils.get_fuzzer_names())\n+ valid = True\n+ # Validate format.\n+ for request in experiment_requests:\n+ if not isinstance(request, dict):\n+ logger.error('Request: %s is not a dict.', request)\n+ experiment_requests.remove(request)\n+ valid = False\n+ continue\n+\n+ if 'experiment' not in request:\n+ logger.error('Request: %s does not have field \"experiment\".',\n+ request)\n+ valid = False\n+ continue\n+\n+ experiment = _get_experiment_name(request)\n+ if not validate_experiment_name(experiment):\n+ valid = False\n+ logger.error('Experiment name: %s is not valid.', experiment)\n+ # Request isn't so malformed that we can finding other issues.\n+ # if present. Don't continue.\n+\n+ experiment = request['experiment']\n+ if not request.get('fuzzers'):\n+ logger.error('Request: %s does not specify any fuzzers.', request)\n+ valid = False\n+ continue\n+\n+ experiment_fuzzers = request['fuzzers']\n+ for fuzzer in experiment_fuzzers:\n+ if fuzzer in all_fuzzers:\n+ continue\n+ # Fuzzer isn't valid.\n+ logger.error('Fuzzer: %s in experiment %s is not valid.', fuzzer,\n+ experiment)\n+ valid = False\n+\n+ return valid\n+\n+\n+def validate_experiment_requests(experiment_requests):\n+ \"\"\"Returns True if all requests in |experiment_requests| are valid.\"\"\"\n+ # This function tries to find as many requests as possible.\n+ if PAUSE_SERVICE_KEYWORD in experiment_requests:\n+ # This is a special case where a string is used instead of an experiment\n+ # to tell the service not to run experiments automatically. Remove it\n+ # from the list because it fails validation.\n+ experiment_requests = experiment_requests[:] # Don't mutate input.\n+ experiment_requests.remove(PAUSE_SERVICE_KEYWORD)\n+\n+ if not _validate_individual_experiment_requests(experiment_requests):\n+ # Don't try the next validation step if the previous failed, we might\n+ # exception.\n+ return False\n+\n+ # Make sure experiment requests have a unique name, we can't run the same\n+ # experiment twice.\n+ counts = collections.Counter(\n+ [request['experiment'] for request in experiment_requests])\n+\n+ valid = True\n+ for experiment_name, count in counts.items():\n+ if count != 1:\n+ logger.error('Experiment: \"%s\" appears %d times.',\n+ str(experiment_name), count)\n+ valid = False\n+\n+ return valid\n+\n+\n+def run_requested_experiment(dry_run):\n+ \"\"\"Run the oldest requested experiment that hasn't been run yet in\n+ experiment-requests.yaml.\"\"\"\n+ requested_experiments = yaml_utils.read(REQUESTED_EXPERIMENTS_PATH)\n+\n+ # TODO(metzman): Look into supporting benchmarks as an optional parameter so\n+ # that people can add fuzzers that don't support everything.\n+\n+ if PAUSE_SERVICE_KEYWORD in requested_experiments:\n+ # Check if automated experiment service is paused.\n+ logs.warning('Pause service requested, not running experiment.')\n+ return None\n+\n+ requested_experiment = None\n+ for experiment_config in reversed(requested_experiments):\n+ experiment_name = _get_experiment_name(experiment_config)\n+ is_new_experiment = db_utils.query(models.Experiment).filter(\n+ models.Experiment.name == experiment_name).first() is None\n+ if is_new_experiment:\n+ requested_experiment = experiment_config\n+ break\n+\n+ if requested_experiment is None:\n+ logs.info('No new experiment to run. Exiting.')\n+ return None\n+\n+ experiment_name = _get_experiment_name(requested_experiment)\n+ if not validate_experiment_requests([requested_experiment]):\n+ logs.error('Requested experiment: %s in %s is not valid.',\n+ requested_experiment, REQUESTED_EXPERIMENTS_PATH)\n+ return None\n+ fuzzers = requested_experiment['fuzzers']\n+\n+ logs.info('Running experiment: %s with fuzzers: %s.', experiment_name,\n+ ' '.join(fuzzers))\nfuzzer_configs = fuzzer_utils.get_fuzzer_configs(fuzzers=fuzzers)\n- return _run_experiment(fuzzer_configs, dry_run)\n+ return _run_experiment(experiment_name, fuzzer_configs, dry_run)\n-def _run_experiment(fuzzer_configs, dry_run=False):\n- \"\"\"Run an experiment on |fuzzer_configs| and shut it down once it\n- terminates.\"\"\"\n- experiment_name = get_experiment_name()\n+def _run_experiment(experiment_name, fuzzer_configs, dry_run=False):\n+ \"\"\"Run an experiment named |experiment_name| on |fuzzer_configs| and shut it\n+ down once it terminates.\"\"\"\nlogs.info('Starting experiment: %s.', experiment_name)\nif dry_run:\nlogs.info('Dry run. Not actually running experiment.')\n@@ -91,31 +212,20 @@ def _run_experiment(fuzzer_configs, dry_run=False):\nstop_experiment.stop_experiment(experiment_name, EXPERIMENT_CONFIG_FILE)\n-def run_full_experiment():\n- \"\"\"Run a full experiment.\"\"\"\n- fuzzer_configs = fuzzer_utils.get_fuzzer_configs()\n- return _run_experiment(fuzzer_configs)\n-\n-\ndef main():\n\"\"\"Run an experiment.\"\"\"\nlogs.initialize()\n- parser = argparse.ArgumentParser(\n- description='Run a full or diff experiment (if needed).')\n+ parser = argparse.ArgumentParser(description='Run a requested experiment.')\n# TODO(metzman): Add a way to exit immediately if there is already an\n# experiment running. FuzzBench's scheduler isn't smart enough to deal with\n# this properly.\n- parser.add_argument('experiment_type', choices=['diff', 'full'])\nparser.add_argument('-d',\n'--dry-run',\nhelp='Dry run, don\\'t actually run the experiment',\ndefault=False,\naction='store_true')\nargs = parser.parse_args()\n- if args.experiment_type == 'full':\n- run_full_experiment()\n- else:\n- run_diff_experiment(args.dry_run)\n+ run_requested_experiment(args.dry_run)\nreturn 0\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "service/experiment-requests.yaml",
"diff": "+# Experiment requests have the following format:\n+#\n+# - experiment: 2020-06-08 # The name of the experiment\n+# fuzzers: # The fuzzers to run in the experiment.\n+# - aflplusplus\n+# - libfuzzer\n+#\n+# The name of the experiment must begin with a date using this format:\n+# YYYY-MM-DD (year-month-day). It's not important what timezone is used in\n+# deciding the date or if this is a day or two off. The most important thing is\n+# that is unique.\n+# If there already is an experiment for a particular date in this file, you can\n+# either: add a suffix (e.g. \"-aflplusplus\" or \"-2\") to the experiment name, or\n+# use the next date.\n+#\n+# You can run \"make presubmit\" to do basic validation on this file.\n+# Please add new experiment requests towards the top of this file.\n+# NOTE: Users of the FuzzBench service should not be editing this file yet, we\n+# are still testing this feature. You should request an experiment by contacting\n+# us as you normally do.\n+\n+- experiment: 2020-06-12\n+ fuzzers:\n+ - aflcc\n+ - aflplusplus\n+ - aflplusplus_optimal\n+ - aflplusplus_optimal_shmem\n+ - aflplusplus_qemu\n+ - aflplusplus_shmem\n+ - libfuzzer_nocmp\n+ - manul\n+\n+- experiment: 2020-06-08\n+ fuzzers:\n+ - aflplusplus\n+ - libfuzzer\n"
},
{
"change_type": "MODIFY",
"old_path": "service/test_automatic_run_experiment.py",
"new_path": "service/test_automatic_run_experiment.py",
"diff": "# limitations under the License.\n\"\"\"Tests for automatic_run_experiment.py\"\"\"\nimport os\n+import datetime\nfrom unittest import mock\n+import pytest\n+\nfrom common import utils\nfrom service import automatic_run_experiment\n# pylint: disable=invalid-name,unused-argument\n+# A valid experiment name.\n+EXPERIMENT = '2020-01-01'\n+\n+EXPERIMENT_REQUESTS = [{\n+ 'experiment': datetime.date(2020, 6, 8),\n+ 'fuzzers': ['aflplusplus', 'libfuzzer']\n+}, {\n+ 'experiment': datetime.date(2020, 6, 5),\n+ 'fuzzers': ['honggfuzz', 'afl']\n+}]\n+\n+\n+@mock.patch('experiment.run_experiment.start_experiment')\n+@mock.patch('common.logs.warning')\n+@mock.patch('common.yaml_utils.read')\n+def test_run_requested_experiment_pause_service(mocked_read, mocked_warning,\n+ mocked_start_experiment, db):\n+ \"\"\"Tests that run_requested_experiment doesn't run an experiment when a\n+ pause is requested.\"\"\"\n+ experiment_requests_with_pause = EXPERIMENT_REQUESTS.copy()\n+ experiment_requests_with_pause.append(\n+ automatic_run_experiment.PAUSE_SERVICE_KEYWORD)\n+ mocked_read.return_value = experiment_requests_with_pause\n+\n+ assert (automatic_run_experiment.run_requested_experiment(dry_run=False) is\n+ None)\n+ mocked_warning.assert_called_with(\n+ 'Pause service requested, not running experiment.')\n+ assert mocked_start_experiment.call_count == 0\n+\n@mock.patch('experiment.run_experiment.start_experiment')\n@mock.patch('experiment.stop_experiment.stop_experiment')\n-@mock.patch('src_analysis.experiment_changes.get_fuzzers_changed_since_last')\n-@mock.patch('service.automatic_run_experiment.get_experiment_name')\n-def test_run_diff_experiment(mocked_get_experiment_name,\n- mocked_get_fuzzers_changed_since_last,\n- mocked_stop_experiment, mocked_start_experiment,\n- db):\n- \"\"\"Tests that run_diff_experiment starts and stops the experiment\n+@mock.patch('common.yaml_utils.read')\n+def test_run_requested_experiment(mocked_read, mocked_stop_experiment,\n+ mocked_start_experiment, db):\n+ \"\"\"Tests that run_requested_experiment starts and stops the experiment\nproperly.\"\"\"\n- expected_experiment_name = 'myexperiment'\n- mocked_get_experiment_name.return_value = expected_experiment_name\n- fuzzers = ['afl', 'aflplusplus']\n- mocked_get_fuzzers_changed_since_last.return_value = fuzzers\n- automatic_run_experiment.run_diff_experiment(False)\n+ mocked_read.return_value = EXPERIMENT_REQUESTS\n+ expected_experiment_name = '2020-06-05'\n+ expected_fuzzers = ['honggfuzz', 'afl']\n+ automatic_run_experiment.run_requested_experiment(dry_run=False)\nexpected_config_file = os.path.join(utils.ROOT_DIR, 'service',\n'experiment-config.yaml')\n@@ -45,7 +74,8 @@ def test_run_diff_experiment(mocked_get_experiment_name,\nexpected_fuzzer_configs = list(\nsorted([{\n'fuzzer': fuzzer\n- } for fuzzer in fuzzers], key=sort_key))\n+ } for fuzzer in expected_fuzzers],\n+ key=sort_key))\nexpected_benchmarks = [\n'bloaty_fuzz_target',\n'curl_curl_fuzzer_http',\n@@ -68,11 +98,11 @@ def test_run_diff_experiment(mocked_get_experiment_name,\n'vorbis-2017-12-11',\n'woff2-2016-05-06',\n]\n- start_experiment_call_args = mocked_start_experiment.call_args_list\nexpected_calls = [\nmock.call(expected_experiment_name, expected_config_file,\nexpected_benchmarks, expected_fuzzer_configs)\n]\n+ start_experiment_call_args = mocked_start_experiment.call_args_list\nassert len(start_experiment_call_args) == 1\n# Sort the list of fuzzer configs so that we can assert that the calls were\n@@ -82,3 +112,88 @@ def test_run_diff_experiment(mocked_get_experiment_name,\nmocked_stop_experiment.assert_called_with(expected_experiment_name,\nexpected_config_file)\n+\n+\n+@pytest.mark.parametrize(\n+ ('name', 'expected_result'), [('02000-1-1', False), ('2020-1-1', False),\n+ ('2020-01-01', True),\n+ ('2020-01-01-aflplusplus', True),\n+ ('2020-01-01-1', True)])\n+def test_validate_experiment_name(name, expected_result):\n+ \"\"\"Tests that validate experiment name returns True for valid names and\n+ False for names that are not valid.\"\"\"\n+ assert (automatic_run_experiment.validate_experiment_name(name) ==\n+ expected_result)\n+\n+\n+# Call the parameter exp_request instead of request because pytest reserves it.\n+@pytest.mark.parametrize(\n+ ('exp_request', 'expected_result'),\n+ [\n+ ({\n+ 'experiment': EXPERIMENT,\n+ 'fuzzers': ['afl']\n+ }, True),\n+ # Not a dict.\n+ (1, False),\n+ # No fuzzers.\n+ ({\n+ 'experiment': EXPERIMENT,\n+ 'fuzzers': []\n+ }, False),\n+ # No fuzzers.\n+ ({\n+ 'experiment': EXPERIMENT\n+ }, False),\n+ # No experiment.\n+ ({\n+ 'fuzzers': ['afl']\n+ }, False),\n+ # Invalid experiment.\n+ ({\n+ 'experiment': 'invalid',\n+ 'fuzzers': ['afl']\n+ }, False),\n+ # Invalid fuzzers.\n+ ({\n+ 'experiment': EXPERIMENT,\n+ 'fuzzers': ['1']\n+ }, False),\n+ ])\n+def test_validate_experiment_requests(exp_request, expected_result):\n+ \"\"\"Tests that validate_experiment_requests returns True for valid fuzzres\n+ and False for invalid ones.\"\"\"\n+ assert (automatic_run_experiment.validate_experiment_requests([exp_request])\n+ is expected_result)\n+\n+\n+def test_validate_experiment_requests_duplicate_experiments():\n+ \"\"\"Tests that validate_experiment_requests returns False if the experiment\n+ names are duplicated.\"\"\"\n+ requests = [\n+ {\n+ 'experiment': EXPERIMENT,\n+ 'fuzzers': ['afl']\n+ },\n+ {\n+ 'experiment': EXPERIMENT,\n+ 'fuzzers': ['libfuzzer']\n+ },\n+ ]\n+ assert not automatic_run_experiment.validate_experiment_requests(requests)\n+\n+\n+def test_validate_experiment_requests_one_valid_one_invalid():\n+ \"\"\"Tests that validate_experiment_requests returns False even if some\n+ requests are valid.\"\"\"\n+ requests = [\n+ {\n+ 'experiment': EXPERIMENT,\n+ 'fuzzers': ['afl']\n+ },\n+ {\n+ 'experiment': '2020-02-02',\n+ 'fuzzers': []\n+ },\n+ ]\n+ assert not automatic_run_experiment.validate_experiment_requests(requests)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Make automatic_run_experiment run experiments based on requests (#416)
This functionality will be tested by fuzzbench maintainers. It isn't for users yet. |
258,371 | 15.06.2020 15:03:54 | 14,400 | 69feb9c327094033ced66ec2aea362c54bbbbb2a | [clang-coverage] Add build
Add clang source based coverage build. | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".vscode/settings.json",
"diff": "+{\n+ \"python.linting.pylintEnabled\": true\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "common/fuzzer_utils.py",
"new_path": "common/fuzzer_utils.py",
"diff": "@@ -25,6 +25,7 @@ DEFAULT_FUZZ_TARGET_NAME = 'fuzz-target'\nFUZZ_TARGET_SEARCH_STRING = b'LLVMFuzzerTestOneInput'\nVALID_FUZZER_REGEX = re.compile(r'^[A-Za-z0-9_]+$')\nFUZZERS_DIR = os.path.join(utils.ROOT_DIR, 'fuzzers')\n+COVERAGE_TOOLS = {'coverage', 'coverage_source_based'}\nclass FuzzerDirectory:\n@@ -143,7 +144,7 @@ def get_fuzzer_configs(fuzzers=None):\nfor fuzzer in os.listdir(fuzzers_dir):\nif not os.path.isfile(os.path.join(fuzzers_dir, fuzzer, 'fuzzer.py')):\ncontinue\n- if fuzzer == 'coverage':\n+ if fuzzer in COVERAGE_TOOLS:\ncontinue\nif fuzzers is None or fuzzer in fuzzers:\n"
},
{
"change_type": "MODIFY",
"old_path": "common/test_new_process.py",
"new_path": "common/test_new_process.py",
"diff": "@@ -45,7 +45,8 @@ class TestIntegrationExecute:\nstart_time = time.time()\nresult = new_process.execute(self.COMMAND, timeout=.1)\nend_time = time.time()\n- assert end_time - start_time < 1\n+ assert end_time - start_time < 5\n+ # Give it a lot of slack to account for differences on people's macines.\nassert result.retcode != 0\n@mock.patch('common.logs.info')\n"
},
{
"change_type": "MODIFY",
"old_path": "docker/generate_makefile.py",
"new_path": "docker/generate_makefile.py",
"diff": "@@ -51,7 +51,7 @@ FUZZER_BENCHMARK_TEMPLATE = \"\"\"\n.pull-{fuzzer}-{benchmark}-builder: .pull-{fuzzer}-builder\ndocker pull {base_tag}/builders/{fuzzer}/{benchmark}\n-ifneq ({fuzzer}, coverage)\n+ifeq (,$(filter {fuzzer},coverage coverage_source_based))\n.{fuzzer}-{benchmark}-intermediate-runner: base-runner\ndocker build \\\\\n@@ -150,7 +150,7 @@ OSS_FUZZER_BENCHMARK_TEMPLATE = \"\"\"\n.pull-{fuzzer}-{benchmark}-oss-fuzz-builder: .pull-{fuzzer}-{benchmark}-oss-fuzz-builder-intermediate\ndocker pull {base_tag}/builders/{fuzzer}/{benchmark}\n-ifneq ({fuzzer}, coverage)\n+ifeq (,$(filter {fuzzer},coverage coverage_source_based))\n.{fuzzer}-{benchmark}-oss-fuzz-intermediate-runner: base-runner\ndocker build \\\\\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/build/test_builder.py",
"new_path": "experiment/build/test_builder.py",
"diff": "@@ -24,7 +24,7 @@ from experiment.build import builder\nSRC_ROOT = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)\n-FUZZER_BLACKLIST = {'coverage'}\n+COVERAGE_TOOLS = {'coverage', 'coverage_source_based'}\n# pylint: disable=invalid-name,unused-argument,redefined-outer-name\n@@ -43,7 +43,7 @@ def get_oss_fuzz_benchmarks():\ndef get_fuzzers():\n\"\"\"Get all non-blacklisted fuzzers.\"\"\"\n- return get_benchmarks_or_fuzzers('fuzzers', 'fuzzer.py', FUZZER_BLACKLIST)\n+ return get_benchmarks_or_fuzzers('fuzzers', 'fuzzer.py', COVERAGE_TOOLS)\ndef get_benchmarks_or_fuzzers(benchmarks_or_fuzzers_directory, filename,\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/coverage_source_based/builder.Dockerfile",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+ARG parent_image=gcr.io/fuzzbench/base-builder\n+FROM $parent_image\n+\n+# Use a libFuzzer version that supports source-based coverage\n+RUN git clone https://github.com/llvm/llvm-project.git /llvm-project && \\\n+ cd /llvm-project/ && \\\n+ git checkout d8981ce5b9f8caa567613b2bf5aa3095e0156130 && \\\n+ cd compiler-rt/lib/fuzzer && \\\n+ (for f in *.cpp; do \\\n+ clang++ -stdlib=libc++ -fPIC -O2 -std=c++11 $f -c & \\\n+ done && wait) && \\\n+ ar r /usr/lib/libFuzzer.a *.o\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "fuzzers/coverage_source_based/fuzzer.py",
"diff": "+# Copyright 2020 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Integration code for source-based coverage builds.\"\"\"\n+\n+import os\n+\n+from fuzzers import utils\n+\n+\n+def build():\n+ \"\"\"Build benchmark.\"\"\"\n+ cflags = ['-fprofile-instr-generate', '-fcoverage-mapping']\n+ utils.append_flags('CFLAGS', cflags)\n+ utils.append_flags('CXXFLAGS', cflags)\n+\n+ os.environ['CC'] = 'clang'\n+ os.environ['CXX'] = 'clang++'\n+ os.environ['FUZZER_LIB'] = '/usr/lib/libFuzzer.a'\n+\n+ utils.build_benchmark()\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/test_fuzzers.py",
"new_path": "fuzzers/test_fuzzers.py",
"diff": "@@ -21,6 +21,7 @@ import pytest\nfrom common import utils\n# pylint: disable=invalid-name,unused-argument\n+COVERAGE_TOOLS = {'coverage', 'coverage_source_based'}\ndef get_all_fuzzer_dirs():\n@@ -29,7 +30,7 @@ def get_all_fuzzer_dirs():\nreturn [\nfuzzer for fuzzer in os.listdir(fuzzers_dir)\nif (os.path.isfile(os.path.join(fuzzers_dir, fuzzer, 'fuzzer.py')) and\n- fuzzer != 'coverage')\n+ fuzzer not in COVERAGE_TOOLS)\n]\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [clang-coverage] Add build (#424)
Add clang source based coverage build. |
258,399 | 15.06.2020 22:09:20 | 18,000 | 8ce3eb649e838f25d3445195ceee9c46c7ce5266 | [local support] set related environ var for local running
Related to | [
{
"change_type": "MODIFY",
"old_path": "experiment/run_experiment.py",
"new_path": "experiment/run_experiment.py",
"diff": "@@ -287,8 +287,11 @@ def copy_resources_to_bucket(config_dir: str, config: Dict):\nreturn None\nreturn tar_info\n- experiment_filestore_path = os.path.join(config['experiment_filestore'],\n- config['experiment'])\n+ # Set environment variables to use corresponding filestore_utils.\n+ os.environ['EXPERIMENT_FILESTORE'] = config['experiment_filestore']\n+ os.environ['EXPERIMENT'] = config['experiment']\n+ experiment_filestore_path = experiment_utils.get_experiment_filestore_path()\n+\nbase_destination = os.path.join(experiment_filestore_path, 'input')\n# Send the local source repository to the cloud for use by dispatcher.\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [local support] set related environ var for local running (#441)
Related to https://github.com/google/fuzzbench/issues/251 |
258,399 | 15.06.2020 22:50:07 | 18,000 | 5ecbe7ef496c9a879af8d87a9d0726fa650ab383 | [local support] local filestore rsync intermediate folders creation
Also add tests for this behavior.
Related: | [
{
"change_type": "MODIFY",
"old_path": "common/local_filestore.py",
"new_path": "common/local_filestore.py",
"diff": "@@ -73,6 +73,11 @@ def rsync( # pylint: disable=too-many-arguments\ndefaults that can be overriden.\"\"\"\n# Add check to behave like `gsutil.rsync`.\nassert os.path.isdir(source), 'filestore_utils.rsync: source should be dir.'\n+\n+ # Create intermediate folders for `rsync` command to behave like\n+ # `gsutil.rsync`.\n+ filesystem.create_directory(destination)\n+\ncommand = ['rsync']\nif delete:\ncommand.append('--delete')\n"
},
{
"change_type": "MODIFY",
"old_path": "common/test_local_filestore.py",
"new_path": "common/test_local_filestore.py",
"diff": "@@ -59,6 +59,32 @@ def test_cp(tmp_path):\nassert file_handle.read() == data\n+def test_cp_nonexistent_dest(tmp_path):\n+ \"\"\"Tests cp will create intermediate folders for destination.\"\"\"\n+ source_dir = tmp_path / 'source'\n+ source_dir.mkdir()\n+ source_file = source_dir / 'file1'\n+ cp_dest_dir = tmp_path / 'cp_test' / 'intermediate' / 'cp_dest'\n+ with open(source_file, 'w'):\n+ pass\n+\n+ # Should run without exceptions.\n+ local_filestore.cp(str(source_dir), str(cp_dest_dir), recursive=True)\n+\n+\n+def test_rsync_nonexistent_dest(tmp_path):\n+ \"\"\"Tests cp will create intermediate folders for destination.\"\"\"\n+ source_dir = tmp_path / 'source'\n+ source_dir.mkdir()\n+ source_file = source_dir / 'file1'\n+ rsync_dest_dir = tmp_path / 'rsync_test' / 'intermediate' / 'rsync_dest'\n+ with open(source_file, 'w'):\n+ pass\n+\n+ # Should run without exceptions.\n+ local_filestore.rsync(str(source_dir), str(rsync_dest_dir))\n+\n+\nSRC = '/src'\nDST = '/dst'\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [local support] local filestore rsync intermediate folders creation (#440)
Also add tests for this behavior.
Related: #251 |
258,388 | 16.06.2020 09:42:08 | 25,200 | 648a6969a00e89efa90aab7b150d63bb0a6ec8b6 | Add PHP benchmark to service
Add PHP benchmark to service | [
{
"change_type": "MODIFY",
"old_path": "service/automatic_run_experiment.py",
"new_path": "service/automatic_run_experiment.py",
"diff": "@@ -55,6 +55,7 @@ BENCHMARKS = [\n'libpcap_fuzz_both',\n'mbedtls_fuzz_dtlsclient',\n'openssl_x509',\n+ 'php_php-fuzz-parser',\n'sqlite3_ossfuzz',\n'systemd_fuzz-link-parser',\n'zlib_zlib_uncompress_fuzzer',\n"
},
{
"change_type": "MODIFY",
"old_path": "service/test_automatic_run_experiment.py",
"new_path": "service/test_automatic_run_experiment.py",
"diff": "@@ -86,6 +86,7 @@ def test_run_requested_experiment(mocked_get_requested_experiments,\n'libpcap_fuzz_both',\n'mbedtls_fuzz_dtlsclient',\n'openssl_x509',\n+ 'php_php-fuzz-parser',\n'sqlite3_ossfuzz',\n'systemd_fuzz-link-parser',\n'zlib_zlib_uncompress_fuzzer',\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Add PHP benchmark to service (#443)
Add PHP benchmark to service |
258,399 | 16.06.2020 16:54:27 | 18,000 | 552c297719fe8f475ac7291f3585a93dd645f55f | [NFC] typo fix | [
{
"change_type": "MODIFY",
"old_path": "analysis/data_utils.py",
"new_path": "analysis/data_utils.py",
"diff": "@@ -132,7 +132,7 @@ _DEFAULT_FUZZER_SAMPLE_NUM_THRESHOLD = 0.8\ndef get_fuzzers_with_not_enough_samples(\nbenchmark_snapshot_df, threshold=_DEFAULT_FUZZER_SAMPLE_NUM_THRESHOLD):\n- \"\"\"Retruns fuzzers that didn't have enough trials running at snapshot time.\n+ \"\"\"Returns fuzzers that didn't have enough trials running at snapshot time.\nIt takes a benchmark snapshot and finds the fuzzers that have a sample size\nsmaller than 80% of the largest sample size. Default threshold can be\noverridden.\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [NFC] typo fix (#446) |
258,399 | 16.06.2020 20:44:27 | 18,000 | 1ab6a11a1ae397cae494e4d04835340db3064fc7 | [NFC] rename `experiment_path.gcs` to `experiment_path.filestore`
Resolve | [
{
"change_type": "MODIFY",
"old_path": "common/experiment_path.py",
"new_path": "common/experiment_path.py",
"diff": "@@ -23,11 +23,11 @@ def path(*path_segments) -> Path:\nreturn Path(experiment_utils.get_work_dir(), *path_segments)\n-def gcs(path_obj: Path) -> str:\n- \"\"\"Returns a string with WORK_DIR replaced with |bucket|. |path_obj| should\n- be created by path().\"\"\"\n+def filestore(path_obj: Path) -> str:\n+ \"\"\"Returns a string with WORK_DIR replaced with |experiment_filestore_path|.\n+ |path_obj| should be created by path().\"\"\"\npath_str = str(path_obj)\nwork_dir = experiment_utils.get_work_dir()\n- experiment_bucket = experiment_utils.get_experiment_filestore_path()\n+ experiment_filestore_path = experiment_utils.get_experiment_filestore_path()\nassert path_str.startswith(work_dir)\n- return path_str.replace(work_dir, experiment_bucket)\n+ return path_str.replace(work_dir, experiment_filestore_path)\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/build/build_utils.py",
"new_path": "experiment/build/build_utils.py",
"diff": "@@ -29,7 +29,8 @@ def store_build_logs(build_config, build_result):\nbuild_log_filename = build_config + '.txt'\nfilestore_utils.cp(\n- tmp.name, exp_path.gcs(get_build_logs_dir() / build_log_filename))\n+ tmp.name,\n+ exp_path.filestore(get_build_logs_dir() / build_log_filename))\ndef get_coverage_binaries_dir():\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/build/gcb_build.py",
"new_path": "experiment/build/gcb_build.py",
"diff": "@@ -56,7 +56,7 @@ def build_coverage(benchmark):\ndef _build_benchmark_coverage(benchmark: str) -> Tuple[int, str]:\n\"\"\"Build a coverage build of |benchmark| on GCB.\"\"\"\n- coverage_binaries_dir = exp_path.gcs(\n+ coverage_binaries_dir = exp_path.filestore(\nbuild_utils.get_coverage_binaries_dir())\nsubstitutions = {\n'_GCS_COVERAGE_BINARIES_DIR': coverage_binaries_dir,\n@@ -107,7 +107,7 @@ def _build_oss_fuzz_project_coverage(benchmark: str) -> Tuple[int, str]:\n\"\"\"Build a coverage build of OSS-Fuzz-based benchmark |benchmark| on GCB.\"\"\"\nproject = benchmark_utils.get_project(benchmark)\noss_fuzz_builder_hash = benchmark_utils.get_oss_fuzz_builder_hash(benchmark)\n- coverage_binaries_dir = exp_path.gcs(\n+ coverage_binaries_dir = exp_path.filestore(\nbuild_utils.get_coverage_binaries_dir())\nsubstitutions = {\n'_GCS_COVERAGE_BINARIES_DIR': coverage_binaries_dir,\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/build/local_build.py",
"new_path": "experiment/build/local_build.py",
"diff": "@@ -83,7 +83,7 @@ def copy_coverage_binaries(benchmark):\n])\ncoverage_binaries_dir = build_utils.get_coverage_binaries_dir()\ncoverage_build_archive_gcs_path = posixpath.join(\n- exp_path.gcs(coverage_binaries_dir), coverage_build_archive)\n+ exp_path.filestore(coverage_binaries_dir), coverage_build_archive)\nreturn filestore_utils.cp(coverage_build_archive_shared_dir_path,\ncoverage_build_archive_gcs_path)\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/measurer.py",
"new_path": "experiment/measurer.py",
"diff": "@@ -64,7 +64,8 @@ def get_experiment_folders_dir():\ndef exists_in_experiment_filestore(path: pathlib.Path) -> bool:\n\"\"\"Returns True if |path| exists in the experiment_filestore.\"\"\"\n- return filestore_utils.ls(exp_path.gcs(path), must_exist=False).retcode == 0\n+ return filestore_utils.ls(exp_path.filestore(path),\n+ must_exist=False).retcode == 0\ndef measure_loop(experiment: str, max_total_time: int):\n@@ -397,7 +398,7 @@ class SnapshotMeasurer: # pylint: disable=too-many-instance-attributes\nunchanged-cycles file. This file is written to by the trial's runner.\"\"\"\ndef copy_unchanged_cycles_file():\n- unchanged_cycles_filestore_path = exp_path.gcs(\n+ unchanged_cycles_filestore_path = exp_path.filestore(\nself.unchanged_cycles_path)\ntry:\nfilestore_utils.cp(unchanged_cycles_filestore_path,\n@@ -457,7 +458,7 @@ class SnapshotMeasurer: # pylint: disable=too-many-instance-attributes\nwith tarfile.open(archive_path, 'w:gz') as tar:\ntar.add(self.crashes_dir,\narcname=os.path.basename(self.crashes_dir))\n- archive_filestore_path = exp_path.gcs(\n+ archive_filestore_path = exp_path.filestore(\nposixpath.join(self.trial_dir, 'crashes', crashes_archive_name))\nfilestore_utils.cp(archive_path, archive_filestore_path)\nos.remove(archive_path)\n@@ -533,7 +534,7 @@ def measure_snapshot_coverage(fuzzer: str, benchmark: str, trial_num: int,\ncorpus_archive_dst = os.path.join(\nsnapshot_measurer.trial_dir, 'corpus',\nexperiment_utils.get_corpus_archive_name(cycle))\n- corpus_archive_src = exp_path.gcs(corpus_archive_dst)\n+ corpus_archive_src = exp_path.filestore(corpus_archive_dst)\ncorpus_archive_dir = os.path.dirname(corpus_archive_dst)\nif not os.path.exists(corpus_archive_dir):\n@@ -590,7 +591,8 @@ def set_up_coverage_binary(benchmark):\nif not os.path.exists(benchmark_coverage_binary_dir):\nos.mkdir(benchmark_coverage_binary_dir)\narchive_name = 'coverage-build-%s.tar.gz' % benchmark\n- archive_filestore_path = exp_path.gcs(coverage_binaries_dir / archive_name)\n+ archive_filestore_path = exp_path.filestore(coverage_binaries_dir /\n+ archive_name)\nfilestore_utils.cp(archive_filestore_path,\nstr(benchmark_coverage_binary_dir))\narchive_path = benchmark_coverage_binary_dir / archive_name\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [NFC] rename `experiment_path.gcs` to `experiment_path.filestore` (#451)
Resolve #447. |