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
12.01.2021 07:59:24
28,800
51cdf447225cc76238e5fe7875507617ebc56101
[run_experiment] Add argument for allowing uncommitted changes Also: 1. Improve presubmit. 2. Use parent class to save code and fix type error.
[ { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "@@ -59,6 +59,9 @@ docker/generated.mk: docker/generate_makefile.py docker/image_types.yaml fuzzers\npresubmit: install-dependencies\nsource ${VENV_ACTIVATE} && python3 presubmit.py\n+test: install-dependencies\n+ source ${VENV_ACTIVATE} && python3 presubmit.py test\n+\nformat: install-dependencies\nsource ${VENV_ACTIVATE} && python3 presubmit.py format\n" }, { "change_type": "MODIFY", "old_path": "experiment/run_experiment.py", "new_path": "experiment/run_experiment.py", "diff": "@@ -186,7 +186,7 @@ def set_up_experiment_config_file(config):\nyaml.dump(config, experiment_config_file, default_flow_style=False)\n-def check_no_local_changes():\n+def check_no_uncommitted_changes():\n\"\"\"Make sure that there are no uncommitted changes.\"\"\"\nassert not subprocess.check_output(\n['git', 'diff'],\n@@ -208,9 +208,11 @@ def start_experiment( # pylint: disable=too-many-arguments\ndescription: str = None,\nno_seeds=False,\nno_dictionaries=False,\n- oss_fuzz_corpus=False):\n+ oss_fuzz_corpus=False,\n+ allow_uncommitted_changes=False):\n\"\"\"Start a fuzzer benchmarking experiment.\"\"\"\n- check_no_local_changes()\n+ if not allow_uncommitted_changes:\n+ check_no_uncommitted_changes()\nvalidate_experiment_name(experiment_name)\nvalidate_benchmarks(benchmarks)\n@@ -314,13 +316,11 @@ class BaseDispatcher:\nraise NotImplementedError\n-class LocalDispatcher:\n+class LocalDispatcher(BaseDispatcher):\n\"\"\"Class representing the local dispatcher.\"\"\"\ndef __init__(self, config: Dict):\n- self.config = config\n- self.instance_name = experiment_utils.get_dispatcher_instance_name(\n- config['experiment'])\n+ super().__init__(config)\nself.process = None\ndef start(self):\n@@ -499,6 +499,12 @@ def main():\nrequired=False,\ndefault=False,\naction='store_true')\n+ parser.add_argument('-a',\n+ '--allow-uncommitted-changes',\n+ help='Skip check that no uncommited changes made.',\n+ required=False,\n+ default=False,\n+ action='store_true')\nparser.add_argument(\n'-o',\n'--oss-fuzz-corpus',\n@@ -516,7 +522,8 @@ def main():\ndescription=args.description,\nno_seeds=args.no_seeds,\nno_dictionaries=args.no_dictionaries,\n- oss_fuzz_corpus=args.oss_fuzz_corpus)\n+ oss_fuzz_corpus=args.oss_fuzz_corpus,\n+ allow_uncommitted_changes=args.allow_uncommitted_changes)\nreturn 0\n" }, { "change_type": "MODIFY", "old_path": "presubmit.py", "new_path": "presubmit.py", "diff": "@@ -68,6 +68,10 @@ _IGNORE_DIRECTORIES = [\nBASE_PYTEST_COMMAND = ['python3', '-m', 'pytest', '-vv']\n+NON_DEFAULT_CHECKS = {\n+ 'test_changed_integrations',\n+}\n+\ndef get_containing_subdir(path: Path, parent_path: Path) -> Optional[str]:\n\"\"\"Return the subdirectory of |parent_path| that contains |path|.\n@@ -350,33 +354,38 @@ def filter_ignored_files(paths: List[Path]) -> List[Path]:\nreturn [path for path in paths if not is_path_ignored(path)]\n-def do_tests() -> bool:\n- \"\"\"Run all unittests.\"\"\"\n+def pytest(_) -> bool:\n+ \"\"\"Run all unittests using pytest.\"\"\"\nreturncode = subprocess.run(BASE_PYTEST_COMMAND, check=False).returncode\nreturn returncode == 0\n-def do_checks(file_paths: List[Path]) -> bool:\n- \"\"\"Return False if any presubmit check fails.\"\"\"\n- success = True\n-\n+def validate_fuzzers_and_benchmarks(file_paths: List[Path]):\n+ \"\"\"Validate fuzzers and benchmarks.\"\"\"\nfuzzer_and_benchmark_validator = FuzzerAndBenchmarkValidator()\npath_valid_statuses = [\nfuzzer_and_benchmark_validator.validate(path) for path in file_paths\n]\n- if not all(path_valid_statuses):\n- success = False\n+ return all(path_valid_statuses)\n+\n+\n+def do_default_checks(file_paths: List[Path], checks) -> bool:\n+ \"\"\"Do default presubmit checks and return False if any presubmit check\n+ fails.\"\"\"\n+ failed_checks = []\n+ for check_name, check in checks:\n+ if check_name in NON_DEFAULT_CHECKS:\n+ continue\n- checks = [license_check, yapf, lint, pytype, validate_experiment_requests]\n- for check in checks:\nif not check(file_paths):\n- print('ERROR: %s failed, see errors above.' % check.__name__)\n- success = False\n+ print('ERROR: %s failed, see errors above.' % check_name)\n+ failed_checks.append(check_name)\n- if not do_tests():\n- success = False\n+ if failed_checks:\n+ print('Failed checks: %s' % ' '.join(failed_checks))\n+ return False\n- return success\n+ return True\ndef bool_to_returncode(success: bool) -> int:\n@@ -389,58 +398,89 @@ def bool_to_returncode(success: bool) -> int:\nreturn 1\n-def main() -> int:\n- \"\"\"Check that this branch conforms to the standards of fuzzbench.\"\"\"\n+def get_args(command_check_mapping):\n+ \"\"\"Get arguments passed to program.\"\"\"\nparser = argparse.ArgumentParser(\ndescription='Presubmit script for fuzzbench.')\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=command_check_mapping.keys(),\n+ choices=dict(command_check_mapping).keys(),\nnargs='?',\n- help='The presubmit check to run. Defaults to all of them')\n+ help='The presubmit check to run. Defaults to most of them.')\nparser.add_argument('--all-files',\naction='store_true',\nhelp='Run presubmit check(s) on all files',\ndefault=False)\nparser.add_argument('-v', '--verbose', action='store_true', default=False)\n- args = parser.parse_args()\n+ return parser.parse_args()\n- os.chdir(_SRC_ROOT)\n- if not args.verbose:\n+def initialize_logs(verbose: bool):\n+ \"\"\"Initialize logging.\"\"\"\n+ if not verbose:\nlogs.initialize()\nelse:\nlogs.initialize(log_level=logging.DEBUG)\n- if not args.all_files:\n+\n+def get_relevant_files(all_files: bool) -> List[Path]:\n+ \"\"\"Get the files that should be checked.\"\"\"\n+ if not all_files:\nrelevant_files = [Path(path) for path in diff_utils.get_changed_files()]\nelse:\nrelevant_files = get_all_files()\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))\n+ return filter_ignored_files(relevant_files)\n- if not args.command:\n- success = do_checks(relevant_files)\n- return bool_to_returncode(success)\n- check = command_check_mapping[args.command]\n- if args.command == 'format':\n+def do_single_check(command: str, relevant_files: List[Path],\n+ command_check_mapping) -> bool:\n+ \"\"\"Do a single check requested by a command.\"\"\"\n+ check = dict(command_check_mapping)[command]\n+ if command == 'format':\nsuccess = check(relevant_files, False)\nelse:\nsuccess = check(relevant_files)\nif not success:\nprint('ERROR: %s failed, see errors above.' % check.__name__)\n+\n+ return success\n+\n+\n+def main() -> int:\n+ \"\"\"Check that this branch conforms to the standards of fuzzbench.\"\"\"\n+\n+ # Use list of tuples so order is preserved.\n+ command_check_mapping = [\n+ ('licensecheck', license_check),\n+ ('format', yapf),\n+ ('lint', lint),\n+ ('typecheck', pytype),\n+ ('test', pytest),\n+ ('validate_fuzzers_and_benchmarks', validate_fuzzers_and_benchmarks),\n+ ('validate_experiment_requests', validate_experiment_requests),\n+ ('test_changed_integrations', test_changed_integrations),\n+ ]\n+\n+ args = get_args(command_check_mapping)\n+\n+ os.chdir(_SRC_ROOT)\n+\n+ initialize_logs(args.verbose)\n+\n+ relevant_files = get_relevant_files(args.all_files)\n+\n+ logs.debug('Running presubmit check(s) on: %s',\n+ ' '.join(str(path) for path in relevant_files))\n+\n+ if not args.command:\n+ # Do default checks.\n+ success = do_default_checks(relevant_files, command_check_mapping)\n+ return bool_to_returncode(success)\n+\n+ success = do_single_check(args.command, relevant_files,\n+ command_check_mapping)\nreturn bool_to_returncode(success)\n" } ]
Python
Apache License 2.0
google/fuzzbench
[run_experiment] Add argument for allowing uncommitted changes (#1027) Also: 1. Improve presubmit. 2. Use parent class to save code and fix type error.
258,388
19.01.2021 06:12:13
28,800
83c98788b2bcce47ed497a7ea07c668c51911a23
Use secret manager to reuse service account keys Use secret manager to store service account keys and reuse them instead of recreating them every experiment. Document new API for cloud users.
[ { "change_type": "MODIFY", "old_path": "common/gcloud.py", "new_path": "common/gcloud.py", "diff": "@@ -148,3 +148,9 @@ def delete_instance_template(template_name: str):\n'gcloud', 'compute', 'instance-templates', 'delete', template_name\n]\nreturn new_process.execute(command)\n+\n+\n+def get_account():\n+ \"\"\"Returns the email address of the current account being used.\"\"\"\n+ return new_process.execute(['gcloud', 'config', 'get-value',\n+ 'account']).output.strip()\n" }, { "change_type": "MODIFY", "old_path": "docker/dispatcher-image/startup-dispatcher.sh", "new_path": "docker/dispatcher-image/startup-dispatcher.sh", "diff": "@@ -28,15 +28,9 @@ tar -xvzf ${WORK}/src.tar.gz -C ${WORK}/src\n# Set up credentials locally as cloud metadata service does not scale.\ncredentials_file=${WORK}/creds.json\n-iam_account=`gcloud config get-value account`\n-gcloud iam service-accounts keys create ${credentials_file} \\\n- --iam-account=${iam_account}\n+PYTHONPATH=${WORK}/src python3 \\\n+ ${WORK}/src/experiment/cloud/service_account_key.py $credentials_file $CLOUD_PROJECT\n# Start dispatcher.\nPYTHONPATH=${WORK}/src GOOGLE_APPLICATION_CREDENTIALS=${credentials_file} \\\npython3 \"${WORK}/src/experiment/dispatcher.py\"\n-\n-# Revoke created credentials.\n-key_id=$(cat \"${credentials_file}\" | jq -r \".private_key_id\")\n-gcloud iam service-accounts keys delete ${key_id} -q \\\n- --iam-account=${iam_account}\n" }, { "change_type": "MODIFY", "old_path": "docs/running-a-cloud-experiment/setting_up_a_google_cloud_project.md", "new_path": "docs/running-a-cloud-experiment/setting_up_a_google_cloud_project.md", "diff": "@@ -160,6 +160,9 @@ optimized for doing so.\n* [Enable Cloud SQL Admin API](https://console.cloud.google.com/apis/library/sqladmin.googleapis.com)\nso that FuzzBench can connect to the database.\n+* [Enable Secret Manager API](https://console.cloud.google.com/apis/library/secretmanager.googleapis.com)\n+so that FuzzBench can store service account keys.\n+\n## Configure networking\n* Go to the networking page for the network you want to run your experiment in.\n" }, { "change_type": "ADD", "old_path": null, "new_path": "experiment/cloud/secret_manager.py", "diff": "+# Copyright 2021 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+\"\"\"Module for dealing with the Google Cloud secret manager.\"\"\"\n+import posixpath\n+\n+from google.cloud import secretmanager\n+\n+\n+def get_secret_manager_client():\n+ \"\"\"Returns the secretmanager client.\"\"\"\n+ return secretmanager.SecretManagerServiceClient()\n+\n+\n+def get_parent_resource(project):\n+ \"\"\"Returns the parent resource.\"\"\"\n+ return f'projects/{project}'\n+\n+\n+def _create_secret(client, secret_id, project):\n+ \"\"\"Creates and returns a secret (identified by |secret_id| for |project|)\n+ using |client.\"\"\"\n+ client = get_secret_manager_client()\n+ parent = get_parent_resource(project)\n+ return client.create_secret(\n+ request={\n+ 'parent': parent,\n+ 'secret_id': secret_id,\n+ 'secret': {\n+ 'replication': {\n+ 'automatic': {}\n+ }\n+ },\n+ })\n+\n+\n+def save(secret_id, value, project):\n+ \"\"\"Saves |value| using |secret_id| in |project|.\"\"\"\n+ client = get_secret_manager_client()\n+ secret = _create_secret(client, secret_id, project)\n+ client.add_secret_version(request={\n+ 'parent': secret.name,\n+ 'payload': {\n+ 'data': value\n+ }\n+ })\n+\n+\n+def get(secret_id, project):\n+ \"\"\"Returns the value of the secret identified by |secret_id| in\n+ |project|.\"\"\"\n+ parent = get_parent_resource(project)\n+ name = posixpath.join(parent, 'secrets', secret_id, 'versions', '1')\n+ client = get_secret_manager_client()\n+ response = client.access_secret_version(request={'name': name})\n+ return response.payload.data\n" }, { "change_type": "ADD", "old_path": null, "new_path": "experiment/cloud/service_account_key.py", "diff": "+# Copyright 2021 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 getting a service account key for use in an experiment.\"\"\"\n+import sys\n+import base64\n+import json\n+\n+import google.api_core.exceptions\n+import google.auth\n+import googleapiclient.discovery\n+\n+from common import filesystem\n+from common import gcloud\n+from common import logs\n+from experiment.cloud import secret_manager\n+\n+SECRET_ID = 'service-account-key'\n+\n+\n+def get_iam_service():\n+ \"\"\"Returns the IAM Google Cloud service.\"\"\"\n+ credentials, _ = google.auth.default()\n+ return googleapiclient.discovery.build('iam', 'v1', credentials=credentials)\n+\n+\n+def create_key(project):\n+ \"\"\"Creates a service account key in |project|.\"\"\"\n+ service = get_iam_service()\n+ account = gcloud.get_account()\n+ name = f'projects/{project}/serviceAccounts/{account}'\n+ key = service.projects().serviceAccounts().keys().create( # pylint: disable=no-member\n+ name=name, body={}).execute()\n+ # Load and dump json to remove formatting.\n+ return str.encode(\n+ json.dumps(json.loads(base64.b64decode(key['privateKeyData']))))\n+\n+\n+def get_or_create_key(project, file_path):\n+ \"\"\"Gets the service account key (for |project|) from the secret manager and\n+ saves it to |file_path| or creates one, saves it using the secretmanager\n+ (for future use) and saves it to |file_path|.\"\"\"\n+ try:\n+ service_account_key = secret_manager.get(SECRET_ID, project)\n+ except google.api_core.exceptions.NotFound:\n+ service_account_key = create_key(project)\n+ secret_manager.save(SECRET_ID, service_account_key, project)\n+ filesystem.write(file_path, service_account_key, 'wb')\n+\n+\n+def main():\n+ \"\"\"Creates or gets an already created service account key and saves it to\n+ the provided path.\"\"\"\n+ logs.initialize()\n+ try:\n+ keyfile = sys.argv[1]\n+ get_or_create_key(sys.argv[2], keyfile)\n+ logs.info('Saved key to %s.', keyfile)\n+ except Exception: # pylint: disable=broad-except\n+ logs.error('Failed to get or create key.')\n+ return 1\n+ return 0\n+\n+\n+if __name__ == '__main__':\n+ sys.exit(main())\n" }, { "change_type": "MODIFY", "old_path": "requirements.txt", "new_path": "requirements.txt", "diff": "@@ -3,6 +3,7 @@ google-api-python-client==1.8.2\ngoogle-auth==1.24.0\ngoogle-cloud-error-reporting==0.33.0\ngoogle-cloud-logging==1.14.0\n+google-cloud-secret-manager==2.1.0\nclusterfuzz==0.0.1a0\nJinja2==2.11.1\nnumpy==1.18.1\n" } ]
Python
Apache License 2.0
google/fuzzbench
Use secret manager to reuse service account keys (#1039) Use secret manager to store service account keys and reuse them instead of recreating them every experiment. Document new API for cloud users.
258,390
27.01.2021 02:19:00
-3,600
873723e8e1487a46c3aedc2717aeeafe5f5f5a4d
Update honggfuzz to the newest version (d9482931f22e532ae1948e4eb933e5d6c2c52ead)
[ { "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 + 1ec27b2e3652e6c0c94c28f547226a2dc6009f04\n+# Download honggfuz version 2.3.1 + d9482931f22e532ae1948e4eb933e5d6c2c52ead\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 1ec27b2e3652e6c0c94c28f547226a2dc6009f04 && \\\n+ git checkout d9482931f22e532ae1948e4eb933e5d6c2c52ead && \\\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 (d9482931f22e532ae1948e4eb933e5d6c2c52ead) (#1053)
258,388
28.01.2021 08:25:56
28,800
8e9823ebe203808187d2f8d9e60bdfcba6f5db4a
[run_experiment] Log more when we fail to create dispatcher.
[ { "change_type": "MODIFY", "old_path": "common/gcloud.py", "new_path": "common/gcloud.py", "diff": "@@ -19,6 +19,7 @@ import subprocess\nfrom typing import List\nfrom common import experiment_utils\n+from common import logs\nfrom common import new_process\n# Constants for dispatcher specs.\n@@ -86,7 +87,13 @@ def create_instance(instance_name: str,\ncommand.extend(\n['--metadata-from-file', 'startup-script=' + startup_script])\n- return new_process.execute(command, expect_zero=False, **kwargs)[0] == 0\n+ result = new_process.execute(command, expect_zero=False, **kwargs)\n+ if result.retcode == 0:\n+ return True\n+\n+ logs.info('Failed to create instance. Command: %s failed. Output: %s',\n+ command, result.output)\n+ return False\ndef delete_instances(instance_names: List[str], zone: str, **kwargs) -> bool:\n" }, { "change_type": "MODIFY", "old_path": "experiment/run_experiment.py", "new_path": "experiment/run_experiment.py", "diff": "@@ -339,7 +339,6 @@ class LocalDispatcher(BaseDispatcher):\ndef start(self):\n\"\"\"Start the experiment on the dispatcher.\"\"\"\ncontainer_name = 'dispatcher-container'\n- logs.info('Started dispatcher with container name: %s', container_name)\nexperiment_filestore_path = os.path.abspath(\nself.config['experiment_filestore'])\nfilesystem.create_directory(experiment_filestore_path)\n@@ -406,6 +405,7 @@ class LocalDispatcher(BaseDispatcher):\n'${WORK}/src/experiment/dispatcher.py || '\n'/bin/bash' # Open shell if experiment fails.\n]\n+ logs.info('Starting dispatcher with container name: %s', container_name)\nreturn new_process.execute(command, write_to_stdout=True)\n@@ -414,15 +414,16 @@ class GoogleCloudDispatcher(BaseDispatcher):\ndef start(self):\n\"\"\"Start the experiment on the dispatcher.\"\"\"\n- logs.info('Started dispatcher with instance name: %s',\n- self.instance_name)\nwith tempfile.NamedTemporaryFile(dir=os.getcwd(),\nmode='w') as startup_script:\nself.write_startup_script(startup_script)\n- gcloud.create_instance(self.instance_name,\n+ if not gcloud.create_instance(self.instance_name,\ngcloud.InstanceType.DISPATCHER,\nself.config,\n- startup_script=startup_script.name)\n+ startup_script=startup_script.name):\n+ raise Exception('Failed to create dispatcher.')\n+ logs.info('Started dispatcher with instance name: %s',\n+ self.instance_name)\ndef _render_startup_script(self):\n\"\"\"Renders the startup script template and returns the result as a\n" } ]
Python
Apache License 2.0
google/fuzzbench
[run_experiment] Log more when we fail to create dispatcher. (#1055)
258,388
28.01.2021 08:26:54
28,800
afadc8d036d3ca0ace0436959cd0bffd3573b69c
Replace terms with more inclusive ones.
[ { "change_type": "MODIFY", "old_path": ".pylintrc", "new_path": ".pylintrc", "diff": "# run arbitrary code.\nextension-pkg-whitelist=\n-# Add files or directories to the blacklist. They should be base names, not\n+# Add files or directories to the blocklist. They should be base names, not\n# paths.\n#\n# Files under alembic are generated and are nonconforming.\nignore=alembic\n-# Add files or directories matching the regex patterns to the blacklist. The\n+# Add files or directories matching the regex patterns to the blocklist. The\n# regex matches against base names, not paths.\nignore-patterns=\n" }, { "change_type": "MODIFY", "old_path": "common/gsutil.py", "new_path": "common/gsutil.py", "diff": "@@ -71,9 +71,9 @@ def rsync( # pylint: disable=too-many-arguments\ngsutil_options=None,\noptions=None,\nparallel=False):\n- \"\"\"Does gsutil rsync from |source| to |destination| using sane defaults that\n- can be overriden. Prepends any |gsutil_options| before the rsync subcommand\n- if provided.\"\"\"\n+ \"\"\"Does gsutil rsync from |source| to |destination| using useful defaults\n+ that can be overriden. Prepends any |gsutil_options| before the rsync\n+ subcommand if provided.\"\"\"\ncommand = [] if gsutil_options is None else gsutil_options\ncommand.append('rsync')\nif delete:\n" }, { "change_type": "MODIFY", "old_path": "common/local_filestore.py", "new_path": "common/local_filestore.py", "diff": "@@ -70,7 +70,7 @@ def rsync( # pylint: disable=too-many-arguments\ngsutil_options=None, # pylint: disable=unused-argument\noptions=None,\nparallel=False): # pylint: disable=unused-argument\n- \"\"\"Does local_filestore rsync from |source| to |destination| using sane\n+ \"\"\"Does local_filestore rsync from |source| to |destination| using useful\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" }, { "change_type": "MODIFY", "old_path": "experiment/build/test_builder.py", "new_path": "experiment/build/test_builder.py", "diff": "@@ -30,26 +30,26 @@ COVERAGE_TOOLS = {'coverage', 'coverage_source_based'}\ndef get_regular_benchmarks():\n- \"\"\"Get all non-blacklisted, non-OSS-Fuzz benchmarks.\"\"\"\n- return get_benchmarks_or_fuzzers('benchmarks', 'build.sh', blacklist=set())\n+ \"\"\"Get all non-blocklisted, non-OSS-Fuzz benchmarks.\"\"\"\n+ return get_benchmarks_or_fuzzers('benchmarks', 'build.sh', blocklist=set())\ndef get_oss_fuzz_benchmarks():\n- \"\"\"Get all non-blacklisted OSS-Fuzz benchmarks.\"\"\"\n+ \"\"\"Get all non-blocklisted OSS-Fuzz benchmarks.\"\"\"\nreturn get_benchmarks_or_fuzzers('benchmarks',\n'benchmark.yaml',\n- blacklist=set())\n+ blocklist=set())\ndef get_fuzzers():\n- \"\"\"Get all non-blacklisted fuzzers.\"\"\"\n+ \"\"\"Get all non-blocklisted fuzzers.\"\"\"\nreturn get_benchmarks_or_fuzzers('fuzzers', 'fuzzer.py', COVERAGE_TOOLS)\ndef get_benchmarks_or_fuzzers(benchmarks_or_fuzzers_directory, filename,\n- blacklist):\n+ blocklist):\n\"\"\"Get all fuzzers or benchmarks from |benchmarks_or_fuzzers_directory| that\n- are not in |blacklist|. Assume something is a fuzzer or benchmark if it is a\n+ are not in |blocklist|. Assume something is a fuzzer or benchmark if it is a\ndirectory and\n|benchmarks_or_fuzzers_directory|/$FUZZER_OR_BENCHMARK_NAME/|filename|\nexists.\"\"\"\n@@ -57,13 +57,14 @@ def get_benchmarks_or_fuzzers(benchmarks_or_fuzzers_directory, filename,\nbenchmarks_or_fuzzers_directory)\nreturn [\ndirectory for directory in os.listdir(parent_directory_path)\n- if (directory not in blacklist and os.path.exists(\n+ if (directory not in blocklist and os.path.exists(\nos.path.join(parent_directory_path, directory, filename)))\n]\[email protected](sys.version_info.minor > 7,\n- reason='Test can hang on versions greater than 3.7')\n+ reason='Test can stop responding on versions greater than '\n+ '3.7')\[email protected]('experiment.build.builder.build_measurer')\[email protected]('time.sleep')\[email protected]('build_measurer_return_value', [True, False])\n" }, { "change_type": "MODIFY", "old_path": "experiment/test_dispatcher.py", "new_path": "experiment/test_dispatcher.py", "diff": "@@ -138,8 +138,8 @@ def test_build_images_for_trials_benchmark_fail(_, dispatcher_experiment):\nreturn_value=[successful_benchmark]):\nwith mock.patch('experiment.build.builder.build_all_fuzzer_benchmarks',\nside_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+ # Check this test so that we know we are actually testing behavior\n+ # when benchmarks fail.\nassert len(set(dispatcher_experiment.benchmarks)) > 1\ntrials = dispatcher.build_images_for_trials(\ndispatcher_experiment.fuzzers, dispatcher_experiment.benchmarks,\n" }, { "change_type": "MODIFY", "old_path": "fuzzers/aflcc/fuzzer.py", "new_path": "fuzzers/aflcc/fuzzer.py", "diff": "@@ -295,7 +295,7 @@ def fuzz(input_corpus, output_corpus, target_binary):\ntarget=run_fuzzer,\nargs=(input_corpus, output_corpus,\n'{target}-original'.format(target=target_binary),\n- ['-S', 'slave-original']))\n+ ['-S', 'secondary-original']))\nafl_fuzz_thread1.start()\nprint('[run_fuzzer] Running AFL for normalized and optimized dictionary')\n@@ -303,12 +303,12 @@ def fuzz(input_corpus, output_corpus, target_binary):\ntarget=run_fuzzer,\nargs=(input_corpus, output_corpus,\n'{target}-normalized-none-nopt'.format(target=target_binary),\n- ['-S', 'slave-normalized-nopt']))\n+ ['-S', 'secondary-normalized-nopt']))\nafl_fuzz_thread2.start()\nprint('[run_fuzzer] Running AFL for FBSP and optimized dictionary')\nrun_fuzzer(input_corpus,\noutput_corpus,\n'{target}-no-collision-all-opt'.format(target=target_binary),\n- ['-S', 'slave-no-collision-all-opt'],\n+ ['-S', 'secondary-no-collision-all-opt'],\nhide_output=False)\n" }, { "change_type": "MODIFY", "old_path": "fuzzers/aflplusplus/fuzzer.py", "new_path": "fuzzers/aflplusplus/fuzzer.py", "diff": "@@ -35,7 +35,7 @@ def build(*args): # pylint: disable=too-many-branches,too-many-statements\nif 'BUILD_MODES' in os.environ:\nbuild_modes = os.environ['BUILD_MODES'].split(',')\n- # Dummy comment.\n+ # Placeholder comment.\nbuild_directory = os.environ['OUT']\n# If nothing was set this is the default:\n" }, { "change_type": "MODIFY", "old_path": "src_analysis/fuzzer_dependencies.py", "new_path": "src_analysis/fuzzer_dependencies.py", "diff": "# limitations under the License.\n\"\"\"Module for finding dependencies of fuzzers, and fuzzers that are\ndependent on given files.\n-This module assumes that a fuzzer module's imports are done in a sane,\n-normal way. It will not work on non-toplevel imports.\n+This module assumes that a fuzzer module's imports are done in a normal way. It\n+will not work on non-toplevel imports.\nThe following style of imports are supported:\n1. from fuzzers.afl import fuzzer\n2. from fuzzers.afl import fuzzer as afl_fuzzer\n@@ -116,9 +116,9 @@ def _get_python_dependencies(module: types.ModuleType,\nmodule_path = inspect.getfile(module)\n# Just get the dependencies from the cache if we have them.\n- # This would break on modules doing crazy things like writing Python files\n- # and then importing them, code review should prevent that from landing\n- # though.\n+ # This would break on modules doing abnormal things like writing Python\n+ # files and then importing them, code review should prevent that from\n+ # landing though.\nif module_path in PY_DEPENDENCIES_CACHE:\nreturn PY_DEPENDENCIES_CACHE[module_path]\n" } ]
Python
Apache License 2.0
google/fuzzbench
Replace terms with more inclusive ones. (#1051)
258,382
29.01.2021 11:18:11
18,000
53e89c3182e587262479dd9a36e25b0facf30de4
Neuzz integration * Neuzz integration Build succeds for all benchmarks except for arrow. * Fixing noted issues. * Linted. * Adding neuzz to yml Not sure, should I add neuzz here to keep the layout? Or just add to the end?
[ { "change_type": "MODIFY", "old_path": ".github/workflows/fuzzers.yml", "new_path": ".github/workflows/fuzzers.yml", "diff": "@@ -33,6 +33,7 @@ jobs:\n- libfuzzer\n- manul\n- mopt\n+ - neuzz\n# Binary-only (greybox) fuzzers.\n- eclipser\n- afl_qemu\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/arrow_parquet-arrow-fuzz/benchmark.yaml", "new_path": "benchmarks/arrow_parquet-arrow-fuzz/benchmark.yaml", "diff": "@@ -11,3 +11,4 @@ unsupported_fuzzers:\n- honggfuzz_qemu\n- klee\n- weizz_qemu\n+ - neuzz\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/neuzz/builder.Dockerfile", "diff": "+\n+# Copyright 2021 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\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 82b5e359463238d790cadbe2dd494d6a4928bff3 && \\\n+ AFL_NO_X86=1 make\n+\n+# Download and compile neuzz.\n+# Use Ammar's repo with patch for ASan and other bug fixes.\n+# See https://github.com/Dongdongshe/neuzz/pull/16.\n+RUN git clone https://github.com/ammaraskar/neuzz.git /neuzz && \\\n+ cd /neuzz && \\\n+ git checkout e93c7a4c625aa1a17ae2f99e5902d62a46eaa068 && \\\n+ clang -O3 -funroll-loops ./neuzz.c -o neuzz\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 /libNeuzz.a *.o\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/neuzz/fuzzer.py", "diff": "+# Copyright 2021 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 os\n+import shutil\n+import subprocess\n+import time\n+import threading\n+\n+from fuzzers import utils\n+from fuzzers.afl import fuzzer as afl\n+\n+WARMUP = 60 * 60\n+\n+\n+def prepare_build_environment():\n+ \"\"\"Set environment variables used to build targets for AFL-based\n+ fuzzers.\"\"\"\n+ utils.set_compilation_flags()\n+ os.environ['CC'] = '/afl/afl-clang'\n+ os.environ['CXX'] = '/afl/afl-clang++'\n+ os.environ['FUZZER_LIB'] = '/libNeuzz.a'\n+\n+\n+def build():\n+ \"\"\"Build benchmark.\"\"\"\n+ prepare_build_environment()\n+ utils.build_benchmark()\n+ output_directory = os.environ['OUT']\n+ # Copy out the afl-fuzz binary as a build artifact.\n+ print('[post_build] Copying afl-fuzz to $OUT directory')\n+ shutil.copy('/afl/afl-fuzz', output_directory)\n+ # Neuzz also requires afl-showmap.\n+ print('[post_build] Copying afl-showmap to $OUT directory')\n+ shutil.copy('/afl/afl-showmap', output_directory)\n+ # Copy the Neuzz fuzzer itself.\n+ print('[post_build] Copy neuzz fuzzer.')\n+ shutil.copy('/neuzz/neuzz', output_directory)\n+ shutil.copy('/neuzz/nn.py', output_directory)\n+\n+\n+def kill_afl(output_stream=subprocess.DEVNULL):\n+ \"\"\"kill afl-fuzz process.\"\"\"\n+ print(\"Warmed up!\")\n+ # Can't avoid this because 'run_afl_fuzz' doesn't return a handle to\n+ # 'afl-fuzz' process so that we can kill it with subprocess.terminate()\n+ subprocess.call([\"pkill\", \"-f\", \"afl-fuzz\"],\n+ stdout=output_stream,\n+ stderr=output_stream)\n+\n+\n+def run_neuzz(input_corpus,\n+ output_corpus,\n+ target_binary,\n+ additional_flags=None,\n+ hide_output=False):\n+ \"\"\"Run neuzz\"\"\"\n+ # Spawn the afl fuzzing process for warmup\n+ output_stream = subprocess.DEVNULL if hide_output else None\n+ threading.Timer(20, kill_afl, [output_stream]).start()\n+ afl.run_afl_fuzz(input_corpus, output_corpus, target_binary,\n+ additional_flags, hide_output)\n+ # After warming up, copy the 'queue' to use for neuzz input\n+ print(\"[run_neuzz] Warmed up!\")\n+ command = [\n+ \"cp\", \"-RT\", f\"{output_corpus}/queue/\", f\"{input_corpus}_neuzzin/\"\n+ ]\n+ print('[run_neuzz] Running command: ' + ' '.join(command))\n+\n+ subprocess.check_call(command, stdout=output_stream, stderr=output_stream)\n+\n+ afl_output_dir = os.path.join(output_corpus, 'queue')\n+ neuzz_input_dir = os.path.join(output_corpus, 'neuzz_in')\n+ # Treat afl's queue folder as the input for Neuzz.\n+ os.rename(afl_output_dir, neuzz_input_dir)\n+\n+ # Spinning up the neural network\n+ command = [\n+ \"python2\", \"./nn.py\", '--output-folder', afl_output_dir, target_binary\n+ ]\n+ print('[run_neuzz] Running command: ' + ' '.join(command))\n+ subprocess.Popen(command, stdout=output_stream, stderr=output_stream)\n+ time.sleep(40)\n+ target_rel_path = os.path.relpath(target_binary, os.getcwd())\n+ # Spinning up neuzz\n+ command = [\n+ \"./neuzz\", \"-m\", \"none\", \"-i\", neuzz_input_dir, \"-o\", afl_output_dir,\n+ target_rel_path, \"@@\"\n+ ]\n+ print('[run_neuzz] Running command: ' + ' '.join(command))\n+ neuzz_proc = subprocess.Popen(command,\n+ stdout=output_stream,\n+ stderr=output_stream)\n+ neuzz_proc.wait()\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run afl-fuzz on target.\"\"\"\n+ afl.prepare_fuzz_environment(input_corpus)\n+ run_neuzz(input_corpus, output_corpus, target_binary)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/neuzz/runner.Dockerfile", "diff": "+# Copyright 2021 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-image\n+\n+RUN apt-get update && \\\n+ apt-get install wget -y && \\\n+ apt-get install python-pip -y && \\\n+ python --version && \\\n+ python -m pip install --upgrade pip==20.3 && \\\n+ python -m pip install tensorflow==1.8.0 && \\\n+ python -m pip install keras==2.2.3\n" } ]
Python
Apache License 2.0
google/fuzzbench
Neuzz integration (#1056) * Neuzz integration Build succeds for all benchmarks except for arrow. * Fixing noted issues. * Linted. * Adding neuzz to yml Not sure, should I add neuzz here to keep the layout? Or just add to the end?
258,390
01.02.2021 15:40:32
-3,600
00b85975f8b2db8a99c21cf1cb1fc0c3eb3aac03
Update honggfuzz to the newest version (b56729e6f29672be2edb2885807844df68d8db32) * Update honggfuzz to the newest version (b56729e6f29672be2edb2885807844df68d8db32) * Use -Wl,-z,muldefs when linking OpenEXR fuzzing targets One of the archives used to build the final fuzzer binary contains duplicated symbols (e.g. typeinfo for ImageChannel) so instruct the linker to ignore it.
[ { "change_type": "MODIFY", "old_path": "benchmarks/openexr_openexr_exrenvmap_fuzzer/build.sh", "new_path": "benchmarks/openexr_openexr_exrenvmap_fuzzer/build.sh", "diff": "cd $WORK/\n+# /work/OpenEXR/libOpenexrUtils.a contains duplicated symbols,\n+# so instruct the linker not to complain about it.\n+export CXXFLAGS=\"$CXXFLAGS -Wl,-z,muldefs\"\n+\nCMAKE_SETTINGS=(\n\"-D BUILD_SHARED_LIBS=OFF\" # Build static libraries only\n\"-D PYILMBASE_ENABLE=OFF\" # Don't build Python support\n" }, { "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.3.1 + d9482931f22e532ae1948e4eb933e5d6c2c52ead\n+# Download honggfuz version 2.3.1 + b56729e6f29672be2edb2885807844df68d8db32\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 d9482931f22e532ae1948e4eb933e5d6c2c52ead && \\\n+ git checkout b56729e6f29672be2edb2885807844df68d8db32 && \\\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 (b56729e6f29672be2edb2885807844df68d8db32) (#1066) * Update honggfuzz to the newest version (b56729e6f29672be2edb2885807844df68d8db32) * Use -Wl,-z,muldefs when linking OpenEXR fuzzing targets One of the archives used to build the final fuzzer binary contains duplicated symbols (e.g. typeinfo for ImageChannel) so instruct the linker to ignore it.
258,390
08.02.2021 18:28:31
-3,600
a92f94c646e79ffa3bcbf21e730964a013d62277
honggfuzz: update to
[ { "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.3.1 + b56729e6f29672be2edb2885807844df68d8db32\n+# Download honggfuz version 2.3.1 + 129dc593e6f4f4f76d3270372c7dd37c18860c23\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 b56729e6f29672be2edb2885807844df68d8db32 && \\\n+ git checkout 129dc593e6f4f4f76d3270372c7dd37c18860c23 && \\\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 b56729e6f29672be2edb2885807844df68d8db32 (#1079)
258,390
16.02.2021 21:40:28
-3,600
2e9f754423d114dcf8804fe7b6a255f41a2d6d86
fuzzers/honggfuzz: update to
[ { "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.3.1 + 129dc593e6f4f4f76d3270372c7dd37c18860c23\n+# Download honggfuz version 2.3.1 + 0b4cd5b1c4cf26b7e022dc1deb931d9318c054cb\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 129dc593e6f4f4f76d3270372c7dd37c18860c23 && \\\n+ git checkout 0b4cd5b1c4cf26b7e022dc1deb931d9318c054cb && \\\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
fuzzers/honggfuzz: update to 9dc22189ac83eb148d836f186f6c0a7981b17062 (#1091)
258,388
08.03.2021 13:17:35
28,800
1e4f5a90650696991f79d890f8e522a98b0ed22c
Restore intended behavior of run_experiment.py * Restore intended behavior of run_experiment.py when omitting benchmarks. Use code cov benchmarks by default.
[ { "change_type": "MODIFY", "old_path": "common/benchmark_utils.py", "new_path": "common/benchmark_utils.py", "diff": "@@ -132,8 +132,14 @@ def get_all_benchmarks():\nreturn sorted(all_benchmarks)\n+def get_coverage_benchmarks():\n+ \"\"\"Returns the list of all coverage benchmarks.\"\"\"\n+ return (get_oss_fuzz_coverage_benchmarks() +\n+ get_standard_coverage_benchmarks())\n+\n+\ndef get_oss_fuzz_coverage_benchmarks():\n- \"\"\"Return the list of OSS-Fuzz coverage benchmarks.\"\"\"\n+ \"\"\"Returns the list of OSS-Fuzz coverage benchmarks.\"\"\"\nreturn [\nbenchmark for benchmark in get_all_benchmarks()\nif is_oss_fuzz_benchmark(benchmark) and\n@@ -142,7 +148,7 @@ def get_oss_fuzz_coverage_benchmarks():\ndef get_standard_coverage_benchmarks():\n- \"\"\"Return the list of standard coverage benchmarks.\"\"\"\n+ \"\"\"Returns the list of standard coverage benchmarks.\"\"\"\nreturn [\nbenchmark for benchmark in get_all_benchmarks()\nif not is_oss_fuzz_benchmark(benchmark) and\n@@ -151,7 +157,7 @@ def get_standard_coverage_benchmarks():\ndef get_bug_benchmarks():\n- \"\"\"Return the list of standard coverage benchmarks.\"\"\"\n+ \"\"\"Returns the list of standard bug benchmarks.\"\"\"\nreturn [\nbenchmark for benchmark in get_all_benchmarks()\nif get_type(benchmark) == BenchmarkType.BUG.value\n" }, { "change_type": "MODIFY", "old_path": "experiment/run_experiment.py", "new_path": "experiment/run_experiment.py", "diff": "@@ -473,14 +473,15 @@ def main():\n'more benchmarks.')\nall_benchmarks = benchmark_utils.get_all_benchmarks()\n- all_fuzzers = fuzzer_utils.get_fuzzer_names()\n-\n+ coverage_benchmarks = benchmark_utils.get_coverage_benchmarks()\nparser.add_argument('-b',\n'--benchmarks',\n- help='Benchmark names. All of them by default.',\n+ help=('Benchmark names. '\n+ 'All code coverage benchmarks of them by '\n+ 'default.'),\nnargs='+',\nrequired=False,\n- default=all_benchmarks,\n+ default=coverage_benchmarks,\nchoices=all_benchmarks)\nparser.add_argument('-c',\n'--experiment-config',\n@@ -494,6 +495,8 @@ def main():\n'--description',\nhelp='Description of the experiment.',\nrequired=False)\n+\n+ all_fuzzers = fuzzer_utils.get_fuzzer_names()\nparser.add_argument('-f',\n'--fuzzers',\nhelp='Fuzzers to use.',\n" } ]
Python
Apache License 2.0
google/fuzzbench
Restore intended behavior of run_experiment.py (#1107) * Restore intended behavior of run_experiment.py when omitting benchmarks. Use code cov benchmarks by default.
258,388
23.04.2021 13:07:24
25,200
d766ea11b944059f1ef626129a2dfb8adccb2986
Add CLI sugar to support reproducing experiments using a few commands
[ { "change_type": "MODIFY", "old_path": ".pylintrc", "new_path": ".pylintrc", "diff": "@@ -64,8 +64,7 @@ confidence=\n# --enable=similarities\". If you want to run only the classes checker, but have\n# no Warning level messages displayed, use \"--disable=all --enable=classes\n# --disable=W\".\n-disable=print-statement,\n- parameter-unpacking,\n+disable=parameter-unpacking,\nunpacking-in-except,\nold-raise-syntax,\nbacktick,\n@@ -82,7 +81,6 @@ disable=print-statement,\nuseless-suppression,\ndeprecated-pragma,\nuse-symbolic-message-instead,\n- fixme,\napply-builtin,\nbasestring-builtin,\nbuffer-builtin,\n@@ -146,6 +144,7 @@ disable=print-statement,\ncomprehension-escape,\nfixme,\ntoo-few-public-methods,\n+ duplicate-code, # Too many false positives.\nglobal-statement, # Rare enough that when used it is always an exception to the rule.\n# Enable the message, report, category or checker with the given id(s). You can\n" }, { "change_type": "MODIFY", "old_path": "Makefile", "new_path": "Makefile", "diff": "@@ -48,7 +48,7 @@ SHELL := /bin/bash\nVENV_ACTIVATE := .venv/bin/activate\n${VENV_ACTIVATE}: requirements.txt\n- python3.8 -m venv .venv || python3 -m venv .venv\n+ python3.9 -m venv .venv || python3 -m venv .venv\nsource ${VENV_ACTIVATE} && python3 -m pip install -r requirements.txt\ninstall-dependencies: ${VENV_ACTIVATE}\n" }, { "change_type": "MODIFY", "old_path": "analysis/experiment_results.py", "new_path": "analysis/experiment_results.py", "diff": "@@ -121,9 +121,9 @@ class ExperimentResults: # pylint: disable=too-many-instance-attributes\nRaises ValueError if the benchmark types are mixed.\n\"\"\"\n- if all([b.type == 'bug' for b in self.benchmarks]):\n+ if all(b.type == 'bug' for b in self.benchmarks):\nreturn 'bug'\n- if all([b.type == 'code' for b in self.benchmarks]):\n+ if all(b.type == 'code' for b in self.benchmarks):\nreturn 'code'\nraise ValueError(\n'Cannot mix bug benchmarks with code coverage benchmarks.')\n" }, { "change_type": "MODIFY", "old_path": "analysis/rendering.py", "new_path": "analysis/rendering.py", "diff": "@@ -17,6 +17,7 @@ import os\nimport jinja2\n+from common import experiment_utils\nfrom common import utils\n@@ -42,7 +43,10 @@ def render_report(experiment_results, template, in_progress, coverage_report,\n)\ntemplate = environment.get_template(template)\n+ config_path = (\n+ experiment_utils.get_internal_experiment_config_relative_path())\nreturn template.render(experiment=experiment_results,\nin_progress=in_progress,\ncoverage_report=coverage_report,\n- description=description)\n+ description=description,\n+ experiment_config_relative_path=config_path)\n" }, { "change_type": "MODIFY", "old_path": "analysis/report_templates/default.html", "new_path": "analysis/report_templates/default.html", "diff": "<br><br>\nThe experiment was conducted using this FuzzBench commit:\n<a href=\"https://github.com/google/fuzzbench/commits/{{ experiment.git_hash }}\">{{ experiment.git_hash }}</a>\n+\n+ <br><br>\n+ To reproduce this experiment run the following commands in your FuzzBench repo:</a><br>\n+ <code>\n+ # Check out the right commit. <br>\n+ git checkout {{ experiment.git_hash }} <br>\n+ # Download the internal config file. <br>\n+ curl https://storage.googleapis.com/{{ experiment.name }}/{{ experiment_config_relative_path }} > /tmp/experiment-config.yaml<br>\n+ make install-dependencies <br>\n+ # Launch the experiment using paramters from the internal config file. <br>\n+ PYTHONPATH=. python experiment/reproduce_experiment.py -c /tmp/experiment-config.yaml -e &lt;new_experiment_name&gt;\n+ </code>\n+\n{% endif %}\n{% if description %}\n" }, { "change_type": "MODIFY", "old_path": "analysis/test_data_utils.py", "new_path": "analysis/test_data_utils.py", "diff": "@@ -293,6 +293,8 @@ def test_benchmark_rank_by_stat_test_wins():\nranking = data_utils.benchmark_rank_by_stat_test_wins(snapshot_df)\nexpected_ranking = pd.Series(index=['libfuzzer', 'afl'], data=[0, 0])\n+ ranking.sort_index(inplace=True)\n+ expected_ranking.sort_index(inplace=True)\nassert ranking.equals(expected_ranking)\n@@ -336,6 +338,8 @@ def test_experiment_rank_by_num_firsts():\ndata_utils.experiment_rank_by_num_firsts)\nexpected_ranking = pd.Series(index=['libfuzzer', 'afl'], data=[1.0, 1.0])\n+ expected_ranking.sort_index(inplace=True)\n+ ranking.sort_index(inplace=True)\nassert ranking.equals(expected_ranking)\n" }, { "change_type": "MODIFY", "old_path": "common/experiment_utils.py", "new_path": "common/experiment_utils.py", "diff": "@@ -23,6 +23,12 @@ DEFAULT_SNAPSHOT_SECONDS = 15 * 60 # Seconds.\nCONFIG_DIR = 'config'\n+def get_internal_experiment_config_relative_path():\n+ \"\"\"Returns the path of the internal config file relative to the data\n+ directory of an experiment.\"\"\"\n+ return os.path.join(CONFIG_DIR, 'experiment.yaml')\n+\n+\ndef get_snapshot_seconds():\n\"\"\"Returns the amount of time in seconds between snapshots of a\nfuzzer's corpus during an experiment.\"\"\"\n" }, { "change_type": "MODIFY", "old_path": "common/retry.py", "new_path": "common/retry.py", "diff": "@@ -89,6 +89,7 @@ def wrap( # pylint: disable=too-many-arguments\nexcept Exception as error: # pylint: disable=broad-except\nif not handle_retry(num_try, exception=error):\nraise\n+ return None\[email protected](func)\ndef _generator_wrapper(*args, **kwargs):\n" }, { "change_type": "MODIFY", "old_path": "experiment/dispatcher.py", "new_path": "experiment/dispatcher.py", "diff": "@@ -41,9 +41,10 @@ LOOP_WAIT_SECONDS = 5 * 60\n# TODO(metzman): Convert more uses of os.path.join to exp_path.path.\n-def _get_config_dir():\n+def _get_config_path():\n\"\"\"Return config directory.\"\"\"\n- return exp_path.path(experiment_utils.CONFIG_DIR)\n+ return exp_path.path(\n+ experiment_utils.get_internal_experiment_config_relative_path())\ndef create_work_subdirs(subdirs: List[str]):\n@@ -139,8 +140,7 @@ def dispatcher_main():\nif experiment_utils.is_local_experiment():\nmodels.Base.metadata.create_all(db_utils.engine)\n- experiment_config_file_path = os.path.join(_get_config_dir(),\n- 'experiment.yaml')\n+ experiment_config_file_path = _get_config_path()\nexperiment = Experiment(experiment_config_file_path)\n_initialize_experiment_in_db(experiment.config)\n@@ -195,7 +195,7 @@ def main():\nexcept Exception as error:\nlogs.error('Error conducting experiment.')\nraise error\n- experiment_config_file_path = os.path.join(_get_config_dir(),\n+ experiment_config_file_path = os.path.join(_get_config_path(),\n'experiment.yaml')\nif experiment_utils.is_local_experiment():\n" }, { "change_type": "ADD", "old_path": null, "new_path": "experiment/reproduce_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+\"\"\"Report generator tool.\"\"\"\n+import argparse\n+import sys\n+\n+from common import logs\n+from common import yaml_utils\n+from experiment import run_experiment\n+\n+\n+def validate_config(config):\n+ \"\"\"Quickly validates the config. We only do this because it is confusing\n+ that FuzzBench internally creates another config file that is supposed to be\n+ used to reproduce experiments.\"\"\"\n+ if 'benchmarks' not in config:\n+ raise Exception('Must specify benchmarks, are you sure this is the'\n+ 'config file created by fuzzbench and not the one '\n+ 'you created?')\n+\n+ if 'fuzzers' not in config:\n+ raise Exception('Must specify fuzzers, are you sure this is the'\n+ 'config file created by fuzzbench and not the one '\n+ 'you created?')\n+\n+\n+def main():\n+ \"\"\"Reproduce a specified experiment.\"\"\"\n+ logs.initialize()\n+ parser = argparse.ArgumentParser(\n+ description='Reproduce an experiment from a full config file.')\n+ parser.add_argument('-c',\n+ '--experiment-config',\n+ help='Path to the experiment configuration yaml file.',\n+ required=True)\n+\n+ parser.add_argument('-e',\n+ '--experiment-name',\n+ help='Experiment name.',\n+ required=True)\n+\n+ parser.add_argument('-d',\n+ '--description',\n+ help='Description of the experiment.',\n+ required=False)\n+\n+ args = parser.parse_args()\n+ config = yaml_utils.read(args.experiment_config)\n+ run_experiment.validate_experiment_name(args.experiment_name)\n+ if args.experiment_name == config['experiment']:\n+ raise Exception('Must use a different experiment name.')\n+ config['experiment'] = args.experiment_name\n+ config['description'] = args.description\n+ validate_config(config)\n+ run_experiment.start_experiment_from_full_config(config)\n+ return 0\n+\n+\n+if __name__ == '__main__':\n+ sys.exit(main())\n" }, { "change_type": "MODIFY", "old_path": "experiment/run_experiment.py", "new_path": "experiment/run_experiment.py", "diff": "@@ -39,7 +39,6 @@ from common import new_process\nfrom common import utils\nfrom common import yaml_utils\n-CONFIG_DIR = 'config'\nBENCHMARKS_DIR = os.path.join(utils.ROOT_DIR, 'benchmarks')\nFUZZERS_DIR = os.path.join(utils.ROOT_DIR, 'fuzzers')\nOSS_FUZZ_PROJECTS_DIR = os.path.join(utils.ROOT_DIR, 'third_party', 'oss-fuzz',\n@@ -193,8 +192,9 @@ def validate_experiment_name(experiment_name: str):\ndef set_up_experiment_config_file(config):\n\"\"\"Set up the config file that will actually be used in the\nexperiment (not the one given to run_experiment.py).\"\"\"\n- filesystem.recreate_directory(CONFIG_DIR)\n- experiment_config_filename = os.path.join(CONFIG_DIR, 'experiment.yaml')\n+ filesystem.recreate_directory(experiment_utils.CONFIG_DIR)\n+ experiment_config_filename = (\n+ experiment_utils.get_internal_experiment_config_relative_path())\nwith open(experiment_config_filename, 'w') as experiment_config_file:\nyaml.dump(config, experiment_config_file, default_flow_style=False)\n@@ -239,6 +239,11 @@ def start_experiment( # pylint: disable=too-many-arguments\nconfig['no_dictionaries'] = no_dictionaries\nconfig['oss_fuzz_corpus'] = oss_fuzz_corpus\nconfig['description'] = description\n+ return start_experiment_from_full_config(config)\n+\n+\n+def start_experiment_from_full_config(config):\n+ \"\"\"Start a fuzzer benchmarking experiment from a full (internal) config.\"\"\"\nset_up_experiment_config_file(config)\n@@ -249,7 +254,7 @@ def start_experiment( # pylint: disable=too-many-arguments\nraise Exception('Must set POSTGRES_PASSWORD environment variable.')\ngcloud.set_default_project(config['cloud_project'])\n- start_dispatcher(config, CONFIG_DIR)\n+ start_dispatcher(config, experiment_utils.CONFIG_DIR)\ndef start_dispatcher(config: Dict, config_dir: str):\n" }, { "change_type": "MODIFY", "old_path": "fuzzbench/run_experiment.py", "new_path": "fuzzbench/run_experiment.py", "diff": "@@ -57,7 +57,7 @@ def run_experiment(config):\nfor job in jobs_list:\nprint(' %s : %s\\t(%s)' % (job.func_name, job.get_status(), job.id))\n- if all([job.result is not None for job in jobs_list]):\n+ if all([job.result is not None for job in jobs_list]): # pylint: disable=use-a-generator\nbreak\ntime.sleep(3)\nprint('All done!')\n" }, { "change_type": "MODIFY", "old_path": "requirements.txt", "new_path": "requirements.txt", "diff": "@@ -7,8 +7,8 @@ google-cloud-secret-manager==2.1.0\nclusterfuzz==0.0.1a0\nJinja2==2.11.3\nnumpy==1.18.1\n-Orange3==3.24.1\n-pandas==1.0.4\n+Orange3==3.28.0\n+pandas==1.2.4\npsycopg2-binary==2.8.4\npyfakefs==3.7.1\npytest==6.1.2\n@@ -18,11 +18,11 @@ PyYAML==5.4\nredis==3.5.3\nrq==1.4.3\nscikit-posthocs==0.6.2\n-scipy==1.4.1\n+scipy==1.6.2\nseaborn==0.11.1\nsqlalchemy==1.3.19\n# Needed for development.\n-pylint==2.6.0\n-pytype==2020.11.3\n+pylint==2.7.4\n+pytype==2021.4.15\nyapf==0.30.0\n" } ]
Python
Apache License 2.0
google/fuzzbench
Add CLI sugar to support reproducing experiments using a few commands (#1132)
258,410
12.05.2021 20:45:37
-3,600
9b977c28257cc1fc20363788c1be099079782ef0
Intergrate benchmark "libarchive" with target "libarchive_fuzzer", commit date "2019-05-03 02:15:00+00:00"
[ { "change_type": "ADD", "old_path": null, "new_path": "benchmarks/libarchive_libarchive_fuzzer/Dockerfile", "diff": "+# Copyright 2016 Google Inc.\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+################################################################################\n+\n+FROM gcr.io/oss-fuzz-base/base-builder\n+\n+# Installing optional libraries can utilize more code path and/or improve\n+# performance (avoid calling external programs).\n+RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config \\\n+ libbz2-dev liblzo2-dev liblzma-dev liblz4-dev libz-dev \\\n+ libxml2-dev libssl-dev libacl1-dev libattr1-dev\n+RUN git clone --depth 1 https://github.com/libarchive/libarchive.git\n+WORKDIR libarchive\n+COPY build.sh libarchive_fuzzer.cc $SRC/\n" }, { "change_type": "ADD", "old_path": null, "new_path": "benchmarks/libarchive_libarchive_fuzzer/benchmark.yaml", "diff": "+commit: 94ca3f0734f71a0d9389ceaa237ce5a4ed8a21cd\n+commit_date: 2019-05-03 02:15:00+00:00\n+fuzz_target: libarchive_fuzzer\n+project: libarchive\n+type: bug\n+unsupported_fuzzers:\n+ - aflcc\n+ - afl_qemu\n+ - aflplusplus_qemu\n+ - honggfuzz_qemu\n+ - klee\n+ - weizz_qemu\n+ - lafintel\n" }, { "change_type": "ADD", "old_path": null, "new_path": "benchmarks/libarchive_libarchive_fuzzer/build.sh", "diff": "+#!/bin/bash -eu\n+# Copyright 2016 Google Inc.\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+################################################################################\n+\n+# build the project\n+./build/autogen.sh\n+./configure\n+make -j$(nproc) all\n+\n+# build fuzzer(s)\n+$CXX $CXXFLAGS -Ilibarchive \\\n+ $SRC/libarchive_fuzzer.cc -o $OUT/libarchive_fuzzer \\\n+ $LIB_FUZZING_ENGINE .libs/libarchive.a \\\n+ -Wl,-Bstatic -lbz2 -llzo2 -lxml2 -llzma -lz -lcrypto -llz4 -licuuc \\\n+ -licudata -Wl,-Bdynamic\n" }, { "change_type": "ADD", "old_path": null, "new_path": "benchmarks/libarchive_libarchive_fuzzer/libarchive_fuzzer.cc", "diff": "+// Copyright 2016 Google Inc.\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+////////////////////////////////////////////////////////////////////////////////\n+#include <stddef.h>\n+#include <stdint.h>\n+#include <vector>\n+\n+#include \"archive.h\"\n+\n+struct Buffer {\n+ const uint8_t *buf;\n+ size_t len;\n+};\n+\n+ssize_t reader_callback(struct archive *a, void *client_data,\n+ const void **block) {\n+ Buffer *buffer = reinterpret_cast<Buffer *>(client_data);\n+ *block = buffer->buf;\n+ ssize_t len = buffer->len;\n+ buffer->len = 0;\n+ return len;\n+}\n+\n+extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len) {\n+ ssize_t r;\n+ struct archive *a = archive_read_new();\n+\n+ archive_read_support_filter_all(a);\n+ archive_read_support_format_all(a);\n+\n+ Buffer buffer = {buf, len};\n+ archive_read_open(a, &buffer, NULL, reader_callback, NULL);\n+\n+ std::vector<uint8_t> data_buffer(getpagesize(), 0);\n+ struct archive_entry *entry;\n+ while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {\n+ while ((r = archive_read_data(a, data_buffer.data(),\n+ data_buffer.size())) > 0)\n+ ;\n+ if (r == ARCHIVE_FATAL)\n+ break;\n+ }\n+\n+ archive_read_free(a);\n+ return 0;\n+}\n" }, { "change_type": "ADD", "old_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/14537", "new_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/14537", "diff": "Binary files /dev/null and b/benchmarks/libarchive_libarchive_fuzzer/testcases/14537 differ\n" }, { "change_type": "ADD", "old_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/14555", "new_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/14555", "diff": "Binary files /dev/null and b/benchmarks/libarchive_libarchive_fuzzer/testcases/14555 differ\n" }, { "change_type": "ADD", "old_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/14574", "new_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/14574", "diff": "Binary files /dev/null and b/benchmarks/libarchive_libarchive_fuzzer/testcases/14574 differ\n" }, { "change_type": "ADD", "old_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/14689", "new_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/14689", "diff": "Binary files /dev/null and b/benchmarks/libarchive_libarchive_fuzzer/testcases/14689 differ\n" }, { "change_type": "ADD", "old_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/15120", "new_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/15120", "diff": "Binary files /dev/null and b/benchmarks/libarchive_libarchive_fuzzer/testcases/15120 differ\n" }, { "change_type": "ADD", "old_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/15278", "new_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/15278", "diff": "Binary files /dev/null and b/benchmarks/libarchive_libarchive_fuzzer/testcases/15278 differ\n" }, { "change_type": "ADD", "old_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/15431", "new_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/15431", "diff": "Binary files /dev/null and b/benchmarks/libarchive_libarchive_fuzzer/testcases/15431 differ\n" }, { "change_type": "ADD", "old_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/16240", "new_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/16240", "diff": "Binary files /dev/null and b/benchmarks/libarchive_libarchive_fuzzer/testcases/16240 differ\n" }, { "change_type": "ADD", "old_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/25054", "new_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/25054", "diff": "Binary files /dev/null and b/benchmarks/libarchive_libarchive_fuzzer/testcases/25054 differ\n" }, { "change_type": "ADD", "old_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/2582", "new_path": "benchmarks/libarchive_libarchive_fuzzer/testcases/2582", "diff": "Binary files /dev/null and b/benchmarks/libarchive_libarchive_fuzzer/testcases/2582 differ\n" } ]
Python
Apache License 2.0
google/fuzzbench
Intergrate benchmark "libarchive" with target "libarchive_fuzzer", commit date "2019-05-03 02:15:00+00:00" (#1146)
258,374
31.05.2021 18:07:15
-7,200
31769b156e45d69d68603cd8b6059044b985304b
add experiment request
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "#\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+\n+- experiment: 2021-06-02\n+ description: \"Experiment to compare afl with honggfuzz and libfuzzer\"\n+ fuzzers:\n+ - afl\n+ - aflplusplus\n+ - honggfuzz\n+ - libfuzzer\n+ - entropic\n+\n- experiment: 2021-05-29-symccafl\ndescription: \"Symcc-AFL test with most benchmarks\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
add experiment request (#1164)
258,410
01.06.2021 20:02:26
-3,600
e68d51bafded3d876469068b9d2f6c7c4424af70
Fixed wrong commit used for required library libXfixes
[ { "change_type": "MODIFY", "old_path": "benchmarks/ffmpeg_ffmpeg_demuxer_fuzzer/Dockerfile", "new_path": "benchmarks/ffmpeg_ffmpeg_demuxer_fuzzer/Dockerfile", "diff": "@@ -26,12 +26,13 @@ RUN apt-get update && apt-get install -y make autoconf automake libtool build-es\nRUN git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg\nRUN wget https://www.alsa-project.org/files/pub/lib/alsa-lib-1.1.0.tar.bz2\n-RUN git clone https://gitlab.freedesktop.org/mesa/drm.git\n+RUN git clone -n https://gitlab.freedesktop.org/mesa/drm.git\nRUN cd drm; git checkout 5db0f7692d1fdf05f9f6c0c02ffa5a5f4379c1f3\nRUN git clone --depth 1 https://github.com/mstorsjo/fdk-aac.git\nADD https://sourceforge.net/projects/lame/files/latest/download lame.tar.gz\nRUN git clone --depth 1 git://anongit.freedesktop.org/xorg/lib/libXext\n-RUN git clone --depth 1 git://anongit.freedesktop.org/git/xorg/lib/libXfixes\n+RUN git clone -n git://anongit.freedesktop.org/git/xorg/lib/libXfixes\n+RUN cd libXfixes; git checkout 174a94975af710247719310cfc53bd13e1f3b44d\nRUN git clone --depth 1 https://github.com/intel/libva\nRUN git clone --depth 1 -b libvdpau-1.2 git://people.freedesktop.org/~aplattner/libvdpau\nRUN git clone --depth 1 https://chromium.googlesource.com/webm/libvpx\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fixed wrong commit used for required library libXfixes (#1167) Co-authored-by: Dario Asprone <[email protected]>
258,388
09.06.2021 16:14:35
25,200
0eea26137cb8eb37adcac2d41745885de2ea46b2
Don't do 2021-06-09-aflpp-sat for now We need to make sure we aren't blocking some projects that have very imminent deadlines.
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# 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-- experiment: 2021-06-09-aflpp-sat\n- description: \"Benchmark AFL++ (saturated)\"\n- oss-fuzz-corpus: true\n- fuzzers:\n- - aflplusplus_x\n- - aflplusplus_x_c1\n- - aflplusplus_x_c1a\n- - aflplusplus_x_c1t\n- - aflplusplus_x_c2\n- - aflplusplus_x_c2a\n- - aflplusplus_x_c2t\n- - aflplusplus_x_d2f\n- - aflplusplus_x_eh\n- - aflplusplus_x_trim\n- - aflplusplus_x_default\n- - honggfuzz\n- - aflplusplus\n+# - experiment: 2021-06-09-aflpp-sat\n+# description: \"Benchmark AFL++ (saturated)\"\n+# oss-fuzz-corpus: true\n+# fuzzers:\n+# - aflplusplus_x\n+# - aflplusplus_x_c1\n+# - aflplusplus_x_c1a\n+# - aflplusplus_x_c1t\n+# - aflplusplus_x_c2\n+# - aflplusplus_x_c2a\n+# - aflplusplus_x_c2t\n+# - aflplusplus_x_d2f\n+# - aflplusplus_x_eh\n+# - aflplusplus_x_trim\n+# - aflplusplus_x_default\n+# - honggfuzz\n+# - aflplusplus\n- experiment: 2021-06-07-saturated-fix\ndescription: \"Benchmark a new experimental feature for AFL++ (saturated)\"\n" } ]
Python
Apache License 2.0
google/fuzzbench
Don't do 2021-06-09-aflpp-sat for now (#1177) We need to make sure we aren't blocking some projects that have very imminent deadlines.
258,388
11.06.2021 10:22:44
25,200
b41b68cbaca4c217b8c86b457157f6fdd7a723ee
Do aflpp-sat experiment
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# 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-# - experiment: 2021-06-09-aflpp-sat\n-# description: \"Benchmark AFL++ (saturated)\"\n-# oss-fuzz-corpus: true\n-# fuzzers:\n-# - aflplusplus_x\n-# - aflplusplus_x_c1\n-# - aflplusplus_x_c1a\n-# - aflplusplus_x_c1t\n-# - aflplusplus_x_c2\n-# - aflplusplus_x_c2a\n-# - aflplusplus_x_c2t\n-# - aflplusplus_x_d2f\n-# - aflplusplus_x_eh\n-# - aflplusplus_x_trim\n-# - aflplusplus_x_default\n-# - honggfuzz\n-# - aflplusplus\n+- experiment: 2021-06-11-aflpp-sat\n+ description: \"Benchmark AFL++ (saturated)\"\n+ oss-fuzz-corpus: true\n+ fuzzers:\n+ - aflplusplus_x\n+ - aflplusplus_x_c1\n+ - aflplusplus_x_c1a\n+ - aflplusplus_x_c1t\n+ - aflplusplus_x_c2\n+ - aflplusplus_x_c2a\n+ - aflplusplus_x_c2t\n+ - aflplusplus_x_d2f\n+ - aflplusplus_x_eh\n+ - aflplusplus_x_trim\n+ - aflplusplus_x_default\n+ - honggfuzz\n+ - aflplusplus\n- experiment: 2021-06-07-saturated-fix\ndescription: \"Benchmark a new experimental feature for AFL++ (saturated)\"\n" } ]
Python
Apache License 2.0
google/fuzzbench
Do aflpp-sat experiment (#1180)
258,375
18.06.2021 02:36:45
-25,200
2898c5139d2028a86013905b1f7d502da24a58c7
Request new experiment for AFL variants
[ { "change_type": "MODIFY", "old_path": ".github/workflows/fuzzers.yml", "new_path": ".github/workflows/fuzzers.yml", "diff": "@@ -65,6 +65,8 @@ jobs:\n- aflplusplus_frida_old\n- aflplusplus_frida_new\n- afl_two_instances\n+ - afl_no_favored\n+ - afl_random_favored\nbenchmark_type:\n- oss-fuzz\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/afl_no_favored/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\n+FROM $parent_image\n+\n+\n+RUN apt-get update && \\\n+ apt-get install wget libstdc++-5-dev -y\n+\n+RUN git clone https://github.com/Practical-Formal-Methods/AFL-public.git /afl && \\\n+ cd /afl && \\\n+ git checkout disable_top_rated && \\\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_no_favored/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 json\n+import os\n+import shutil\n+import subprocess\n+\n+from fuzzers import utils\n+\n+\n+def prepare_build_environment():\n+ \"\"\"Set environment variables used to build targets for AFL-based\n+ fuzzers.\"\"\"\n+ cflags = ['-fsanitize-coverage=trace-pc-guard']\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'] = '/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 get_stats(output_corpus, fuzzer_log): # pylint: disable=unused-argument\n+ \"\"\"Gets fuzzer stats for AFL.\"\"\"\n+ # Get a dictionary containing the stats AFL reports.\n+ stats_file = os.path.join(output_corpus, 'fuzzer_stats')\n+ with open(stats_file) as file_handle:\n+ stats_file_lines = file_handle.read().splitlines()\n+ stats_file_dict = {}\n+ for stats_line in stats_file_lines:\n+ key, value = stats_line.split(': ')\n+ stats_file_dict[key.strip()] = value.strip()\n+\n+ # Report to FuzzBench the stats it accepts.\n+ stats = {'execs_per_sec': float(stats_file_dict['execs_per_sec'])}\n+ return json.dumps(stats)\n+\n+\n+def prepare_fuzz_environment(input_corpus):\n+ \"\"\"Prepare to fuzz with AFL or another AFL-based fuzzer.\"\"\"\n+ # Tell AFL to not use its terminal UI so we get usable logs.\n+ os.environ['AFL_NO_UI'] = '1'\n+ # Skip AFL's CPU frequency check (fails on Docker).\n+ os.environ['AFL_SKIP_CPUFREQ'] = '1'\n+ # No need to bind affinity to one core, Docker enforces 1 core usage.\n+ os.environ['AFL_NO_AFFINITY'] = '1'\n+ # AFL will abort on startup if the core pattern sends notifications to\n+ # external programs. We don't care about this.\n+ os.environ['AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES'] = '1'\n+ # Don't exit when crashes are found. This can happen when corpus from\n+ # OSS-Fuzz is used.\n+ os.environ['AFL_SKIP_CRASHES'] = '1'\n+ # Shuffle the queue\n+ os.environ['AFL_SHUFFLE_QUEUE'] = '1'\n+\n+ # AFL needs at least one non-empty seed to start.\n+ utils.create_seed_file_for_empty_corpus(input_corpus)\n+\n+\n+def check_skip_det_compatible(additional_flags):\n+ \"\"\" Checks if additional flags are compatible with '-d' option\"\"\"\n+ # AFL refuses to take in '-d' with '-M' or '-S' options for parallel mode.\n+ # (cf. https://github.com/google/AFL/blob/8da80951/afl-fuzz.c#L7477)\n+ if '-M' in additional_flags or '-S' in additional_flags:\n+ return False\n+ return True\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+ print('[run_afl_fuzz] 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+ '-t',\n+ '1000+', # Use same default 1 sec timeout, but add '+' to skip hangs.\n+ ]\n+ # Use '-d' to skip deterministic mode, as long as it it compatible with\n+ # additional flags.\n+ if not additional_flags or check_skip_det_compatible(additional_flags):\n+ command.append('-d')\n+ if additional_flags:\n+ command.extend(additional_flags)\n+ dictionary_path = utils.get_dictionary_path(target_binary)\n+ if dictionary_path:\n+ command.extend(['-x', dictionary_path])\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+ print('[run_afl_fuzz] Running command: ' + ' '.join(command))\n+ output_stream = subprocess.DEVNULL if hide_output else None\n+ subprocess.check_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+ 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_no_favored/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-image\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/afl_random_favored/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\n+FROM $parent_image\n+\n+RUN apt-get update && \\\n+ apt-get install wget libstdc++-5-dev -y\n+\n+RUN git clone https://github.com/Practical-Formal-Methods/AFL-public.git /afl && \\\n+ cd /afl && \\\n+ git checkout randomized_top_rated && \\\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_random_favored/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 json\n+import os\n+import shutil\n+import subprocess\n+\n+from fuzzers import utils\n+\n+\n+def prepare_build_environment():\n+ \"\"\"Set environment variables used to build targets for AFL-based\n+ fuzzers.\"\"\"\n+ cflags = ['-fsanitize-coverage=trace-pc-guard']\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'] = '/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 get_stats(output_corpus, fuzzer_log): # pylint: disable=unused-argument\n+ \"\"\"Gets fuzzer stats for AFL.\"\"\"\n+ # Get a dictionary containing the stats AFL reports.\n+ stats_file = os.path.join(output_corpus, 'fuzzer_stats')\n+ with open(stats_file) as file_handle:\n+ stats_file_lines = file_handle.read().splitlines()\n+ stats_file_dict = {}\n+ for stats_line in stats_file_lines:\n+ key, value = stats_line.split(': ')\n+ stats_file_dict[key.strip()] = value.strip()\n+\n+ # Report to FuzzBench the stats it accepts.\n+ stats = {'execs_per_sec': float(stats_file_dict['execs_per_sec'])}\n+ return json.dumps(stats)\n+\n+\n+def prepare_fuzz_environment(input_corpus):\n+ \"\"\"Prepare to fuzz with AFL or another AFL-based fuzzer.\"\"\"\n+ # Tell AFL to not use its terminal UI so we get usable logs.\n+ os.environ['AFL_NO_UI'] = '1'\n+ # Skip AFL's CPU frequency check (fails on Docker).\n+ os.environ['AFL_SKIP_CPUFREQ'] = '1'\n+ # No need to bind affinity to one core, Docker enforces 1 core usage.\n+ os.environ['AFL_NO_AFFINITY'] = '1'\n+ # AFL will abort on startup if the core pattern sends notifications to\n+ # external programs. We don't care about this.\n+ os.environ['AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES'] = '1'\n+ # Don't exit when crashes are found. This can happen when corpus from\n+ # OSS-Fuzz is used.\n+ os.environ['AFL_SKIP_CRASHES'] = '1'\n+ # Shuffle the queue\n+ os.environ['AFL_SHUFFLE_QUEUE'] = '1'\n+\n+ # AFL needs at least one non-empty seed to start.\n+ utils.create_seed_file_for_empty_corpus(input_corpus)\n+\n+\n+def check_skip_det_compatible(additional_flags):\n+ \"\"\" Checks if additional flags are compatible with '-d' option\"\"\"\n+ # AFL refuses to take in '-d' with '-M' or '-S' options for parallel mode.\n+ # (cf. https://github.com/google/AFL/blob/8da80951/afl-fuzz.c#L7477)\n+ if '-M' in additional_flags or '-S' in additional_flags:\n+ return False\n+ return True\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+ print('[run_afl_fuzz] 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+ '-t',\n+ '1000+', # Use same default 1 sec timeout, but add '+' to skip hangs.\n+ ]\n+ # Use '-d' to skip deterministic mode, as long as it it compatible with\n+ # additional flags.\n+ if not additional_flags or check_skip_det_compatible(additional_flags):\n+ command.append('-d')\n+ if additional_flags:\n+ command.extend(additional_flags)\n+ dictionary_path = utils.get_dictionary_path(target_binary)\n+ if dictionary_path:\n+ command.extend(['-x', dictionary_path])\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+ print('[run_afl_fuzz] Running command: ' + ' '.join(command))\n+ output_stream = subprocess.DEVNULL if hide_output else None\n+ subprocess.check_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+ 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_random_favored/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-image\n" }, { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# 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+- experiment: 2021-06-17-favored-seeds\n+ description: \"Evaluating experimental methods to favor seeds\"\n+ fuzzers:\n+ - afl\n+ - afl_no_favored\n+ - afl_random_favored\n+\n- experiment: 2021-06-12-aflpp-bug\ndescription: \"Benchmark afl++ cnt variants\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
Request new experiment for AFL variants (#1175)
258,393
25.06.2021 20:46:43
-7,200
efb908fc44640ebb752eb8b5a41b4cad9628e5de
Requesting new experiments on two AFL variants. * requesting new experiments. * Update fuzzer.py fix format
[ { "change_type": "MODIFY", "old_path": ".github/workflows/fuzzers.yml", "new_path": ".github/workflows/fuzzers.yml", "diff": "@@ -59,6 +59,8 @@ jobs:\n- aflplusplus_unusual_partial\n- aflplusplus_unusual_partial_early\n- aflplusplus_unusual_enabled_early\n+ - aflprefix\n+ - dropfuzzer\n# Concolic execution\n- symcc_afl\n- symcc_aflplusplus\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/aflprefix/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\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/shao-hua-li/AFLPrefix.git /aflprefix && \\\n+ cd /aflprefix && \\\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+ clang -Wno-pointer-sign -c /aflprefix/llvm_mode/afl-llvm-rt.o.c -I/aflprefix && \\\n+ clang++ -stdlib=libc++ -std=c++11 -O2 -c /aflprefix/afl_driver.cpp && \\\n+ ar r /libAFL.a *.o\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/aflprefix/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 json\n+import os\n+import shutil\n+import subprocess\n+\n+from fuzzers import utils\n+\n+\n+def prepare_build_environment():\n+ \"\"\"Set environment variables used to build targets for AFL-based\n+ fuzzers.\"\"\"\n+ cflags = ['-fsanitize-coverage=trace-pc-guard']\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'] = '/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('/aflprefix/afl-fuzz', os.environ['OUT'])\n+\n+\n+def get_stats(output_corpus, fuzzer_log): # pylint: disable=unused-argument\n+ \"\"\"Gets fuzzer stats for AFL.\"\"\"\n+ # Get a dictionary containing the stats AFL reports.\n+ stats_file = os.path.join(output_corpus, 'fuzzer_stats')\n+ with open(stats_file) as file_handle:\n+ stats_file_lines = file_handle.read().splitlines()\n+ stats_file_dict = {}\n+ for stats_line in stats_file_lines:\n+ key, value = stats_line.split(': ')\n+ stats_file_dict[key.strip()] = value.strip()\n+\n+ # Report to FuzzBench the stats it accepts.\n+ stats = {'execs_per_sec': float(stats_file_dict['execs_per_sec'])}\n+ return json.dumps(stats)\n+\n+\n+def prepare_fuzz_environment(input_corpus):\n+ \"\"\"Prepare to fuzz with AFL or another AFL-based fuzzer.\"\"\"\n+ # Tell AFL to not use its terminal UI so we get usable logs.\n+ os.environ['AFL_NO_UI'] = '1'\n+ # Skip AFL's CPU frequency check (fails on Docker).\n+ os.environ['AFL_SKIP_CPUFREQ'] = '1'\n+ # No need to bind affinity to one core, Docker enforces 1 core usage.\n+ os.environ['AFL_NO_AFFINITY'] = '1'\n+ # AFL will abort on startup if the core pattern sends notifications to\n+ # external programs. We don't care about this.\n+ os.environ['AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES'] = '1'\n+ # Don't exit when crashes are found. This can happen when corpus from\n+ # OSS-Fuzz is used.\n+ os.environ['AFL_SKIP_CRASHES'] = '1'\n+ # Shuffle the queue\n+ os.environ['AFL_SHUFFLE_QUEUE'] = '1'\n+\n+ # AFL needs at least one non-empty seed to start.\n+ utils.create_seed_file_for_empty_corpus(input_corpus)\n+\n+\n+def check_skip_det_compatible(additional_flags):\n+ \"\"\" Checks if additional flags are compatible with '-d' option\"\"\"\n+ # AFL refuses to take in '-d' with '-M' or '-S' options for parallel mode.\n+ # (cf. https://github.com/google/AFL/blob/8da80951/afl-fuzz.c#L7477)\n+ if '-M' in additional_flags or '-S' in additional_flags:\n+ return False\n+ return True\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+ print('[run_afl_fuzz] Running target with afl-fuzz')\n+ command = [\n+ './afl-fuzz',\n+ '-r',\n+ '30',\n+ '-p',\n+ '1',\n+ '-u',\n+ '1',\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+ '-t',\n+ '1000+', # Use same default 1 sec timeout, but add '+' to skip hangs.\n+ ]\n+ # Use '-d' to skip deterministic mode, as long as it it compatible with\n+ # additional flags.\n+ if not additional_flags or check_skip_det_compatible(additional_flags):\n+ command.append('-d')\n+ if additional_flags:\n+ command.extend(additional_flags)\n+ dictionary_path = utils.get_dictionary_path(target_binary)\n+ if dictionary_path:\n+ command.extend(['-x', dictionary_path])\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+ print('[run_afl_fuzz] Running command: ' + ' '.join(command))\n+ output_stream = subprocess.DEVNULL if hide_output else None\n+ subprocess.check_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+ 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/aflprefix/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-image\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/dropfuzzer/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\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/shao-hua-li/DropFuzzer.git /dropfuzzer && \\\n+ cd /dropfuzzer && \\\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 /dropfuzzer/afl_driver.cpp && \\\n+ clang -Wno-pointer-sign -c /dropfuzzer/llvm_mode/afl-llvm-rt.o.c -I/dropfuzzer && \\\n+ clang++ -stdlib=libc++ -std=c++11 -O2 -c /dropfuzzer/afl_driver.cpp && \\\n+ ar r /libAFL.a *.o\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/dropfuzzer/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 json\n+import os\n+import shutil\n+import subprocess\n+\n+from fuzzers import utils\n+\n+\n+def prepare_build_environment():\n+ \"\"\"Set environment variables used to build targets for AFL-based\n+ fuzzers.\"\"\"\n+ cflags = ['-fsanitize-coverage=trace-pc-guard']\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'] = '/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('/dropfuzzer/afl-fuzz', os.environ['OUT'])\n+\n+\n+def get_stats(output_corpus, fuzzer_log): # pylint: disable=unused-argument\n+ \"\"\"Gets fuzzer stats for AFL.\"\"\"\n+ # Get a dictionary containing the stats AFL reports.\n+ stats_file = os.path.join(output_corpus, 'fuzzer_stats')\n+ with open(stats_file) as file_handle:\n+ stats_file_lines = file_handle.read().splitlines()\n+ stats_file_dict = {}\n+ for stats_line in stats_file_lines:\n+ key, value = stats_line.split(': ')\n+ stats_file_dict[key.strip()] = value.strip()\n+\n+ # Report to FuzzBench the stats it accepts.\n+ stats = {'execs_per_sec': float(stats_file_dict['execs_per_sec'])}\n+ return json.dumps(stats)\n+\n+\n+def prepare_fuzz_environment(input_corpus):\n+ \"\"\"Prepare to fuzz with AFL or another AFL-based fuzzer.\"\"\"\n+ # Tell AFL to not use its terminal UI so we get usable logs.\n+ os.environ['AFL_NO_UI'] = '1'\n+ # Skip AFL's CPU frequency check (fails on Docker).\n+ os.environ['AFL_SKIP_CPUFREQ'] = '1'\n+ # No need to bind affinity to one core, Docker enforces 1 core usage.\n+ os.environ['AFL_NO_AFFINITY'] = '1'\n+ # AFL will abort on startup if the core pattern sends notifications to\n+ # external programs. We don't care about this.\n+ os.environ['AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES'] = '1'\n+ # Don't exit when crashes are found. This can happen when corpus from\n+ # OSS-Fuzz is used.\n+ os.environ['AFL_SKIP_CRASHES'] = '1'\n+ # Shuffle the queue\n+ os.environ['AFL_SHUFFLE_QUEUE'] = '1'\n+\n+ # AFL needs at least one non-empty seed to start.\n+ utils.create_seed_file_for_empty_corpus(input_corpus)\n+\n+\n+def check_skip_det_compatible(additional_flags):\n+ \"\"\" Checks if additional flags are compatible with '-d' option\"\"\"\n+ # AFL refuses to take in '-d' with '-M' or '-S' options for parallel mode.\n+ # (cf. https://github.com/google/AFL/blob/8da80951/afl-fuzz.c#L7477)\n+ if '-M' in additional_flags or '-S' in additional_flags:\n+ return False\n+ return True\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+ print('[run_afl_fuzz] 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+ '-t',\n+ '1000+', # Use same default 1 sec timeout, but add '+' to skip hangs.\n+ ]\n+ # Use '-d' to skip deterministic mode, as long as it it compatible with\n+ # additional flags.\n+ if not additional_flags or check_skip_det_compatible(additional_flags):\n+ command.append('-d')\n+ if additional_flags:\n+ command.extend(additional_flags)\n+ dictionary_path = utils.get_dictionary_path(target_binary)\n+ if dictionary_path:\n+ command.extend(['-x', dictionary_path])\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+ print('[run_afl_fuzz] Running command: ' + ' '.join(command))\n+ output_stream = subprocess.DEVNULL if hide_output else None\n+ subprocess.check_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+ 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/dropfuzzer/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-image\n" }, { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# 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+- experiment: 2021-06-25-aflprefix\n+ description: \"Requesting experiments on two new AFL variants.\"\n+ fuzzers:\n+ - aflprefix\n+ - dropfuzzer\n+ - afl\n+\n- experiment: 2021-06-24-aflpp-bug\ndescription: \"Benchmark afl++ cnt variants\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
Requesting new experiments on two AFL variants. (#1186) * requesting new experiments. * Update fuzzer.py fix format
258,388
15.07.2021 07:42:50
25,200
3100d797a6ab54d6bf820fb4cd1037ee02923469
Rerequest saturated experiment (original:
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# 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+- experiment: 2021-07-15-saturated\n+ description: \"Benchmark a new experimental feature for AFL++ (saturated)\"\n+ type: bug\n+ oss-fuzz-corpus: true\n+ fuzzers:\n+ - aflplusplus_unusual_disabled\n+ - aflplusplus_unusual_enabled\n+\n- experiment: 2021-07-05-saturated\ndescription: \"Benchmark a new experimental feature for AFL++ (saturated)\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
Rerequest saturated experiment (original: #1191) (#1204)
258,419
16.07.2021 15:36:00
-7,200
7431d845da55e34ee51ac28b441d89ce16f89299
compare two different afl++ customized versions (dd and no dd)
[ { "change_type": "MODIFY", "old_path": ".github/workflows/fuzzers.yml", "new_path": ".github/workflows/fuzzers.yml", "diff": "@@ -32,6 +32,8 @@ jobs:\n- mopt\n- neuzz\n- libafl\n+ - afldd\n+ - aflpp_vs_dd\n# Binary-only (greybox) fuzzers.\n- eclipser\n- afl_qemu\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/afldd/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\n+FROM $parent_image\n+\n+# Install libstdc++ to use llvm_mode.\n+RUN apt-get update && \\\n+ apt-get install -y wget libstdc++-5-dev libtool-bin automake flex bison \\\n+ libglib2.0-dev libpixman-1-dev python3-setuptools unzip \\\n+ apt-utils apt-transport-https ca-certificates\n+\n+# Download and compile afldd.\n+RUN git clone https://github.com/elManto/AFLplusplus.git /afl && \\\n+ cd /afl\n+\n+# Build without Python support as we don't need it.\n+# Set AFL_NO_X86 to skip flaky tests.\n+RUN cd /afl && unset CFLAGS && unset CXXFLAGS && \\\n+ export CC=clang && export AFL_NO_X86=1 && \\\n+ PYTHON_INCLUDE=/ make && make install && \\\n+ make -C utils/aflpp_driver && \\\n+ cp utils/aflpp_driver/libAFLDriver.a /\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/afldd/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+# This optimized afl++ variant should always be run together with\n+# \"aflplusplus\" to show the difference - a default configured afl++ vs.\n+# a hand-crafted optimized one. afl++ is configured not to enable the good\n+# stuff by default to be as close to vanilla afl as possible.\n+# But this means that the good stuff is hidden away in this benchmark\n+# otherwise.\n+\n+import os\n+\n+from fuzzers.aflplusplus import fuzzer as aflplusplus_fuzzer\n+\n+\n+def build(): # pylint: disable=too-many-branches,too-many-statements\n+ \"\"\"Build benchmark.\"\"\"\n+ #os.environ['AFL_MAP_SIZE'] = '2621440'\n+ os.environ['DDG_INSTR'] = '1'\n+ aflplusplus_fuzzer.build(\"classic\")\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\"\"\"\n+ run_options = ['-l', '2']\n+\n+ aflplusplus_fuzzer.fuzz(input_corpus,\n+ output_corpus,\n+ target_binary,\n+ flags=(run_options))\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/afldd/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-image\n+\n+# This makes interactive docker runs painless:\n+ENV LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:/out\"\n+#ENV AFL_MAP_SIZE=2621440\n+ENV PATH=\"$PATH:/out\"\n+ENV AFL_SKIP_CPUFREQ=1\n+ENV AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1\n+ENV AFL_TESTCACHE_SIZE=2\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/aflpp_vs_dd/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\n+FROM $parent_image\n+\n+# Install libstdc++ to use llvm_mode.\n+RUN apt-get update && \\\n+ apt-get install -y wget libstdc++-5-dev libtool-bin automake flex bison \\\n+ libglib2.0-dev libpixman-1-dev python3-setuptools unzip \\\n+ apt-utils apt-transport-https ca-certificates\n+\n+# Download and compile afldd.\n+RUN git clone https://github.com/elManto/AFLplusplus.git /afl && \\\n+ cd /afl\n+\n+# Build without Python support as we don't need it.\n+# Set AFL_NO_X86 to skip flaky tests.\n+RUN cd /afl && unset CFLAGS && unset CXXFLAGS && \\\n+ export CC=clang && export AFL_NO_X86=1 && \\\n+ PYTHON_INCLUDE=/ make && make install && \\\n+ make -C utils/aflpp_driver && \\\n+ cp utils/aflpp_driver/libAFLDriver.a /\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/aflpp_vs_dd/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+# This optimized afl++ variant should always be run together with\n+# \"aflplusplus\" to show the difference - a default configured afl++ vs.\n+# a hand-crafted optimized one. afl++ is configured not to enable the good\n+# stuff by default to be as close to vanilla afl as possible.\n+# But this means that the good stuff is hidden away in this benchmark\n+# otherwise.\n+\n+#import os\n+\n+from fuzzers.aflplusplus import fuzzer as aflplusplus_fuzzer\n+\n+\n+def build(): # pylint: disable=too-many-branches,too-many-statements\n+ \"\"\"Build benchmark.\"\"\"\n+ #os.environ['AFL_MAP_SIZE'] = '2621440'\n+ aflplusplus_fuzzer.build(\"classic\")\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\"\"\"\n+ run_options = ['-l', '2']\n+\n+ aflplusplus_fuzzer.fuzz(input_corpus,\n+ output_corpus,\n+ target_binary,\n+ flags=(run_options))\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/aflpp_vs_dd/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-image\n+\n+# This makes interactive docker runs painless:\n+ENV LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:/out\"\n+#ENV AFL_MAP_SIZE=2621440\n+ENV PATH=\"$PATH:/out\"\n+ENV AFL_SKIP_CPUFREQ=1\n+ENV AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1\n+ENV AFL_TESTCACHE_SIZE=2\n" }, { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# 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+- experiment: 2021-07-08-feedback\n+ description: \"Different feedback mechanisms\"\n+ type: bug\n+ fuzzers:\n+ - afldd\n+ - aflpp_vs_dd\n+\n- experiment: 2021-07-09-aflpp\ndescription: \"afl++: frida, cmplog, symbolic\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
compare two different afl++ customized versions (dd and no dd) (#1199) Co-authored-by: jonathanmetzman <[email protected]>
258,388
19.07.2021 08:53:41
25,200
f095fe1cb838fb906046a1716c1e2f96cb098982
Refactor generate_report
[ { "change_type": "MODIFY", "old_path": "analysis/generate_report.py", "new_path": "analysis/generate_report.py", "diff": "@@ -30,6 +30,8 @@ from common import logs\nlogger = logs.Logger('generate_report')\n+DATA_FILENAME = 'data.csv.gz'\n+\ndef get_arg_parser():\n\"\"\"Returns argument parser.\"\"\"\n@@ -125,6 +127,53 @@ def get_arg_parser():\nreturn parser\n+def get_experiment_data(experiment_names, main_experiment_name,\n+ from_cached_data, data_path):\n+ \"\"\"Helper function that reads data from disk or from the database. Returns a\n+ dataframe and the experiment description.\"\"\"\n+ if from_cached_data and os.path.exists(data_path):\n+ logger.info('Reading experiment data from %s.', data_path)\n+ experiment_df = pd.read_csv(data_path)\n+ logger.info('Done reading data from %s.', data_path)\n+ return experiment_df, 'from cached data'\n+ logger.info('Reading experiment data from db.')\n+ experiment_df = queries.get_experiment_data(experiment_names)\n+ logger.info('Done reading experiment data from db.')\n+ description = queries.get_experiment_description(main_experiment_name)\n+ return experiment_df, description\n+\n+\n+def modify_experiment_data_if_requested( # pylint: disable=too-many-arguments\n+ experiment_df, experiment_names, benchmarks, fuzzers,\n+ label_by_experiment, end_time, merge_with_clobber):\n+ \"\"\"Helper function that returns a copy of |experiment_df| that is modified\n+ based on the other parameters. These parameters come from values specified\n+ by the user on the command line (or callers to generate_report).\"\"\"\n+ if benchmarks:\n+ # Filter benchmarks if requested.\n+ experiment_df = data_utils.filter_benchmarks(experiment_df, benchmarks)\n+\n+ if fuzzers is not None:\n+ # Filter fuzzers if requested.\n+ experiment_df = data_utils.filter_fuzzers(experiment_df, fuzzers)\n+\n+ if label_by_experiment:\n+ # Label each fuzzer by the experiment it came from to easily compare the\n+ # same fuzzer accross multiple experiments.\n+ experiment_df = data_utils.label_fuzzers_by_experiment(experiment_df)\n+\n+ if end_time is not None:\n+ # Cut off the experiment at a specific time if requested.\n+ experiment_df = data_utils.filter_max_time(experiment_df, end_time)\n+\n+ if merge_with_clobber:\n+ # Merge with clobber if requested.\n+ experiment_df = data_utils.clobber_experiments_data(\n+ experiment_df, experiment_names)\n+\n+ return experiment_df\n+\n+\n# pylint: disable=too-many-arguments,too-many-locals\ndef generate_report(experiment_names,\nreport_directory,\n@@ -146,37 +195,24 @@ def generate_report(experiment_names,\nexperiment_names = (\nqueries.add_nonprivate_experiments_for_merge_with_clobber(\nexperiment_names))\n+ merge_with_clobber = True\nmain_experiment_name = experiment_names[0]\nreport_name = report_name or main_experiment_name\nfilesystem.create_directory(report_directory)\n- data_path = os.path.join(report_directory, 'data.csv.gz')\n- if from_cached_data and os.path.exists(data_path):\n- experiment_df = pd.read_csv(data_path)\n- description = \"from cached data\"\n- else:\n- experiment_df = queries.get_experiment_data(experiment_names)\n- description = queries.get_experiment_description(main_experiment_name)\n+ data_path = os.path.join(report_directory, DATA_FILENAME)\n+ experiment_df, experiment_description = get_experiment_data(\n+ experiment_names, main_experiment_name, from_cached_data, data_path)\n+ # TODO(metzman): Ensure that each experiment is in the df. Otherwise there\n+ # is a good chance user misspelled something.\ndata_utils.validate_data(experiment_df)\n- if benchmarks is not None:\n- experiment_df = data_utils.filter_benchmarks(experiment_df, benchmarks)\n-\n- if fuzzers is not None:\n- experiment_df = data_utils.filter_fuzzers(experiment_df, fuzzers)\n-\n- if label_by_experiment:\n- experiment_df = data_utils.label_fuzzers_by_experiment(experiment_df)\n-\n- if end_time is not None:\n- experiment_df = data_utils.filter_max_time(experiment_df, end_time)\n-\n- if merge_with_clobber or merge_with_clobber_nonprivate:\n- experiment_df = data_utils.clobber_experiments_data(\n- experiment_df, experiment_names)\n+ experiment_df = modify_experiment_data_if_requested(\n+ experiment_df, experiment_names, benchmarks, fuzzers,\n+ label_by_experiment, end_time, merge_with_clobber)\n# Add |bugs_covered| column prior to export.\nexperiment_df = data_utils.add_bugs_covered_column(experiment_df)\n@@ -189,8 +225,10 @@ def generate_report(experiment_names,\n# Load the coverage json summary file.\ncoverage_dict = {}\nif coverage_report:\n+ logger.info('Generating coverage report info.')\ncoverage_dict = coverage_data_utils.get_covered_regions_dict(\nexperiment_df)\n+ logger.info('Finished generating coverage report info.')\nfuzzer_names = experiment_df.fuzzer.unique()\nplotter = plotting.Plotter(fuzzer_names, quick, log_scale)\n@@ -202,9 +240,11 @@ def generate_report(experiment_names,\nexperiment_name=report_name)\ntemplate = report_type + '.html'\n+ logger.info('Rendering HTML report.')\ndetailed_report = rendering.render_report(experiment_ctx, template,\nin_progress, coverage_report,\n- description)\n+ experiment_description)\n+ logger.info('Done rendering HTML report.')\nfilesystem.write(os.path.join(report_directory, 'index.html'),\ndetailed_report)\n" } ]
Python
Apache License 2.0
google/fuzzbench
Refactor generate_report (#1210)
258,388
04.08.2021 20:47:41
25,200
692981bcb393af176f5656fe6c29dd639576ae9f
Support experiments with multi-core fuzzers. Also support KLEE experiments without commenting out code.
[ { "change_type": "MODIFY", "old_path": "common/gcloud.py", "new_path": "common/gcloud.py", "diff": "@@ -28,7 +28,6 @@ DISPATCHER_BOOT_DISK_SIZE = '4TB'\nDISPATCHER_BOOT_DISK_TYPE = 'pd-ssd'\n# Constants for runner specs.\n-RUNNER_MACHINE_TYPE = 'n1-standard-1'\nRUNNER_BOOT_DISK_SIZE = '30GB'\n# Constants for measurer worker specs.\n@@ -75,13 +74,18 @@ def create_instance(instance_name: str,\n'--boot-disk-type=%s' % DISPATCHER_BOOT_DISK_TYPE,\n])\nelse:\n+ machine_type = config['runner_machine_type']\n+ if machine_type is not None:\n+ command.append('--machine-type=%s' % machine_type)\n+ else:\n+ # Do this to support KLEE experiments.\n+ command.append([\n+ '--custom-memory=%s' % config['runner_memory'],\n+ '--custom-cpu=%s' % config['runner_num_cpu_cores']\n+ ])\n+\ncommand.extend([\n'--no-address',\n- # Uncomment these and comment out \"machine-type\" to increase RAM for\n- # KLEE.\n- # '--custom-memory=12GB',\n- # '--custom-cpu=2',\n- '--machine-type=%s' % RUNNER_MACHINE_TYPE,\n'--boot-disk-size=%s' % RUNNER_BOOT_DISK_SIZE,\n])\n" }, { "change_type": "MODIFY", "old_path": "common/test_gcloud.py", "new_path": "common/test_gcloud.py", "diff": "@@ -21,7 +21,12 @@ from test_libs import utils as test_utils\nINSTANCE_NAME = 'instance-a'\nZONE = 'zone-a'\n-CONFIG = {'cloud_compute_zone': ZONE, 'service_account': 'blah'}\n+MACHINE_TYPE = 'my-machine-type'\n+CONFIG = {\n+ 'cloud_compute_zone': ZONE,\n+ 'service_account': 'blah',\n+ 'runner_machine_type': MACHINE_TYPE\n+}\ndef test_create_instance():\n@@ -56,8 +61,8 @@ def _get_expected_create_runner_command(is_preemptible):\n'--image-project=cos-cloud',\n'--zone=zone-a',\n'--scopes=cloud-platform',\n+ '--machine-type=my-machine-type',\n'--no-address',\n- '--machine-type=n1-standard-1',\n'--boot-disk-size=30GB',\n]\nif is_preemptible:\n" }, { "change_type": "MODIFY", "old_path": "experiment/resources/runner-startup-script-template.sh", "new_path": "experiment/resources/runner-startup-script-template.sh", "diff": "@@ -35,7 +35,7 @@ do\ndone{% endif %}\ndocker run \\\n---privileged --cpus=1 --rm \\\n+--privileged --cpus={{num_cpu_cores}} --rm \\\n-e INSTANCE_NAME={{instance_name}} \\\n-e FUZZER={{fuzzer}} \\\n-e BENCHMARK={{benchmark}} \\\n" }, { "change_type": "MODIFY", "old_path": "experiment/run_experiment.py", "new_path": "experiment/run_experiment.py", "diff": "@@ -239,6 +239,13 @@ def start_experiment( # pylint: disable=too-many-arguments\nconfig['no_dictionaries'] = no_dictionaries\nconfig['oss_fuzz_corpus'] = oss_fuzz_corpus\nconfig['description'] = description\n+ config['runner_machine_type'] = config.get('runner_machine_type',\n+ 'n1-standard-1')\n+ config['runner_num_cpu_cores'] = config.get('runner_num_cpu_cores', 1)\n+ # Note this is only used if runner_machine_type is None.\n+ # 12GB is just the amount that KLEE needs, use this default to make KLEE\n+ # experiments easier to run.\n+ config['runner_memory'] = config.get('runner_memory', '12GB')\nreturn start_experiment_from_full_config(config)\n" }, { "change_type": "MODIFY", "old_path": "experiment/scheduler.py", "new_path": "experiment/scheduler.py", "diff": "@@ -689,6 +689,7 @@ def render_startup_script_template(instance_name: str, fuzzer: str,\n'no_seeds': experiment_config['no_seeds'],\n'no_dictionaries': experiment_config['no_dictionaries'],\n'oss_fuzz_corpus': experiment_config['oss_fuzz_corpus'],\n+ 'num_cpu_cores': experiment_config['runner_num_cpu_cores'],\n}\nif not local_experiment:\n" }, { "change_type": "MODIFY", "old_path": "experiment/test_data/experiment-config.yaml", "new_path": "experiment/test_data/experiment-config.yaml", "diff": "@@ -32,3 +32,5 @@ no_seeds: false\nno_dictionaries: false\noss_fuzz_corpus: false\ndescription: \"Test experiment\"\n+runner_num_cpu_cores: 1\n+runner_machine_type: 'n1-standard-1'\n" }, { "change_type": "MODIFY", "old_path": "service/test_automatic_run_experiment.py", "new_path": "service/test_automatic_run_experiment.py", "diff": "@@ -95,17 +95,16 @@ def test_run_requested_experiment(mocked_get_requested_experiments,\n'vorbis-2017-12-11',\n'woff2-2016-05-06',\n]\n- expected_calls = [\n- mock.call(expected_experiment_name,\n+ expected_call = mock.call(expected_experiment_name,\nexpected_config_file,\nexpected_benchmarks,\nexpected_fuzzers,\ndescription='Test experiment',\noss_fuzz_corpus=True)\n- ]\nstart_experiment_call_args = mocked_start_experiment.call_args_list\nassert len(start_experiment_call_args) == 1\n- assert start_experiment_call_args == expected_calls\n+ start_experiment_call_args = start_experiment_call_args[0]\n+ assert start_experiment_call_args == expected_call\[email protected](\n" } ]
Python
Apache License 2.0
google/fuzzbench
Support experiments with multi-core fuzzers. (#1215) Also support KLEE experiments without commenting out code.
258,388
04.08.2021 20:49:46
25,200
7c3d47a822ed3d2cf34cee79fbeb5c0f1877e0af
[docs] Mention BUILDKIT might need to be enabled on old docker releases Related:
[ { "change_type": "MODIFY", "old_path": "docs/getting-started/prerequisites.md", "new_path": "docs/getting-started/prerequisites.md", "diff": "@@ -37,8 +37,16 @@ Googlers 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/install/linux-postinstall/#manage-docker-as-a-non-root-user).\n+To ensure there are no problems building docker images, we recommend using a\n+recent docker release. If you are using an older release, and your builds are\n+failing you may need to\n+[enable BuildKit](https://google.github.io/oss-fuzz/getting-started/new-project-guide/#prerequisites).\n+This step is unnecessary on recent Docker releases.\n+\n**Note:** Docker images can consume significant disk space. Clean up unused\n-docker images periodically.\n+docker images periodically. You can do this with\n+[docker-cleanup](https://gist.github.com/mikea/d23a839cba68778d94e0302e8a2c200f)\n+to garbage collect unused images.\n### Make\n@@ -94,7 +102,7 @@ make format\n### Local Support\nIf you want to run FuzzBench [locally]({{ site.baseurl }}/running-a-local-experiment/#Running a local experiment)\n-on your own machine or servers, it needs `rsync` installed:\n+on your own machines or servers, they need `rsync` installed:\n```bash\nsudo apt-get install rsync\n```\n" } ]
Python
Apache License 2.0
google/fuzzbench
[docs] Mention BUILDKIT might need to be enabled on old docker releases (#1218) Related: #1211
258,388
04.08.2021 20:50:17
25,200
229b22551e46d8e7c8b6a7a677ba3901711688f1
[runner] Fix logging message Related:
[ { "change_type": "MODIFY", "old_path": "experiment/runner.py", "new_path": "experiment/runner.py", "diff": "@@ -375,7 +375,7 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nself.log_file)\nexcept Exception: # pylint: disable=broad-except\n- logs.error('Call to %d failed.', fuzzer_module_get_stats)\n+ logs.error('Call to %s failed.', fuzzer_module_get_stats)\nreturn\ntry:\n" }, { "change_type": "MODIFY", "old_path": "experiment/test_runner.py", "new_path": "experiment/test_runner.py", "diff": "@@ -178,7 +178,7 @@ def test_record_stats_exception(mocked_log_error, trial_runner, fuzzer_module):\nstats_file = os.path.join(trial_runner.results_dir, 'stats-%d.json' % cycle)\nassert not os.path.exists(stats_file)\nmocked_log_error.assert_called_with(\n- 'Call to %d failed.', FuzzerAModuleGetStatsException.get_stats)\n+ 'Call to %s failed.', FuzzerAModuleGetStatsException.get_stats)\ndef test_trial_runner(trial_runner):\n" } ]
Python
Apache License 2.0
google/fuzzbench
[runner] Fix logging message (#1216) Related: #1198
258,388
04.08.2021 21:23:18
25,200
77c7ab44d33efc9a8cf12684818741cc56852f10
Replace deprecated yield_fixture with equivalent to silence warning
[ { "change_type": "MODIFY", "old_path": "conftest.py", "new_path": "conftest.py", "diff": "@@ -37,7 +37,7 @@ from database import models\n# Give this a short name since it is a fixture.\[email protected]_fixture\[email protected]\ndef db(): # pylint: disable=invalid-name\n\"\"\"Connect to the SQLite database and create all the expected tables.\"\"\"\ndb_utils.initialize()\n@@ -61,7 +61,7 @@ def set_sqlite_pragma(connection, _):\ncursor.close()\[email protected]_fixture\[email protected]\ndef environ():\n\"\"\"Patch environment.\"\"\"\n# TODO(metzman): Make sure this is used by all tests that modify the\n" }, { "change_type": "MODIFY", "old_path": "experiment/build/test_builder.py", "new_path": "experiment/build/test_builder.py", "diff": "@@ -82,7 +82,7 @@ def test_build_all_measurers(_, mocked_build_measurer,\nassert not result\[email protected]_fixture\[email protected]\ndef builder_integration(experiment):\n\"\"\"Fixture for builder.py integration tests that uses an experiment fixture\nand makes the number of build retries saner by default.\"\"\"\n" } ]
Python
Apache License 2.0
google/fuzzbench
Replace deprecated yield_fixture with equivalent to silence warning (#1220)
258,388
04.08.2021 21:23:44
25,200
9692525ec5f722b4b8af5680d1f5cad39f7a0f60
Add more logging to oss-fuzz integration script to improve UX
[ { "change_type": "MODIFY", "old_path": "benchmarks/oss_fuzz_benchmark_integration.py", "new_path": "benchmarks/oss_fuzz_benchmark_integration.py", "diff": "@@ -19,7 +19,6 @@ import datetime\nfrom distutils import spawn\nfrom distutils import dir_util\nimport os\n-import logging\nimport sys\nimport subprocess\nimport json\n@@ -42,10 +41,10 @@ class GitRepoManager:\nself.repo_dir = repo_dir\ndef git(self, cmd):\n- \"\"\"Run a git command.\n+ \"\"\"Runs a git command.\nArgs:\n- command: The git command as a list to be run.\n+ cmd: The git command as a list to be run.\nReturns:\nnew_process.ProcessResult\n@@ -66,7 +65,7 @@ class BaseBuilderDockerRepo:\nself.digests.append(digest)\ndef find_digest(self, timestamp):\n- \"\"\"Find the latest image before the given timestamp.\"\"\"\n+ \"\"\"Finds the latest image before the given timestamp.\"\"\"\nindex = bisect.bisect_right(self.timestamps, timestamp)\nif index > 0:\nreturn self.digests[index - 1]\n@@ -74,11 +73,11 @@ class BaseBuilderDockerRepo:\ndef copy_oss_fuzz_files(project, commit_date, benchmark_dir):\n- \"\"\"Checkout the right files from OSS-Fuzz to build the benchmark based on\n- |project| and |commit_date|. Then copy them to |benchmark_dir|.\"\"\"\n+ \"\"\"Checks out the right files from OSS-Fuzz to build the benchmark based on\n+ |project| and |commit_date|. Then copies them to |benchmark_dir|.\"\"\"\nif not os.path.exists(os.path.join(OSS_FUZZ_DIR, '.git')):\nlogs.error(\n- '%s is not a git repo. Try running git submodule update --init',\n+ '%s is not a git repo. Try running: git submodule update --init',\nOSS_FUZZ_DIR)\nraise RuntimeError('%s is not a git repo.' % OSS_FUZZ_DIR)\noss_fuzz_repo_manager = GitRepoManager(OSS_FUZZ_DIR)\n@@ -108,10 +107,10 @@ def get_benchmark_name(project, fuzz_target, benchmark_name=None):\ndef _load_base_builder_docker_repo():\n- \"\"\"Get base-image digests.\"\"\"\n+ \"\"\"Gets base-image digests. Returns the docker rep.\"\"\"\ngcloud_path = spawn.find_executable('gcloud')\nif not gcloud_path:\n- logging.warning('gcloud not found in PATH.')\n+ logs.warning('gcloud not found in PATH.')\nreturn None\n_, result, _ = new_process.execute([\n@@ -135,7 +134,7 @@ def _load_base_builder_docker_repo():\ndef _replace_base_builder_digest(dockerfile_path, digest):\n- \"\"\"Replace the base-builder digest in a Dockerfile.\"\"\"\n+ \"\"\"Replaces the base-builder digest in a Dockerfile.\"\"\"\nwith open(dockerfile_path) as handle:\nlines = handle.readlines()\n@@ -151,7 +150,7 @@ def _replace_base_builder_digest(dockerfile_path, digest):\ndef replace_base_builder(benchmark_dir, commit_date):\n- \"\"\"Replace the parent image of the Dockerfile in |benchmark_dir|,\n+ \"\"\"Replaces the parent image of the Dockerfile in |benchmark_dir|,\nbase-builder (latest), with a version of base-builder that is likely to\nbuild the project as it was on |commit_date| without issue.\"\"\"\nbase_builder_repo = _load_base_builder_docker_repo()\n@@ -164,7 +163,7 @@ def replace_base_builder(benchmark_dir, commit_date):\ndef create_oss_fuzz_yaml(project, fuzz_target, commit, commit_date,\nbenchmark_dir):\n- \"\"\"Create the benchmark.yaml file in |benchmark_dir| based on the values\n+ \"\"\"Creates the benchmark.yaml file in |benchmark_dir| based on the values\nfrom |project|, |fuzz_target|, |commit| and |commit_date|.\"\"\"\nyaml_filename = os.path.join(benchmark_dir, 'benchmark.yaml')\nconfig = {\n@@ -190,6 +189,7 @@ def integrate_benchmark(project, fuzz_target, benchmark_name, commit,\nreplace_base_builder(benchmark_dir, commit_date)\ncreate_oss_fuzz_yaml(project, fuzz_target, commit, commit_date,\nbenchmark_dir)\n+ return benchmark_name\ndef main():\n@@ -215,9 +215,15 @@ def main():\n'-d',\n'--date',\nhelp='Date of the commit. Example: 2019-10-19T09:07:25+01:00')\n+\n+ logs.initialize()\nargs = parser.parse_args()\n- integrate_benchmark(args.project, args.fuzz_target, args.benchmark_name,\n+ benchmark = integrate_benchmark(\n+ args.project, args.fuzz_target, args.benchmark_name,\nargs.commit, args.date)\n+ logs.info('Successfully integrated benchmark: %s.', benchmark)\n+ logs.info('Please run \"make test-run-afl-%s\" to test integration.',\n+ benchmark)\nreturn 0\n" } ]
Python
Apache License 2.0
google/fuzzbench
Add more logging to oss-fuzz integration script to improve UX (#1217)
258,388
06.08.2021 14:29:57
25,200
f826181ef25fa81c2cc19446fd2f5aebe6098ec7
Add a parallel fuzzer Based off of
[ { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/glibfuzzer/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\n+FROM $parent_image\n+\n+#RUN git clone https://github.com/llvm/llvm-project.git /llvm-project && \\\n+#RUN git clone https://github.com/gtt1995/libfuzzer-adaptive-group.git&& \\\n+RUN git clone https://github.com/gtt1995/libfuzzer-cmab-latest.git && \\\n+ cd libfuzzer-cmab-latest && \\\n+# git checkout 5cda4dc7b4d28fcd11307d4234c513ff779a1c6f && \\\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/glibFuzzer.a *.o\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/glibfuzzer/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 glibFuzzer fuzzer.\"\"\"\n+\n+import subprocess\n+import os\n+\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+ cflags = ['-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/glibFuzzer.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+ run_fuzzer(input_corpus,\n+ output_corpus,\n+ target_binary,\n+ extra_flags=['-keep_seed=0', '-cross_over_uniform_dist=1'])\n+\n+\n+def run_fuzzer(input_corpus, output_corpus, target_binary, extra_flags=None):\n+ \"\"\"Run fuzzer.\"\"\"\n+ if extra_flags is None:\n+ extra_flags = []\n+\n+ # Seperate out corpus and crash directories as sub-directories of\n+ # |output_corpus| to avoid conflicts when corpus directory is reloaded.\n+ crashes_dir = os.path.join(output_corpus, 'crashes')\n+ output_corpus = os.path.join(output_corpus, 'corpus')\n+ os.makedirs(crashes_dir)\n+ os.makedirs(output_corpus)\n+\n+ flags = [\n+ '-print_final_stats=1',\n+ # `close_fd_mask` to prevent too much logging output from the target.\n+ '-close_fd_mask=3',\n+ # Run in fork mode to allow ignoring ooms, timeouts, crashes and\n+ # continue fuzzing indefinitely.\n+ '-fork=8',\n+ '-NumCorpuses=8',\n+ '-ignore_ooms=1',\n+ '-ignore_timeouts=1',\n+ '-ignore_crashes=1',\n+ '-entropic=1',\n+ '-adaptive=6',\n+\n+ # Don't use LSAN's leak detection. Other fuzzers won't be using it and\n+ # using it will cause libFuzzer to find \"crashes\" no one cares about.\n+ '-detect_leaks=0',\n+\n+ # Store crashes along with corpus for bug based benchmarking.\n+ f'-artifact_prefix={crashes_dir}/',\n+ ]\n+ flags += extra_flags\n+ if 'ADDITIONAL_ARGS' in os.environ:\n+ flags += os.environ['ADDITIONAL_ARGS'].split(' ')\n+ dictionary_path = utils.get_dictionary_path(target_binary)\n+ if dictionary_path:\n+ flags.append('-dict=' + dictionary_path)\n+\n+ command = [target_binary] + flags + [output_corpus, input_corpus]\n+ print('[run_fuzzer] Running command: ' + ' '.join(command))\n+ subprocess.check_call(command)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/glibfuzzer/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-image\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/libfuzzer-fork-parallel/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\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 5cda4dc7b4d28fcd11307d4234c513ff779a1c6f && \\\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-fork-parallel/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 subprocess\n+import os\n+\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+ cflags = ['-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. Wrapper that uses the defaults when calling\n+ run_fuzzer.\"\"\"\n+ run_fuzzer(input_corpus,\n+ output_corpus,\n+ target_binary,\n+ extra_flags=['-keep_seed=0', '-cross_over_uniform_dist=1'])\n+\n+\n+def run_fuzzer(input_corpus, output_corpus, target_binary, extra_flags=None):\n+ \"\"\"Run fuzzer.\"\"\"\n+ if extra_flags is None:\n+ extra_flags = []\n+\n+ # Seperate out corpus and crash directories as sub-directories of\n+ # |output_corpus| to avoid conflicts when corpus directory is reloaded.\n+ crashes_dir = os.path.join(output_corpus, 'crashes')\n+ output_corpus = os.path.join(output_corpus, 'corpus')\n+ os.makedirs(crashes_dir)\n+ os.makedirs(output_corpus)\n+\n+ flags = [\n+ '-print_final_stats=1',\n+ # `close_fd_mask` to prevent too much logging output from the target.\n+ '-close_fd_mask=3',\n+ # Run in fork mode to allow ignoring ooms, timeouts, crashes and\n+ # continue fuzzing indefinitely.\n+ '-fork=8',\n+ '-ignore_ooms=1',\n+ '-ignore_timeouts=1',\n+ '-ignore_crashes=1',\n+ '-entropic=1',\n+\n+ # Don't use LSAN's leak detection. Other fuzzers won't be using it and\n+ # using it will cause libFuzzer to find \"crashes\" no one cares about.\n+ '-detect_leaks=0',\n+\n+ # Store crashes along with corpus for bug based benchmarking.\n+ f'-artifact_prefix={crashes_dir}/',\n+ ]\n+ flags += extra_flags\n+ if 'ADDITIONAL_ARGS' in os.environ:\n+ flags += os.environ['ADDITIONAL_ARGS'].split(' ')\n+ dictionary_path = utils.get_dictionary_path(target_binary)\n+ if dictionary_path:\n+ flags.append('-dict=' + dictionary_path)\n+\n+ command = [target_binary] + flags + [output_corpus, input_corpus]\n+ print('[run_fuzzer] Running command: ' + ' '.join(command))\n+ subprocess.check_call(command)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/libfuzzer-fork-parallel/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-image\n" } ]
Python
Apache License 2.0
google/fuzzbench
Add a parallel fuzzer (#1221) Based off of #1197
258,388
18.10.2021 13:20:31
14,400
90d0c398496e8c70e414cea00dd3e541344f2acf
[aspell] Fix build failure. Fix SSL error by upgrading ubuntu packages. This should unbreak CI.
[ { "change_type": "MODIFY", "old_path": "benchmarks/aspell_aspell_fuzzer/Dockerfile", "new_path": "benchmarks/aspell_aspell_fuzzer/Dockerfile", "diff": "FROM gcr.io/oss-fuzz-base/base-builder@sha256:1b6a6993690fa947df74ceabbf6a1f89a46d7e4277492addcd45a8525e34be5a\n-RUN apt-get update && apt-get install -y pkg-config\n+RUN apt-get update && apt-get upgrade -y && apt-get install -y pkg-config\nRUN git clone https://github.com/gnuaspell/aspell.git $SRC/aspell\nRUN git clone --depth 1 -b master https://github.com/gnuaspell/aspell-fuzz.git $SRC/aspell-fuzz\n" } ]
Python
Apache License 2.0
google/fuzzbench
[aspell] Fix build failure. (#1261) Fix SSL error by upgrading ubuntu packages. This should unbreak CI.
258,375
12.10.2021 06:51:49
-25,200
262b4637bb011bcd118ac23c6a2fb2c7954d30ef
rename ambiguous fuzzer
[ { "change_type": "MODIFY", "old_path": ".github/workflows/fuzzers.yml", "new_path": ".github/workflows/fuzzers.yml", "diff": "@@ -75,7 +75,7 @@ jobs:\n- afl_two_instances\n- afl_no_favored\n- afl_random_favored\n- - aflpp_random_base\n+ - aflpp_random_default\n- aflpp_random_no_favs\n- aflpp_random_wrs\n- aflpp_random_wrs_rf\n" }, { "change_type": "RENAME", "old_path": "fuzzers/aflpp_random_base/builder.Dockerfile", "new_path": "fuzzers/aflpp_random_default/builder.Dockerfile", "diff": "" }, { "change_type": "RENAME", "old_path": "fuzzers/aflpp_random_base/fuzzer.py", "new_path": "fuzzers/aflpp_random_default/fuzzer.py", "diff": "" }, { "change_type": "RENAME", "old_path": "fuzzers/aflpp_random_base/runner.Dockerfile", "new_path": "fuzzers/aflpp_random_default/runner.Dockerfile", "diff": "" }, { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "- experiment: 2021-10-19-aflpp-rf\ndescription: \"Benchmark afl++ random fuzzing mode\"\nfuzzers:\n- - aflpp_random_base\n+ - aflpp_random_default\n- aflpp_random_no_favs\n- aflpp_random_wrs\n- aflpp_random_wrs_rf\n" } ]
Python
Apache License 2.0
google/fuzzbench
rename ambiguous fuzzer
258,409
17.11.2021 03:11:58
-39,600
a78d310b6acbaf412a8feee2290a718580833124
Add new fuzzer pythia_bb with improvements to pythia_effect_bb
[ { "change_type": "MODIFY", "old_path": ".github/workflows/fuzzers.yml", "new_path": ".github/workflows/fuzzers.yml", "diff": "@@ -38,6 +38,7 @@ jobs:\n- afldd\n- aflpp_vs_dd\n- pythia_effect_bb\n+ - pythia_bb\n# Binary-only (greybox) fuzzers.\n- eclipser\n- afl_qemu\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/pythia_bb/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\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/dliyanage/pythia /afl && \\\n+ cd /afl && \\\n+ git checkout af0a01dc3146c93b5e8bb32621d3f2f4ebb2e257 && \\\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/pythia_bb/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 json\n+import os\n+import shutil\n+import subprocess\n+\n+from fuzzers import utils\n+\n+\n+def prepare_build_environment():\n+ \"\"\"Set environment variables used to build targets for AFL-based\n+ fuzzers.\"\"\"\n+ cflags = ['-fsanitize-coverage=trace-pc-guard']\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'] = '/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 get_stats(output_corpus, fuzzer_log): # pylint: disable=unused-argument\n+ \"\"\"Gets fuzzer stats for AFL.\"\"\"\n+ # Get a dictionary containing the stats AFL reports.\n+ stats_file = os.path.join(output_corpus, 'fuzzer_stats')\n+ with open(stats_file) as file_handle:\n+ stats_file_lines = file_handle.read().splitlines()\n+ stats_file_dict = {}\n+ for stats_line in stats_file_lines:\n+ key, value = stats_line.split(': ')\n+ stats_file_dict[key.strip()] = value.strip()\n+\n+ # Report to FuzzBench the stats it accepts.\n+ stats = {'execs_per_sec': float(stats_file_dict['execs_per_sec'])}\n+ return json.dumps(stats)\n+\n+\n+def prepare_fuzz_environment(input_corpus):\n+ \"\"\"Prepare to fuzz with AFL or another AFL-based fuzzer.\"\"\"\n+ # Tell AFL to not use its terminal UI so we get usable logs.\n+ os.environ['AFL_NO_UI'] = '1'\n+ # Skip AFL's CPU frequency check (fails on Docker).\n+ os.environ['AFL_SKIP_CPUFREQ'] = '1'\n+ # No need to bind affinity to one core, Docker enforces 1 core usage.\n+ os.environ['AFL_NO_AFFINITY'] = '1'\n+ # AFL will abort on startup if the core pattern sends notifications to\n+ # external programs. We don't care about this.\n+ os.environ['AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES'] = '1'\n+ # Don't exit when crashes are found. This can happen when corpus from\n+ # OSS-Fuzz is used.\n+ os.environ['AFL_SKIP_CRASHES'] = '1'\n+ # Shuffle the queue\n+ os.environ['AFL_SHUFFLE_QUEUE'] = '1'\n+\n+ # AFL needs at least one non-empty seed to start.\n+ utils.create_seed_file_for_empty_corpus(input_corpus)\n+\n+\n+def check_skip_det_compatible(additional_flags):\n+ \"\"\" Checks if additional flags are compatible with '-d' option\"\"\"\n+ # AFL refuses to take in '-d' with '-M' or '-S' options for parallel mode.\n+ # (cf. https://github.com/google/AFL/blob/8da80951/afl-fuzz.c#L7477)\n+ if '-M' in additional_flags or '-S' in additional_flags:\n+ return False\n+ return True\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+ print('[run_afl_fuzz] 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+ '-t',\n+ '1000+', # Use same default 1 sec timeout, but add '+' to skip hangs.\n+ ]\n+ # Use '-d' to skip deterministic mode, as long as it it compatible with\n+ # additional flags.\n+ if not additional_flags or check_skip_det_compatible(additional_flags):\n+ command.append('-d')\n+ if additional_flags:\n+ command.extend(additional_flags)\n+ dictionary_path = utils.get_dictionary_path(target_binary)\n+ if dictionary_path:\n+ command.extend(['-x', dictionary_path])\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+ print('[run_afl_fuzz] Running command: ' + ' '.join(command))\n+ output_stream = subprocess.DEVNULL if hide_output else None\n+ subprocess.check_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+ 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/pythia_bb/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-image\n" }, { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2021-11-16-aflbb\n+ description: \"Evaluate fuzzer effectiveness in blackbox mode - experiment 2\"\n+ fuzzers:\n+ - pythia_bb\n+ - afl\n+\n- experiment: 2021-11-15-bug\ndescription: \"Compare Zafl to standard source-only and binary-only fuzzers (bug).\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
Add new fuzzer pythia_bb with improvements to pythia_effect_bb (#1282) Co-authored-by: jonathanmetzman <[email protected]>
258,416
18.11.2021 19:57:27
18,000
976e933726beb218c5a48e55ef64ff479b324418
Fix broken link: master -> main for llvm repo
[ { "change_type": "MODIFY", "old_path": "docs/getting-started/adding_a_new_fuzzer.md", "new_path": "docs/getting-started/adding_a_new_fuzzer.md", "diff": "@@ -187,13 +187,13 @@ If, like AFL, your fuzzer has a [persistent mode](https://lcamtuf.blogspot.com/2\nyour `FUZZER_LIB` should be a library that will call `LLVMFuzzerTestOneInput`\nin a loop during fuzzing.\nFor example, in [afl's builder.Dockerfile](https://github.com/google/fuzzbench/blob/master/fuzzers/afl/builder.Dockerfile)\n-you can see how [afl_driver.cpp](https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/fuzzer/afl/afl_driver.cpp#L223-L276)\n+you can see how [afl_driver.cpp](https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/fuzzer/afl/afl_driver.cpp#L223-L276)\nis built. In\n[afl's fuzzer.py](https://github.com/google/fuzzbench/blob/master/fuzzers/afl/fuzzer.py)\nthis gets used as the `FUZZER_LIB`.\nIf your fuzzer does not support persistent mode, you can use the\n-[StandAloneFuzzTargetMain.cpp](https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/fuzzer/standalone/StandaloneFuzzTargetMain.c)\n+[StandAloneFuzzTargetMain.cpp](https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/fuzzer/standalone/StandaloneFuzzTargetMain.c)\nas your `FUZZER_LIB`. This file takes files as arguments, reads them, and\ninvokes `LLVMFuzzerTestOneInput` using their data as input\n(See [Eclipser](https://github.com/google/fuzzbench/blob/master/fuzzers/eclipser/builder.Dockerfile)\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix broken link: master -> main for llvm repo (#1288)
258,388
19.11.2021 16:13:19
18,000
aeb2f6b956f3600ed748270881cee6bd1d83cc1d
Fix sqlite3 benchmark
[ { "change_type": "MODIFY", "old_path": "benchmarks/sqlite3_ossfuzz/Dockerfile", "new_path": "benchmarks/sqlite3_ossfuzz/Dockerfile", "diff": "################################################################################\nFROM gcr.io/oss-fuzz-base/base-builder@sha256:1b6a6993690fa947df74ceabbf6a1f89a46d7e4277492addcd45a8525e34be5a\n-RUN apt-get update && apt-get install -y make autoconf automake libtool curl tcl zlib1g-dev\n+RUN apt-get update && apt-get upgrade -y && apt-get install -y make autoconf automake libtool curl tcl zlib1g-dev\nRUN mkdir $SRC/sqlite3 && \\\ncd $SRC/sqlite3 && \\\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix sqlite3 benchmark (#1289)
258,388
23.11.2021 13:23:11
18,000
7b87c735c8ac28d71b2895a15a9992b439d634b1
Don't log retries when reporting errors. This can lead to infinite loop.
[ { "change_type": "MODIFY", "old_path": "common/logs.py", "new_path": "common/logs.py", "diff": "@@ -183,8 +183,10 @@ def error(message, *args, extras=None, logger=None):\n\"\"\"Logs |message| to stackdriver logging and error reporting (including\nexception if there was one.\"\"\"\n- @retry.wrap(NUM_RETRIES, RETRY_DELAY,\n- 'common.logs.error._report_error_with_retries')\n+ @retry.wrap(NUM_RETRIES,\n+ RETRY_DELAY,\n+ 'common.logs.error._report_error_with_retries',\n+ log_retries=False)\ndef _report_error_with_retries(message):\nif utils.is_local():\nreturn\n" } ]
Python
Apache License 2.0
google/fuzzbench
Don't log retries when reporting errors. (#1287) This can lead to infinite loop.
258,388
06.12.2021 14:56:18
18,000
5a00b761e550e64693233d18fc5eff5f79adf022
Fix fafuzzer experiment name
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# 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#\n-- experiment: 2021-12-2-fafuzzer\n- description: \"Evaluate fuzeer effectiveness on fafuzz and other fuzzers\"\n+- experiment: 2021-12-06-fafuzzer\n+ description: \"Evaluate fuzzer effectiveness on fafuzz and other fuzzers\"\nfuzzers:\n- fafuzz\n- afl\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix fafuzzer experiment name (#1301)
258,388
09.12.2021 13:51:49
18,000
81c45872f7158d59f3200ad3b58082834e6d904e
[benchmarks] Run apt-get upgrade in broken benchmarks To prevent
[ { "change_type": "MODIFY", "old_path": "benchmarks/arrow_parquet-arrow-fuzz/Dockerfile", "new_path": "benchmarks/arrow_parquet-arrow-fuzz/Dockerfile", "diff": "@@ -18,7 +18,7 @@ FROM gcr.io/oss-fuzz-base/base-builder@sha256:1b6a6993690fa947df74ceabbf6a1f89a4\nENV DEBIAN_FRONTEND noninteractive\nRUN apt-get update -y -q && \\\n- apt-get update -y -q && \\\n+ apt-get upgrade -y -q && \\\napt-get install -y -q --no-install-recommends \\\nbison \\\nbuild-essential \\\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/bloaty_fuzz_target/Dockerfile", "new_path": "benchmarks/bloaty_fuzz_target/Dockerfile", "diff": "################################################################################\nFROM gcr.io/oss-fuzz-base/base-builder@sha256:1b6a6993690fa947df74ceabbf6a1f89a46d7e4277492addcd45a8525e34be5a\n-RUN apt-get update && apt-get install -y cmake ninja-build g++\n+RUN apt-get update && apt-get upgrade -y && apt-get install -y cmake ninja-build g++\nRUN git clone --depth 1 https://github.com/google/bloaty.git bloaty\nWORKDIR bloaty\nCOPY build.sh $SRC/\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/freetype2-2017/Dockerfile", "new_path": "benchmarks/freetype2-2017/Dockerfile", "diff": "FROM gcr.io/oss-fuzz-base/base-builder@sha256:1b6a6993690fa947df74ceabbf6a1f89a46d7e4277492addcd45a8525e34be5a\nRUN apt-get update && \\\n+ apt-get upgrade -y && \\\napt-get install -y \\\nmake \\\nautoconf \\\n" } ]
Python
Apache License 2.0
google/fuzzbench
[benchmarks] Run apt-get upgrade in broken benchmarks (#1305) To prevent https://github.com/google/fuzzbench/issues/1304
258,413
15.12.2021 00:30:49
-28,800
65297c4c76e63cbe4025f1ce7abc1e89b7a1566c
add afl-2.52b & requesting for a new experiment
[ { "change_type": "MODIFY", "old_path": ".github/workflows/fuzzers.yml", "new_path": ".github/workflows/fuzzers.yml", "diff": "@@ -60,6 +60,7 @@ jobs:\n- symcc_afl_single\n# Temporary variants.\n- aflplusplus_dict2file\n+ - afl_2_52_b\n- aflplusplus_cmplog\n- aflplusplus_311\n- aflplusplus_313\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/afl_2_52_b/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\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/Fuzzers-Archive/afl-2.52b.git /afl && \\\n+ cd /afl && \\\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_2_52_b/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 json\n+import os\n+import shutil\n+import subprocess\n+\n+from fuzzers import utils\n+\n+\n+def prepare_build_environment():\n+ \"\"\"Set environment variables used to build targets for AFL-based\n+ fuzzers.\"\"\"\n+ cflags = ['-fsanitize-coverage=trace-pc-guard']\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'] = '/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 get_stats(output_corpus, fuzzer_log): # pylint: disable=unused-argument\n+ \"\"\"Gets fuzzer stats for AFL.\"\"\"\n+ # Get a dictionary containing the stats AFL reports.\n+ stats_file = os.path.join(output_corpus, 'fuzzer_stats')\n+ with open(stats_file) as file_handle:\n+ stats_file_lines = file_handle.read().splitlines()\n+ stats_file_dict = {}\n+ for stats_line in stats_file_lines:\n+ key, value = stats_line.split(': ')\n+ stats_file_dict[key.strip()] = value.strip()\n+\n+ # Report to FuzzBench the stats it accepts.\n+ stats = {'execs_per_sec': float(stats_file_dict['execs_per_sec'])}\n+ return json.dumps(stats)\n+\n+\n+def prepare_fuzz_environment(input_corpus):\n+ \"\"\"Prepare to fuzz with AFL or another AFL-based fuzzer.\"\"\"\n+ # Tell AFL to not use its terminal UI so we get usable logs.\n+ os.environ['AFL_NO_UI'] = '1'\n+ # Skip AFL's CPU frequency check (fails on Docker).\n+ os.environ['AFL_SKIP_CPUFREQ'] = '1'\n+ # No need to bind affinity to one core, Docker enforces 1 core usage.\n+ os.environ['AFL_NO_AFFINITY'] = '1'\n+ # AFL will abort on startup if the core pattern sends notifications to\n+ # external programs. We don't care about this.\n+ os.environ['AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES'] = '1'\n+ # Don't exit when crashes are found. This can happen when corpus from\n+ # OSS-Fuzz is used.\n+ os.environ['AFL_SKIP_CRASHES'] = '1'\n+ # Shuffle the queue\n+ os.environ['AFL_SHUFFLE_QUEUE'] = '1'\n+\n+ # AFL needs at least one non-empty seed to start.\n+ utils.create_seed_file_for_empty_corpus(input_corpus)\n+\n+\n+def check_skip_det_compatible(additional_flags):\n+ \"\"\" Checks if additional flags are compatible with '-d' option\"\"\"\n+ # AFL refuses to take in '-d' with '-M' or '-S' options for parallel mode.\n+ # (cf. https://github.com/google/AFL/blob/8da80951/afl-fuzz.c#L7477)\n+ if '-M' in additional_flags or '-S' in additional_flags:\n+ return False\n+ return True\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+ print('[run_afl_fuzz] 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+ '-t',\n+ '1000+', # Use same default 1 sec timeout, but add '+' to skip hangs.\n+ ]\n+ # Use '-d' to skip deterministic mode, as long as it it compatible with\n+ # additional flags.\n+ if not additional_flags or check_skip_det_compatible(additional_flags):\n+ command.append('-d')\n+ if additional_flags:\n+ command.extend(additional_flags)\n+ dictionary_path = utils.get_dictionary_path(target_binary)\n+ if dictionary_path:\n+ command.extend(['-x', dictionary_path])\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+ print('[run_afl_fuzz] Running command: ' + ' '.join(command))\n+ output_stream = subprocess.DEVNULL if hide_output else None\n+ subprocess.check_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+ 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_2_52_b/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-image\n" }, { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2021-12-14-fafuzzer\n+ description: \"Evaluate fuzzer effectiveness on fafuzz and other fuzzers\"\n+ fuzzers:\n+ - fafuzz\n+ - afl_2_52_b\n+ - mopt\n+\n- experiment: 2021-12-13-libafl\ndescription: \"libaf test\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
add afl-2.52b & requesting for a new experiment (#1307) Co-authored-by: jonathanmetzman <[email protected]>
258,375
12.02.2022 01:48:41
-25,200
f6924fc84563b9c8428c035ba329cedcc42c33fb
request experiment 2022-01-31-main-fuzzers
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-01-31-main-fuzzers\n+ description: \"evaluate up-to-date version of main fuzzers\"\n+ fuzzers:\n+ - honggfuzz\n+ - aflplusplus\n+ - eclipser\n+ - entropic\n+ - libfuzzer\n+ - aflsmart\n+ - lafintel\n+ - afl\n+ - mopt\n+ - aflfast\n+ - fairfuzz\n+\n- experiment: 2022-01-17-afl-culling-bug\ndescription: \"afl without corpus culling eval\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
request experiment 2022-01-31-main-fuzzers (#1328)
258,375
25.02.2022 23:52:40
-25,200
c01034d0764eceb9f2fa782c0332f6ef72bdc0c0
Benchmark variants of libfuzzer that skip intermediate inputs
[ { "change_type": "MODIFY", "old_path": ".github/workflows/fuzzers.yml", "new_path": ".github/workflows/fuzzers.yml", "diff": "@@ -77,6 +77,8 @@ jobs:\n- aflplusplus_pcguard\n- aflplusplus_classic\n- aflplusplus_frida_cache\n+ - entropic_execute_final\n+ - libfuzzer_exeute_final\nbenchmark_type:\n- oss-fuzz\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/entropic_execute_final/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\n+FROM $parent_image\n+\n+RUN git clone https://github.com/jiradeto/llvm-project.git /llvm-project && \\\n+ cd /llvm-project && \\\n+ git checkout fzb_entropic_skip_intermediates_random && \\\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 /libEntropic.a *.o\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/entropic_execute_final/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 Entropic 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+ cflags = ['-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'] = '/libEntropic.a'\n+\n+ utils.build_benchmark()\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\"\"\"\n+ libfuzzer_fuzzer.run_fuzzer(input_corpus,\n+ output_corpus,\n+ target_binary,\n+ extra_flags=[\n+ '-entropic=1', '-keep_seed=1',\n+ '-cross_over_uniform_dist=1',\n+ '-entropic_scale_per_exec_time=1',\n+ '-mutate_depth=3'\n+ ])\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/entropic_execute_final/patch.diff", "diff": "+diff --git a/compiler-rt/lib/fuzzer/FuzzerFork.cpp b/compiler-rt/lib/fuzzer/FuzzerFork.cpp\n+index 84725d2..4e1a506 100644\n+--- a/compiler-rt/lib/fuzzer/FuzzerFork.cpp\n++++ b/compiler-rt/lib/fuzzer/FuzzerFork.cpp\n+@@ -26,6 +26,8 @@\n+ #include <queue>\n+ #include <sstream>\n+ #include <thread>\n++#include <sys/stat.h>\n++#include <iostream>\n+\n+ namespace fuzzer {\n+\n+@@ -70,6 +72,8 @@ struct FuzzJob {\n+ std::string SeedListPath;\n+ std::string CFPath;\n+ size_t JobId;\n++ bool Executing = false;\n++ Vector<std::string> CopiedSeeds;\n+\n+ int DftTimeInSeconds = 0;\n+\n+@@ -124,7 +128,6 @@ struct GlobalEnv {\n+ Cmd.addFlag(\"reload\", \"0\"); // working in an isolated dir, no reload.\n+ Cmd.addFlag(\"print_final_stats\", \"1\");\n+ Cmd.addFlag(\"print_funcs\", \"0\"); // no need to spend time symbolizing.\n+- Cmd.addFlag(\"max_total_time\", std::to_string(std::min((size_t)300, JobId)));\n+ Cmd.addFlag(\"stop_file\", StopFile());\n+ if (!DataFlowBinary.empty()) {\n+ Cmd.addFlag(\"data_flow_trace\", DFTDir);\n+@@ -133,11 +136,10 @@ struct GlobalEnv {\n+ }\n+ auto Job = new FuzzJob;\n+ std::string Seeds;\n+- if (size_t CorpusSubsetSize =\n+- std::min(Files.size(), (size_t)sqrt(Files.size() + 2))) {\n++ if (size_t CorpusSubsetSize = Files.size()) {\n+ auto Time1 = std::chrono::system_clock::now();\n+ for (size_t i = 0; i < CorpusSubsetSize; i++) {\n+- auto &SF = Files[Rand->SkewTowardsLast(Files.size())];\n++ auto &SF = Files[i];\n+ Seeds += (Seeds.empty() ? \"\" : \",\") + SF;\n+ CollectDFT(SF);\n+ }\n+@@ -213,11 +215,20 @@ struct GlobalEnv {\n+ Set<uint32_t> NewFeatures, NewCov;\n+ CrashResistantMerge(Args, {}, MergeCandidates, &FilesToAdd, Features,\n+ &NewFeatures, Cov, &NewCov, Job->CFPath, false);\n++ RemoveFile(Job->CFPath);\n+ for (auto &Path : FilesToAdd) {\n+- auto U = FileToVector(Path);\n+- auto NewPath = DirPlusFile(MainCorpusDir, Hash(U));\n+- WriteToFile(U, NewPath);\n+- Files.push_back(NewPath);\n++ // Only merge files that have not been merged already.\n++ if (std::find(Job->CopiedSeeds.begin(), Job->CopiedSeeds.end(), Path) == Job->CopiedSeeds.end()) {\n++ // NOT THREAD SAFE: Fast check whether file still exists.\n++ struct stat buffer;\n++ if (stat (Path.c_str(), &buffer) == 0) {\n++ auto U = FileToVector(Path);\n++ auto NewPath = DirPlusFile(MainCorpusDir, Hash(U));\n++ WriteToFile(U, NewPath);\n++ Files.push_back(NewPath);\n++ Job->CopiedSeeds.push_back(Path);\n++ }\n++ }\n+ }\n+ Features.insert(NewFeatures.begin(), NewFeatures.end());\n+ Cov.insert(NewCov.begin(), NewCov.end());\n+@@ -271,10 +282,19 @@ struct JobQueue {\n+ }\n+ };\n+\n+-void WorkerThread(JobQueue *FuzzQ, JobQueue *MergeQ) {\n++void WorkerThread(GlobalEnv *Env, JobQueue *FuzzQ, JobQueue *MergeQ) {\n+ while (auto Job = FuzzQ->Pop()) {\n+- // Printf(\"WorkerThread: job %p\\n\", Job);\n++ Job->Executing = true;\n++ int Sleep_ms = 5 * 60 * 1000;\n++ std::thread([=]() {\n++ std::this_thread::sleep_for(std::chrono::milliseconds(Sleep_ms / 5));\n++ while (Job->Executing) {\n++ Env->RunOneMergeJob(Job);\n++ std::this_thread::sleep_for(std::chrono::milliseconds(Sleep_ms));\n++ }\n++ }).detach();\n+ Job->ExitCode = ExecuteCommand(Job->Cmd);\n++ Job->Executing = false;\n+ MergeQ->Push(Job);\n+ }\n+ }\n+@@ -335,7 +355,7 @@ void FuzzWithFork(Random &Rand, const FuzzingOptions &Options,\n+ size_t JobId = 1;\n+ Vector<std::thread> Threads;\n+ for (int t = 0; t < NumJobs; t++) {\n+- Threads.push_back(std::thread(WorkerThread, &FuzzQ, &MergeQ));\n++ Threads.push_back(std::thread(WorkerThread, &Env, &FuzzQ, &MergeQ));\n+ FuzzQ.Push(Env.CreateNewJob(JobId++));\n+ }\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/entropic_execute_final/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-image\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/libfuzzer_exeute_final/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\n+FROM $parent_image\n+\n+RUN git clone https://github.com/jiradeto/llvm-project.git /llvm-project && \\\n+ cd /llvm-project/ && \\\n+ git checkout fzb_libfuzzer_skip_intermediates_random && \\\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_exeute_final/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 subprocess\n+import os\n+\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+ cflags = ['-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. Wrapper that uses the defaults when calling\n+ run_fuzzer.\"\"\"\n+ run_fuzzer(input_corpus,\n+ output_corpus,\n+ target_binary,\n+ extra_flags=['-keep_seed=1', '-cross_over_uniform_dist=1'])\n+\n+\n+def run_fuzzer(input_corpus, output_corpus, target_binary, extra_flags=None):\n+ \"\"\"Run fuzzer.\"\"\"\n+ if extra_flags is None:\n+ extra_flags = []\n+\n+ # Seperate out corpus and crash directories as sub-directories of\n+ # |output_corpus| to avoid conflicts when corpus directory is reloaded.\n+ crashes_dir = os.path.join(output_corpus, 'crashes')\n+ output_corpus = os.path.join(output_corpus, 'corpus')\n+ os.makedirs(crashes_dir)\n+ os.makedirs(output_corpus)\n+\n+ flags = [\n+ '-print_final_stats=1',\n+ # `close_fd_mask` to prevent too much logging output from the target.\n+ '-close_fd_mask=3',\n+ # Run in fork mode to allow ignoring ooms, timeouts, crashes and\n+ # continue fuzzing indefinitely.\n+ '-fork=1',\n+ '-ignore_ooms=1',\n+ '-ignore_timeouts=1',\n+ '-ignore_crashes=1',\n+\n+ # Don't use LSAN's leak detection. Other fuzzers won't be using it and\n+ # using it will cause libFuzzer to find \"crashes\" no one cares about.\n+ '-detect_leaks=0',\n+ '-mutate_depth=3',\n+\n+ # Store crashes along with corpus for bug based benchmarking.\n+ f'-artifact_prefix={crashes_dir}/',\n+ ]\n+ flags += extra_flags\n+ if 'ADDITIONAL_ARGS' in os.environ:\n+ flags += os.environ['ADDITIONAL_ARGS'].split(' ')\n+ dictionary_path = utils.get_dictionary_path(target_binary)\n+ if dictionary_path:\n+ flags.append('-dict=' + dictionary_path)\n+\n+ command = [target_binary] + flags + [output_corpus, input_corpus]\n+ print('[run_fuzzer] Running command: ' + ' '.join(command))\n+ subprocess.check_call(command)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/libfuzzer_exeute_final/patch.diff", "diff": "+diff --git a/compiler-rt/lib/fuzzer/FuzzerFork.cpp b/compiler-rt/lib/fuzzer/FuzzerFork.cpp\n+index 84725d2..4e1a506 100644\n+--- a/compiler-rt/lib/fuzzer/FuzzerFork.cpp\n++++ b/compiler-rt/lib/fuzzer/FuzzerFork.cpp\n+@@ -26,6 +26,8 @@\n+ #include <queue>\n+ #include <sstream>\n+ #include <thread>\n++#include <sys/stat.h>\n++#include <iostream>\n+\n+ namespace fuzzer {\n+\n+@@ -70,6 +72,8 @@ struct FuzzJob {\n+ std::string SeedListPath;\n+ std::string CFPath;\n+ size_t JobId;\n++ bool Executing = false;\n++ Vector<std::string> CopiedSeeds;\n+\n+ int DftTimeInSeconds = 0;\n+\n+@@ -124,7 +128,6 @@ struct GlobalEnv {\n+ Cmd.addFlag(\"reload\", \"0\"); // working in an isolated dir, no reload.\n+ Cmd.addFlag(\"print_final_stats\", \"1\");\n+ Cmd.addFlag(\"print_funcs\", \"0\"); // no need to spend time symbolizing.\n+- Cmd.addFlag(\"max_total_time\", std::to_string(std::min((size_t)300, JobId)));\n+ Cmd.addFlag(\"stop_file\", StopFile());\n+ if (!DataFlowBinary.empty()) {\n+ Cmd.addFlag(\"data_flow_trace\", DFTDir);\n+@@ -133,11 +136,10 @@ struct GlobalEnv {\n+ }\n+ auto Job = new FuzzJob;\n+ std::string Seeds;\n+- if (size_t CorpusSubsetSize =\n+- std::min(Files.size(), (size_t)sqrt(Files.size() + 2))) {\n++ if (size_t CorpusSubsetSize = Files.size()) {\n+ auto Time1 = std::chrono::system_clock::now();\n+ for (size_t i = 0; i < CorpusSubsetSize; i++) {\n+- auto &SF = Files[Rand->SkewTowardsLast(Files.size())];\n++ auto &SF = Files[i];\n+ Seeds += (Seeds.empty() ? \"\" : \",\") + SF;\n+ CollectDFT(SF);\n+ }\n+@@ -213,11 +215,20 @@ struct GlobalEnv {\n+ Set<uint32_t> NewFeatures, NewCov;\n+ CrashResistantMerge(Args, {}, MergeCandidates, &FilesToAdd, Features,\n+ &NewFeatures, Cov, &NewCov, Job->CFPath, false);\n++ RemoveFile(Job->CFPath);\n+ for (auto &Path : FilesToAdd) {\n+- auto U = FileToVector(Path);\n+- auto NewPath = DirPlusFile(MainCorpusDir, Hash(U));\n+- WriteToFile(U, NewPath);\n+- Files.push_back(NewPath);\n++ // Only merge files that have not been merged already.\n++ if (std::find(Job->CopiedSeeds.begin(), Job->CopiedSeeds.end(), Path) == Job->CopiedSeeds.end()) {\n++ // NOT THREAD SAFE: Fast check whether file still exists.\n++ struct stat buffer;\n++ if (stat (Path.c_str(), &buffer) == 0) {\n++ auto U = FileToVector(Path);\n++ auto NewPath = DirPlusFile(MainCorpusDir, Hash(U));\n++ WriteToFile(U, NewPath);\n++ Files.push_back(NewPath);\n++ Job->CopiedSeeds.push_back(Path);\n++ }\n++ }\n+ }\n+ Features.insert(NewFeatures.begin(), NewFeatures.end());\n+ Cov.insert(NewCov.begin(), NewCov.end());\n+@@ -271,10 +282,19 @@ struct JobQueue {\n+ }\n+ };\n+\n+-void WorkerThread(JobQueue *FuzzQ, JobQueue *MergeQ) {\n++void WorkerThread(GlobalEnv *Env, JobQueue *FuzzQ, JobQueue *MergeQ) {\n+ while (auto Job = FuzzQ->Pop()) {\n+- // Printf(\"WorkerThread: job %p\\n\", Job);\n++ Job->Executing = true;\n++ int Sleep_ms = 5 * 60 * 1000;\n++ std::thread([=]() {\n++ std::this_thread::sleep_for(std::chrono::milliseconds(Sleep_ms / 5));\n++ while (Job->Executing) {\n++ Env->RunOneMergeJob(Job);\n++ std::this_thread::sleep_for(std::chrono::milliseconds(Sleep_ms));\n++ }\n++ }).detach();\n+ Job->ExitCode = ExecuteCommand(Job->Cmd);\n++ Job->Executing = false;\n+ MergeQ->Push(Job);\n+ }\n+ }\n+@@ -335,7 +355,7 @@ void FuzzWithFork(Random &Rand, const FuzzingOptions &Options,\n+ size_t JobId = 1;\n+ Vector<std::thread> Threads;\n+ for (int t = 0; t < NumJobs; t++) {\n+- Threads.push_back(std::thread(WorkerThread, &FuzzQ, &MergeQ));\n++ Threads.push_back(std::thread(WorkerThread, &Env, &FuzzQ, &MergeQ));\n+ FuzzQ.Push(Env.CreateNewJob(JobId++));\n+ }\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/libfuzzer_exeute_final/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-image\n" }, { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-02-25-libfuzzer-variants\n+ description: \"Requesting experiment on variants of libfuzzer.\"\n+ fuzzers:\n+ - libfuzzer\n+ - entropic\n+ - libfuzzer_exeute_final\n+ - entropic_execute_final\n+ - honggfuzz\n+ - aflplusplus\n+ - eclipser\n+ - aflsmart\n+ - afl\n+ - aflfast\n+ - fairfuzz\n+\n- experiment: 2022-02-15-grammar\ndescription: \"test grammar fuzzers\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
Benchmark variants of libfuzzer that skip intermediate inputs (#1336)
258,423
27.02.2022 09:10:44
25,200
6236cecdcfe06b94ae43a1fd31f4821a8b56485c
Fix libxml2_xml_reader_for_file_fuzzer cert error
[ { "change_type": "MODIFY", "old_path": "benchmarks/libxml2_libxml2_xml_reader_for_file_fuzzer/Dockerfile", "new_path": "benchmarks/libxml2_libxml2_xml_reader_for_file_fuzzer/Dockerfile", "diff": "FROM gcr.io/oss-fuzz-base/base-builder@sha256:1b6a6993690fa947df74ceabbf6a1f89a46d7e4277492addcd45a8525e34be5a\n-RUN apt-get update && apt-get install -y make autoconf automake libtool pkg-config python-dev python3-dev\n+# Upgrade to avoid certs errors\n+RUN apt-get update && apt-get upgrade -y && \\\n+ apt-get install -y make autoconf automake libtool pkg-config python-dev python3-dev\nRUN git clone https://gitlab.gnome.org/GNOME/libxml2.git\nWORKDIR libxml2\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix libxml2_xml_reader_for_file_fuzzer cert error (#1339) Co-authored-by: Sears <[email protected]>
258,388
02.03.2022 09:18:47
18,000
8858be7e05035103eac5db46ae682fad2c84fe5e
Remove tpm2 benchmark. Under UBSAN it crashes way too often (likely very shallow bugs). This makes it not useful as a benchmark. It also makes it bad to use with good benchmarks since it basically steals all the measurer's time running crashing testcases.
[ { "change_type": "DELETE", "old_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/Dockerfile", "new_path": null, "diff": "-# Copyright 2017 The Chromium Authors. All rights reserved.\n-# Use of this source code is governed by a BSD-style license that can be\n-# found in the LICENSE file.\n-#\n-# Defines a docker image that can build fuzzers.\n-#\n-FROM gcr.io/oss-fuzz-base/base-builder@sha256:1b6a6993690fa947df74ceabbf6a1f89a46d7e4277492addcd45a8525e34be5a\n-RUN apt-get update && apt-get install -y make libssl-dev binutils libgcc-5-dev\n-RUN git clone --depth 1 https://chromium.googlesource.com/chromiumos/third_party/tpm2\n-WORKDIR tpm2\n-RUN cp /src/tpm2/fuzz/build.sh /src/\n" }, { "change_type": "DELETE", "old_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/benchmark.yaml", "new_path": null, "diff": "-commit: 0f114d2d7eb1950faab02fe479864da5e5d50414\n-commit_date: 2017-10-27 05:37:00+00:00\n-fuzz_target: tpm2_execute_command_fuzzer\n-project: tpm2\n-type: bug\n-unsupported_fuzzers:\n- - aflcc\n- - afl_qemu\n- - aflplusplus_qemu\n- - aflplusplus_qemu_tracepc\n- - aflplusplus_frida\n- - honggfuzz_qemu\n- - klee\n- - weizz_qemu\n- - lafintel\n- - aflplusplus_cmplog_double\n- - symcc_aflplusplus_single\n- - eclipser_aflplusplus\n- - aflplusplus_qemu_double\n- - fuzzolic_aflplusplus_z3\n- - symqemu_aflplusplus\n- - fuzzolic_aflplusplus_fuzzy\n- - fuzzolic_aflplusplus_z3dict\n- - aflplusplus_gcc\n" }, { "change_type": "DELETE", "old_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/1497", "new_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/1497", "diff": "Binary files a/benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/1497 and /dev/null differ\n" }, { "change_type": "DELETE", "old_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/23127", "new_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/23127", "diff": "Binary files a/benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/23127 and /dev/null differ\n" }, { "change_type": "DELETE", "old_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/2326", "new_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/2326", "diff": "Binary files a/benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/2326 and /dev/null differ\n" }, { "change_type": "DELETE", "old_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/2663", "new_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/2663", "diff": "Binary files a/benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/2663 and /dev/null differ\n" }, { "change_type": "DELETE", "old_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/3916", "new_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/3916", "diff": "Binary files a/benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/3916 and /dev/null differ\n" }, { "change_type": "DELETE", "old_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/3925", "new_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/3925", "diff": "Binary files a/benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/3925 and /dev/null differ\n" }, { "change_type": "DELETE", "old_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/613", "new_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/613", "diff": "Binary files a/benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/613 and /dev/null differ\n" }, { "change_type": "DELETE", "old_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/621", "new_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/621", "diff": "Binary files a/benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/621 and /dev/null differ\n" }, { "change_type": "DELETE", "old_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/623", "new_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/623", "diff": "Binary files a/benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/623 and /dev/null differ\n" }, { "change_type": "DELETE", "old_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/638", "new_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/638", "diff": "Binary files a/benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/638 and /dev/null differ\n" }, { "change_type": "DELETE", "old_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/747", "new_path": "benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/747", "diff": "Binary files a/benchmarks/tpm2_tpm2_execute_command_fuzzer/testcases/747 and /dev/null differ\n" } ]
Python
Apache License 2.0
google/fuzzbench
Remove tpm2 benchmark. (#1345) Under UBSAN it crashes way too often (likely very shallow bugs). This makes it not useful as a benchmark. It also makes it bad to use with good benchmarks since it basically steals all the measurer's time running crashing testcases.
258,388
10.03.2022 14:35:35
18,000
b4c55087eb995be8909f3790ff7a808c69608efe
Mess up graphs to unbreak report generation. Related:
[ { "change_type": "MODIFY", "old_path": "analysis/plotting.py", "new_path": "analysis/plotting.py", "diff": "@@ -413,7 +413,8 @@ class Plotter:\ncmap_colors = ['#005a32', '#238b45', '#a1d99b', '#fbd7d4']\ncmap = colors.ListedColormap(cmap_colors)\n- boundaries = [0, 0.001, 0.01, 0.05, 1]\n+ # TODO(lszekeres): Add 1 back to this list.\n+ boundaries = [0, 0.001, 0.01, 0.05]\nnorm = colors.BoundaryNorm(boundaries, cmap.N)\nif symmetric:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Mess up graphs to unbreak report generation. (#1352) Related: #1351
258,388
17.03.2022 10:27:52
14,400
131ea6ede12f845f72de5aecef5f7a85efe777ff
Fix instructions on reproducing experiments
[ { "change_type": "MODIFY", "old_path": "analysis/experiment_results.py", "new_path": "analysis/experiment_results.py", "diff": "@@ -24,6 +24,14 @@ from analysis import data_utils\nfrom analysis import stat_tests\n+def strip_gs_protocol(url):\n+ \"\"\"Removes the leading gs:// from |url|.\"\"\"\n+ protocol = 'gs://'\n+ if not url.startswith(protocol):\n+ raise ValueError(f'{url} doesn\\'t start with {protocol}')\n+ return url[len(protocol):]\n+\n+\nclass ExperimentResults: # pylint: disable=too-many-instance-attributes\n\"\"\"Provides the main interface for getting various analysis results and\nplots about an experiment, represented by |experiment_df|.\n@@ -86,6 +94,9 @@ class ExperimentResults: # pylint: disable=too-many-instance-attributes\n# Dictionary to store the full coverage data.\nself._coverage_dict = coverage_dict\n+ self.experiment_filestore = strip_gs_protocol(\n+ experiment_df.experiment_filestore.iloc[0])\n+\ndef _get_full_path(self, filename):\nreturn os.path.join(self._output_directory, filename)\n" }, { "change_type": "MODIFY", "old_path": "analysis/rendering.py", "new_path": "analysis/rendering.py", "diff": "@@ -17,7 +17,6 @@ import os\nimport jinja2\n-from common import experiment_utils\nfrom common import utils\n@@ -43,8 +42,7 @@ def render_report(experiment_results, template, in_progress, coverage_report,\n)\ntemplate = environment.get_template(template)\n- config_path = (\n- experiment_utils.get_internal_experiment_config_relative_path())\n+ config_path = 'input/config/experiment.yaml'\nreturn template.render(experiment=experiment_results,\nin_progress=in_progress,\ncoverage_report=coverage_report,\n" }, { "change_type": "MODIFY", "old_path": "analysis/report_templates/default.html", "new_path": "analysis/report_templates/default.html", "diff": "# Check out the right commit. <br>\ngit checkout {{ experiment.git_hash }} <br>\n# Download the internal config file. <br>\n- curl https://storage.googleapis.com/{{ experiment.name }}/{{ experiment_config_relative_path }} > /tmp/experiment-config.yaml<br>\n+ curl https://storage.googleapis.com/{{ experiment.experiment_filestore}}/{{ experiment.name }}/{{ experiment_config_relative_path }} > /tmp/experiment-config.yaml<br>\nmake install-dependencies <br>\n# Launch the experiment using paramters from the internal config file. <br>\nPYTHONPATH=. python experiment/reproduce_experiment.py -c /tmp/experiment-config.yaml -e &lt;new_experiment_name&gt;\n" }, { "change_type": "MODIFY", "old_path": "common/yaml_utils.py", "new_path": "common/yaml_utils.py", "diff": "# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"Yaml helpers.\"\"\"\n-import os\nimport yaml\ndef read(yaml_filename):\n\"\"\"Reads and loads yaml file specified by |yaml_filename|.\"\"\"\n- if not os.path.exists(yaml_filename):\n- raise Exception('Yaml file %s does not exist.' % yaml_filename)\n-\nwith open(yaml_filename) as file_handle:\nreturn yaml.load(file_handle, yaml.SafeLoader)\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix instructions on reproducing experiments (#1354)
258,388
21.03.2022 19:07:10
14,400
8db1d4222a17372e328d8148a772cd48a98b3edb
Prevent benchmark integration after a certain date. These benchmarks use Ubuntu 20.04 which FuzzBench does not use. Fixes:
[ { "change_type": "MODIFY", "old_path": "benchmarks/oss_fuzz_benchmark_integration.py", "new_path": "benchmarks/oss_fuzz_benchmark_integration.py", "diff": "@@ -32,6 +32,8 @@ from common import yaml_utils\nOSS_FUZZ_DIR = os.path.join(utils.ROOT_DIR, 'third_party', 'oss-fuzz')\nOSS_FUZZ_REPO_PATH = os.path.join(OSS_FUZZ_DIR, 'infra')\n+OSS_FUZZ_IMAGE_UPGRADE_DATE = datetime.datetime(\n+ year=2021, month=8, day=25, tzinfo=datetime.timezone.utc)\nclass GitRepoManager:\n@@ -185,6 +187,10 @@ def integrate_benchmark(project, fuzz_target, benchmark_name, commit,\n# work on arbitrary iso format strings.\ncommit_date = datetime.datetime.fromisoformat(commit_date).astimezone(\ndatetime.timezone.utc)\n+ if commit_date >= OSS_FUZZ_IMAGE_UPGRADE_DATE:\n+ raise ValueError(\n+ f'Cannot integrate benchmark after {OSS_FUZZ_IMAGE_UPGRADE_DATE}. '\n+ 'See https://github.com/google/fuzzbench/issues/1353')\ncopy_oss_fuzz_files(project, commit_date, benchmark_dir)\nreplace_base_builder(benchmark_dir, commit_date)\ncreate_oss_fuzz_yaml(project, fuzz_target, commit, commit_date,\n" } ]
Python
Apache License 2.0
google/fuzzbench
Prevent benchmark integration after a certain date. (#1355) These benchmarks use Ubuntu 20.04 which FuzzBench does not use. Fixes: https://github.com/google/fuzzbench/issues/1353
258,388
22.03.2022 15:30:52
14,400
5e871d47c92fa44d778f2e9e6584e3bbc17e473f
Handle local reports in repro instructions. Fixes
[ { "change_type": "MODIFY", "old_path": "analysis/experiment_results.py", "new_path": "analysis/experiment_results.py", "diff": "@@ -27,9 +27,9 @@ from analysis import stat_tests\ndef strip_gs_protocol(url):\n\"\"\"Removes the leading gs:// from |url|.\"\"\"\nprotocol = 'gs://'\n- if not url.startswith(protocol):\n- raise ValueError(f'{url} doesn\\'t start with {protocol}')\n+ if url.startswith(protocol):\nreturn url[len(protocol):]\n+ return url\nclass ExperimentResults: # pylint: disable=too-many-instance-attributes\n" } ]
Python
Apache License 2.0
google/fuzzbench
Handle local reports in repro instructions. (#1358) Fixes https://github.com/google/fuzzbench/issues/1357
258,388
28.03.2022 14:59:42
14,400
a3238755cdb958d86d7413dff6cf8ca1e7b61c5d
Add back sanitizer coverage fuzzer. * Add back sanitizer coverage fuzzer. This will be used to measure go coverage * Fix presubmit issue
[ { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/sanitizer_coverage/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+# Minor modification to dump_coverage on a successful inner merge step.\n+COPY patch.diff /\n+\n+# Use old libFuzzer code that supports -dump_coverage=1/trace-pc-guard coverage.\n+# This is the last libFuzzer version before support was removed.\n+RUN git clone https://github.com/llvm/llvm-project.git /llvm-project && \\\n+ cd /llvm-project && \\\n+ git checkout 0b5e6b11c358e704384520dc036eddb5da1c68bf && \\\n+ patch -p1 < /patch.diff && \\\n+ cd /llvm-project/compiler-rt/lib/fuzzer && \\\n+ bash build.sh && \\\n+ cp libFuzzer.a /usr/lib\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/sanitizer_coverage/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 coverage builds.\"\"\"\n+\n+import os\n+\n+from fuzzers import utils\n+\n+\n+def build():\n+ \"\"\"Build benchmark.\"\"\"\n+ cflags = ['-fsanitize-coverage=trace-pc-guard']\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": "ADD", "old_path": null, "new_path": "fuzzers/sanitizer_coverage/patch.diff", "diff": "+diff --git a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp\n+index 306e644277c..26db440ecd7 100644\n+--- a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp\n++++ b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp\n+@@ -737,6 +737,8 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {\n+ F->SetMaxInputLen(kDefaultMaxMergeLen);\n+ assert(Flags.merge_control_file);\n+ F->CrashResistantMergeInternalStep(Flags.merge_control_file);\n++ if (Options.DumpCoverage)\n++ TPC.DumpCoverage();\n+ exit(0);\n+ }\n+\n+diff --git a/compiler-rt/lib/fuzzer/build.sh b/compiler-rt/lib/fuzzer/build.sh\n+index 504e54e3a81..cf0690271e4 100755\n+--- a/compiler-rt/lib/fuzzer/build.sh\n++++ b/compiler-rt/lib/fuzzer/build.sh\n+@@ -2,7 +2,7 @@\n+ LIBFUZZER_SRC_DIR=$(dirname $0)\n+ CXX=\"${CXX:-clang}\"\n+ for f in $LIBFUZZER_SRC_DIR/*.cpp; do\n+- $CXX -g -O2 -fno-omit-frame-pointer -std=c++11 $f -c &\n++ $CXX -stdlib=libc++ -g -O2 -fno-omit-frame-pointer -std=c++11 $f -fPIC -c &\n+ done\n+ wait\n+ rm -f libFuzzer.a\n" }, { "change_type": "MODIFY", "old_path": "presubmit.py", "new_path": "presubmit.py", "diff": "@@ -129,7 +129,8 @@ class FuzzerAndBenchmarkValidator:\n# We know this is invalid and have already complained about it.\nreturn False\n- if fuzzer != 'coverage' and not is_fuzzer_tested_in_ci(fuzzer):\n+ if (fuzzer not in {'coverage', 'sanitizer_coverage'}\n+ and not is_fuzzer_tested_in_ci(fuzzer)):\nself.invalid_fuzzers.add(fuzzer)\nreturn False\n" }, { "change_type": "MODIFY", "old_path": "third_party/oss-fuzz", "new_path": "third_party/oss-fuzz", "diff": "-Subproject commit e25d79502e175cb7bd1f9838b1f3971bc550b988\n+Subproject commit d39cbb5a8ce75f6187bd7731e0099dbd1c23a3b1\n" } ]
Python
Apache License 2.0
google/fuzzbench
Add back sanitizer coverage fuzzer. (#1365) * Add back sanitizer coverage fuzzer. This will be used to measure go coverage * Fix presubmit issue
258,379
01.04.2022 15:33:17
-7,200
402c398db2028285ed2da6491abc90a96c74de3f
Tortoise * Integrating TortoiseFuzz * added newlines according to make format * Fix curl_curl_fuzzer_http Fixes: Related: * removed -j flag to utilize full parallelization
[ { "change_type": "MODIFY", "old_path": ".github/workflows/fuzzers.yml", "new_path": ".github/workflows/fuzzers.yml", "diff": "@@ -37,6 +37,7 @@ jobs:\n- pythia_effect_bb\n- pythia_bb\n- fafuzz\n+ - tortoisefuzz\n# Binary-only (greybox) fuzzers.\n- eclipser\n- afl_qemu\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/arrow_parquet-arrow-fuzz/benchmark.yaml", "new_path": "benchmarks/arrow_parquet-arrow-fuzz/benchmark.yaml", "diff": "@@ -52,3 +52,4 @@ unsupported_fuzzers:\n- fuzzolic_aflplusplus_z3dict\n- aflplusplus_gcc\n- aflplusplus_classic\n+ - tortoisefuzz\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/aspell_aspell_fuzzer/benchmark.yaml", "new_path": "benchmarks/aspell_aspell_fuzzer/benchmark.yaml", "diff": "@@ -46,3 +46,4 @@ unsupported_fuzzers:\n- symqemu_aflplusplus\n- fuzzolic_aflplusplus_fuzzy\n- fuzzolic_aflplusplus_z3dict\n+ - tortoisefuzz\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/curl_curl_fuzzer_http/Dockerfile", "new_path": "benchmarks/curl_curl_fuzzer_http/Dockerfile", "diff": "@@ -18,8 +18,8 @@ FROM gcr.io/oss-fuzz-base/base-builder@sha256:1b6a6993690fa947df74ceabbf6a1f89a4\n# Curl will be checked out to the commit hash specified in benchmark.yaml.\nRUN git clone --depth 1 https://github.com/curl/curl.git /src/curl\n-RUN git clone https://github.com/curl/curl-fuzzer.git /src/curl_fuzzer\n-RUN git -C /src/curl_fuzzer checkout -f 9a48d437484b5ad5f2a97c0cab0d8bcbb5d058de\n+RUN git clone https://github.com/curl/curl-fuzzer /src/curl_fuzzer\n+RUN git -C /src/curl_fuzzer checkout 543b9926cc322a18ad30945dc55d78dbbfa679e1\n# Use curl-fuzzer's scripts to get latest dependencies.\nRUN $SRC/curl_fuzzer/scripts/ossfuzzdeps.sh\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/libxml2_libxml2_xml_reader_for_file_fuzzer/benchmark.yaml", "new_path": "benchmarks/libxml2_libxml2_xml_reader_for_file_fuzzer/benchmark.yaml", "diff": "@@ -22,3 +22,4 @@ unsupported_fuzzers:\n- fuzzolic_aflplusplus_fuzzy\n- fuzzolic_aflplusplus_z3dict\n- aflplusplus_gcc\n+ - tortoisefuzz\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/openh264_decoder_fuzzer/benchmark.yaml", "new_path": "benchmarks/openh264_decoder_fuzzer/benchmark.yaml", "diff": "@@ -21,3 +21,4 @@ unsupported_fuzzers:\n- symqemu_aflplusplus\n- fuzzolic_aflplusplus_fuzzy\n- fuzzolic_aflplusplus_z3dict\n+ - tortoisefuzz\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/openssl_x509/benchmark.yaml", "new_path": "benchmarks/openssl_x509/benchmark.yaml", "diff": "@@ -21,3 +21,4 @@ unsupported_fuzzers:\n- cfctx_dataflow_svf\n- cfctx_dataflow_svf_llc\n- libafl\n+ - tortoisefuzz\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/php_php-fuzz-execute/benchmark.yaml", "new_path": "benchmarks/php_php-fuzz-execute/benchmark.yaml", "diff": "@@ -51,3 +51,4 @@ unsupported_fuzzers:\n- fuzzolic_aflplusplus_fuzzy\n- fuzzolic_aflplusplus_z3dict\n- aflplusplus_gcc\n+ - tortoisefuzz\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/poppler_pdf_fuzzer/benchmark.yaml", "new_path": "benchmarks/poppler_pdf_fuzzer/benchmark.yaml", "diff": "@@ -23,3 +23,4 @@ unsupported_fuzzers:\n- fuzzolic_aflplusplus_fuzzy\n- fuzzolic_aflplusplus_z3dict\n- aflplusplus_gcc\n+ - tortoisefuzz\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/tortoisefuzz/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+# Includes latest clang\n+ARG parent_image\n+FROM $parent_image\n+\n+# Prerequisits\n+\n+RUN apt-get update && \\\n+ apt-get -y install git build-essential cmake ninja-build \\\n+ python-dev \\\n+ wget\n+\n+ENV CC=gcc\n+ENV CXX=g++\n+\n+# Compile & Install llvm 6.0.0\n+RUN mkdir /workdir && cd /workdir && \\\n+ wget https://releases.llvm.org/6.0.0/llvm-6.0.0.src.tar.xz && \\\n+ wget https://releases.llvm.org/6.0.0/cfe-6.0.0.src.tar.xz && \\\n+ wget https://releases.llvm.org/6.0.0/compiler-rt-6.0.0.src.tar.xz && \\\n+ wget https://releases.llvm.org/6.0.0/clang-tools-extra-6.0.0.src.tar.xz && \\\n+ tar -xf llvm-6.0.0.src.tar.xz && mv llvm-6.0.0.src llvm6 && \\\n+ tar -xf cfe-6.0.0.src.tar.xz && mv cfe-6.0.0.src llvm6/tools/clang && \\\n+ tar -xf compiler-rt-6.0.0.src.tar.xz && mv compiler-rt-6.0.0.src llvm6/projects/compiler-rt && \\\n+ tar -xf clang-tools-extra-6.0.0.src.tar.xz && mv clang-tools-extra-6.0.0.src llvm6/tools/clang/tools/extra\n+\n+RUN cd /workdir && mkdir build6 && unset CFLAGS && unset CXXFLAGS && \\\n+ cd build6 && \\\n+ cmake -G \"Ninja\" -DLLVM_ENABLE_ASSERTIONS=On -DCMAKE_BUILD_TYPE=Release ../llvm6 && \\\n+ ninja && \\\n+ ninja install\n+\n+# Compile TortoiseFuzz\n+ENV CC=clang\n+ENV CXX=clang++\n+\n+RUN cd /workdir && \\\n+ git clone https://github.com/TortoiseFuzz/TortoiseFuzz.git && \\\n+ cd TortoiseFuzz && \\\n+ unset CFLAGS && unset CXXFLAGS && make\n+\n+# Use afl_driver.cpp from LLVM as our libFuzzer harness.\n+RUN \\\n+ wget https://raw.githubusercontent.com/llvm/llvm-project/5feb80e748924606531ba28c97fe65145c65372e/compiler-rt/lib/fuzzer/afl/afl_driver.cpp -O /workdir/TortoiseFuzz/afl_driver.cpp && \\\n+ clang++ -stdlib=libc++ -std=c++11 -O2 -c /workdir/TortoiseFuzz/afl_driver.cpp && \\\n+ ar r /libAFLDriver.a afl_driver.o\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/tortoisefuzz/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 os\n+import shutil\n+\n+from fuzzers import utils\n+from fuzzers.afl import fuzzer as afl_fuzzer\n+\n+\n+def build():\n+ \"\"\"Build benchmark.\"\"\"\n+ afl_fuzzer.prepare_build_environment()\n+ os.environ['CC'] = '/workdir/TortoiseFuzz/bb_metric/afl-clang-fast'\n+ os.environ['CXX'] = '/workdir/TortoiseFuzz/bb_metric/afl-clang-fast++'\n+ os.environ['FUZZER_LIB'] = '/libAFLDriver.a'\n+ utils.build_benchmark()\n+\n+ print('[post_build] Copying tortoise-fuzz to $OUT directory')\n+ # Copy out the afl-fuzz binary as a build artifact.\n+ shutil.copy('/workdir/TortoiseFuzz/bb_metric/afl-fuzz', os.environ['OUT'])\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run Tortoise-fuzz on target.\"\"\"\n+\n+ afl_fuzzer.prepare_fuzz_environment(input_corpus)\n+\n+ afl_fuzzer.run_afl_fuzz(input_corpus, output_corpus, target_binary, ['-s'])\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/tortoisefuzz/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-image\n" } ]
Python
Apache License 2.0
google/fuzzbench
Tortoise (#1366) * Integrating TortoiseFuzz * added newlines according to make format * Fix curl_curl_fuzzer_http Fixes: #1369 Related: #1366 * removed -j flag to utilize full parallelization Co-authored-by: Jonathan Metzman <[email protected]>
258,388
07.04.2022 15:28:58
14,400
594c69b04584e7d6ba7c497369542a7ffdebad4d
Fix arrow benchmark
[ { "change_type": "MODIFY", "old_path": "benchmarks/arrow_parquet-arrow-fuzz/Dockerfile", "new_path": "benchmarks/arrow_parquet-arrow-fuzz/Dockerfile", "diff": "@@ -30,4 +30,4 @@ RUN apt-get update -y -q && \\\nRUN git clone --depth=1 https://github.com/apache/arrow.git $SRC/arrow\n-COPY build.sh $SRC/\n+COPY build.sh thrift.patch $SRC/\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/arrow_parquet-arrow-fuzz/build.sh", "new_path": "benchmarks/arrow_parquet-arrow-fuzz/build.sh", "diff": "set -ex\n+# Fix thrift download.\n+# This needs to be done in build.sh because the checkout happens after the\n+# builder.Dockerfile completes.\n+cd $SRC/arrow\n+git apply ../thrift.patch || true\n+cd -\nARROW=${SRC}/arrow/cpp\ncd ${WORK}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "benchmarks/arrow_parquet-arrow-fuzz/thrift.patch", "diff": "+diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake\n+index 9c062f86a..5d04ef92c 100644\n+--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake\n++++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake\n+@@ -39,7 +39,7 @@ endif()\n+ # ----------------------------------------------------------------------\n+ # We should not use the Apache dist server for build dependencies\n+\n+-set(APACHE_MIRROR \"\")\n++set(APACHE_MIRROR \"https://archive.apache.org\")\n+\n+ macro(get_apache_mirror)\n+ if(APACHE_MIRROR STREQUAL \"\")\n+@@ -1129,7 +1129,7 @@ macro(build_thrift)\n+ get_apache_mirror()\n+ set(\n+ THRIFT_SOURCE_URL\n+- \"${APACHE_MIRROR}/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz\"\n++ \"${APACHE_MIRROR}/dist/thrift/${ARROW_THRIFT_BUILD_VERSION}/thrift-${ARROW_THRIFT_BUILD_VERSION}.tar.gz\"\n+ )\n+ endif()\n+\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix arrow benchmark (#1364)
258,388
12.04.2022 11:24:22
14,400
8d06cbfd526336e9f08c250fd9ae21fb26a987f5
Fix re2 dictionary Fixes:
[ { "change_type": "MODIFY", "old_path": "benchmarks/re2-2014-12-09/Dockerfile", "new_path": "benchmarks/re2-2014-12-09/Dockerfile", "diff": "@@ -25,6 +25,6 @@ RUN apt-get update && \\\nRUN git clone https://github.com/google/re2.git\n-RUN wget -qO $OUT/fuzz-target.dict \\\n+RUN wget -qO $OUT/fuzzer.dict \\\nhttps://raw.githubusercontent.com/google/fuzzing/master/dictionaries/regexp.dict\nCOPY build.sh target.cc $SRC/\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix re2 dictionary (#1378) Fixes: https://github.com/google/fuzzbench/issues/1377
258,388
19.04.2022 12:43:25
14,400
90e59b678c889111aebc893544cddcc59634b38b
Do main experiments
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-04-19\n+ description: \"Main coverage experiment\"\n+ type: code\n+ fuzzers:\n+ - honggfuzz\n+ - aflplusplus\n+ - eclipser\n+ - entropic\n+ - libfuzzer\n+ - aflsmart\n+ - lafintel\n+ - afl\n+ - mopt\n+ - aflfast\n+ - fairfuzz\n+\n+\n+- experiment: 2022-04-19-bug\n+ description: \"Main bug experiment\"\n+ type: bug\n+ fuzzers:\n+ - honggfuzz\n+ - aflplusplus\n+ - eclipser\n+ - entropic\n+ - libfuzzer\n+ - aflsmart\n+ - lafintel\n+ - afl\n+ - mopt\n+ - aflfast\n+ - fairfuzz\n+\n+\n- experiment: 2022-04-10-aflpp\ndescription: \"afl++ bug ranking\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
Do main experiments (#1387)
258,388
20.04.2022 09:49:17
14,400
43452996e71129d70f980d4bdb5d65bdc22e4ba3
[docs] Remove outdated sections. Fixes:
[ { "change_type": "MODIFY", "old_path": "docs/developing-fuzzbench/adding_a_new_benchmark.md", "new_path": "docs/developing-fuzzbench/adding_a_new_benchmark.md", "diff": "@@ -215,19 +215,9 @@ make build-$FUZZER_NAME-$BENCHMARK_NAME\n# This command will fuzz forever. Press Ctrl-C to stop it.\nmake run-$FUZZER_NAME-$BENCHMARK_NAME\n```\n-Finally, add your benchmark to the list of OSS-Fuzz benchmarks in\n-[test_fuzzer_benchmarks.py](https://github.com/google/fuzzbench/blob/master/.github/workflows/test_fuzzer_benchmarks.py)\n-\n-This ensures that CI tests your benchmark with all fuzzers.\n## Submitting the benchmark in a pull request\n-Add your benchmark to a list in\n-[build_and_test_run_fuzzer_benchmarks.py](https://github.com/google/fuzzbench/blob/master/.github/workflows/build_and_test_run_fuzzer_benchmarks.py)\n-so that it will be tested in CI. If your benchmark is a standard benchmark, add\n-it to the `STANDARD_BENCHMARKS` list, otherwise add it to the the\n-`OSS_FUZZ_BENCHMARKS` list.\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
[docs] Remove outdated sections. (#1388) Fixes: https://github.com/google/fuzzbench/issues/1386
258,388
20.04.2022 15:06:16
14,400
7cd47833e704b72c7136ce72bdc59eb5964b270b
blocklist dataflow fuzzers on benchmarks they fail on
[ { "change_type": "MODIFY", "old_path": "benchmarks/curl_curl_fuzzer_http/benchmark.yaml", "new_path": "benchmarks/curl_curl_fuzzer_http/benchmark.yaml", "diff": "@@ -18,3 +18,6 @@ fuzz_target: curl_fuzzer_http\nproject: curl\nunsupported_fuzzers:\n- klee\n+ - libfuzzer_dataflow\n+ - libfuzzer_dataflow_load\n+ - libfuzzer_dataflow_store\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/ffmpeg_ffmpeg_demuxer_fuzzer/benchmark.yaml", "new_path": "benchmarks/ffmpeg_ffmpeg_demuxer_fuzzer/benchmark.yaml", "diff": "@@ -40,3 +40,7 @@ unsupported_fuzzers:\n- afldd\n- aflpp_vs_dd\n- aflplusplus_gcc\n+ - libfuzzer_dataflow\n+ - libfuzzer_dataflow_load\n+ - libfuzzer_dataflow_store\n+ - libfuzzer_dataflow_pre\n" } ]
Python
Apache License 2.0
google/fuzzbench
blocklist dataflow fuzzers on benchmarks they fail on (#1390)
258,375
26.05.2022 23:26:30
-25,200
526b834db206e284082ffe477f67aa52c2a7eb7f
New option for custom seed corpus
[ { "change_type": "MODIFY", "old_path": "common/experiment_utils.py", "new_path": "common/experiment_utils.py", "diff": "@@ -72,6 +72,12 @@ def get_oss_fuzz_corpora_filestore_path():\nreturn posixpath.join(get_experiment_filestore_path(), 'oss_fuzz_corpora')\n+def get_custom_seed_corpora_filestore_path():\n+ \"\"\"Returns path containing the user-provided seed corpora.\"\"\"\n+ return posixpath.join(get_experiment_filestore_path(),\n+ 'custom_seed_corpora')\n+\n+\ndef get_dispatcher_instance_name(experiment: str) -> str:\n\"\"\"Returns a dispatcher instance name for an experiment.\"\"\"\nreturn 'd-%s' % experiment\n" }, { "change_type": "MODIFY", "old_path": "experiment/resources/runner-startup-script-template.sh", "new_path": "experiment/resources/runner-startup-script-template.sh", "diff": "@@ -46,6 +46,7 @@ docker run \\\n-e NO_SEEDS={{no_seeds}} \\\n-e NO_DICTIONARIES={{no_dictionaries}} \\\n-e OSS_FUZZ_CORPUS={{oss_fuzz_corpus}} \\\n+-e CUSTOM_SEED_CORPUS_DIR={{custom_seed_corpus_dir}} \\\n-e DOCKER_REGISTRY={{docker_registry}} {% if not local_experiment %}-e CLOUD_PROJECT={{cloud_project}} -e CLOUD_COMPUTE_ZONE={{cloud_compute_zone}} {% endif %}\\\n-e EXPERIMENT_FILESTORE={{experiment_filestore}} {% if local_experiment %}-v {{experiment_filestore}}:{{experiment_filestore}} {% endif %}\\\n-e REPORT_FILESTORE={{report_filestore}} {% if local_experiment %}-v {{report_filestore}}:{{report_filestore}} {% endif %}\\\n" }, { "change_type": "MODIFY", "old_path": "experiment/run_experiment.py", "new_path": "experiment/run_experiment.py", "diff": "@@ -148,6 +148,26 @@ def get_directories(parent_dir):\n]\n+# pylint: disable=too-many-locals\n+def validate_custom_seed_corpus(custom_seed_corpus_dir, benchmarks):\n+ \"\"\"Validate seed corpus provided by user\"\"\"\n+ if not os.path.isdir(custom_seed_corpus_dir):\n+ raise ValidationError('Corpus location \"%s\" is invalid.' %\n+ custom_seed_corpus_dir)\n+\n+ for benchmark in benchmarks:\n+ benchmark_corpus_dir = os.path.join(custom_seed_corpus_dir, benchmark)\n+ if not os.path.exists(benchmark_corpus_dir):\n+ raise ValidationError('Custom seed corpus directory for '\n+ 'benchmark \"%s\" does not exist.' % benchmark)\n+ if not os.path.isdir(benchmark_corpus_dir):\n+ raise ValidationError('Seed corpus of benchmark \"%s\" must be '\n+ 'a directory.' % benchmark)\n+ if not os.listdir(benchmark_corpus_dir):\n+ raise ValidationError('Seed corpus of benchmark \"%s\" is empty.' %\n+ benchmark)\n+\n+\ndef validate_benchmarks(benchmarks: List[str]):\n\"\"\"Parses and validates list of benchmarks.\"\"\"\nbenchmark_types = set()\n@@ -219,7 +239,8 @@ def start_experiment( # pylint: disable=too-many-arguments\nallow_uncommitted_changes=False,\nconcurrent_builds=None,\nmeasurers_cpus=None,\n- runners_cpus=None):\n+ runners_cpus=None,\n+ custom_seed_corpus_dir=None):\n\"\"\"Start a fuzzer benchmarking experiment.\"\"\"\nif not allow_uncommitted_changes:\ncheck_no_uncommitted_changes()\n@@ -248,6 +269,12 @@ def start_experiment( # pylint: disable=too-many-arguments\n# 12GB is just the amount that KLEE needs, use this default to make KLEE\n# experiments easier to run.\nconfig['runner_memory'] = config.get('runner_memory', '12GB')\n+\n+ config['custom_seed_corpus_dir'] = custom_seed_corpus_dir\n+ if config['custom_seed_corpus_dir']:\n+ validate_custom_seed_corpus(config['custom_seed_corpus_dir'],\n+ benchmarks)\n+\nreturn start_experiment_from_full_config(config)\n@@ -330,6 +357,16 @@ def copy_resources_to_bucket(config_dir: str, config: Dict):\nfor benchmark in config['benchmarks']:\nadd_oss_fuzz_corpus(benchmark, oss_fuzz_corpora_dir)\n+ if config['custom_seed_corpus_dir']:\n+ for benchmark in config['benchmarks']:\n+ benchmark_custom_corpus_dir = os.path.join(\n+ config['custom_seed_corpus_dir'], benchmark)\n+ filestore_utils.cp(\n+ benchmark_custom_corpus_dir,\n+ experiment_utils.get_custom_seed_corpora_filestore_path() + '/',\n+ recursive=True,\n+ parallel=True)\n+\nclass BaseDispatcher:\n\"\"\"Class representing the dispatcher.\"\"\"\n@@ -522,6 +559,10 @@ def main():\n'--runners-cpus',\nhelp='Cpus available to the runners.',\nrequired=False)\n+ parser.add_argument('-cs',\n+ '--custom-seed-corpus-dir',\n+ help='Path to the custom seed corpus',\n+ required=False)\nall_fuzzers = fuzzer_utils.get_fuzzer_names()\nparser.add_argument('-f',\n@@ -585,6 +626,14 @@ def main():\nparser.error('The sum of runners and measurers cpus is greater than the'\n' available cpu cores (%d)' % os.cpu_count())\n+ if args.custom_seed_corpus_dir:\n+ if args.no_seeds:\n+ parser.error('Cannot enable options \"custom_seed_corpus_dir\" and '\n+ '\"no_seeds\" at the same time')\n+ if args.oss_fuzz_corpus:\n+ parser.error('Cannot enable options \"custom_seed_corpus_dir\" and '\n+ '\"oss_fuzz_corpus\" at the same time')\n+\nstart_experiment(args.experiment_name,\nargs.experiment_config,\nargs.benchmarks,\n@@ -596,7 +645,8 @@ def main():\nallow_uncommitted_changes=args.allow_uncommitted_changes,\nconcurrent_builds=concurrent_builds,\nmeasurers_cpus=measurers_cpus,\n- runners_cpus=runners_cpus)\n+ runners_cpus=runners_cpus,\n+ custom_seed_corpus_dir=args.custom_seed_corpus_dir)\nreturn 0\n" }, { "change_type": "MODIFY", "old_path": "experiment/runner.py", "new_path": "experiment/runner.py", "diff": "@@ -115,6 +115,17 @@ def get_clusterfuzz_seed_corpus_path(fuzz_target_path):\nreturn seed_corpus_path if os.path.exists(seed_corpus_path) else None\n+def _copy_custom_seed_corpus(corpus_directory):\n+ \"Copy custom seed corpus provided by user\"\n+ shutil.rmtree(corpus_directory)\n+ benchmark = environment.get('BENCHMARK')\n+ benchmark_custom_corpus_dir = posixpath.join(\n+ experiment_utils.get_custom_seed_corpora_filestore_path(), benchmark)\n+ filestore_utils.cp(benchmark_custom_corpus_dir,\n+ corpus_directory,\n+ recursive=True)\n+\n+\ndef _unpack_clusterfuzz_seed_corpus(fuzz_target_path, corpus_directory):\n\"\"\"If a clusterfuzz seed corpus archive is available, unpack it into the\ncorpus directory if it exists. Copied from unpack_seed_corpus in\n@@ -172,6 +183,9 @@ def run_fuzzer(max_total_time, log_filename):\nlogs.error('Fuzz target binary not found.')\nreturn\n+ if environment.get('CUSTOM_SEED_CORPUS_DIR'):\n+ _copy_custom_seed_corpus(input_corpus)\n+ else:\n_unpack_clusterfuzz_seed_corpus(target_binary, input_corpus)\n_clean_seed_corpus(input_corpus)\n" }, { "change_type": "MODIFY", "old_path": "experiment/scheduler.py", "new_path": "experiment/scheduler.py", "diff": "@@ -719,6 +719,7 @@ def render_startup_script_template( # pylint: disable=too-many-arguments\n'oss_fuzz_corpus': experiment_config['oss_fuzz_corpus'],\n'num_cpu_cores': experiment_config['runner_num_cpu_cores'],\n'cpuset': cpuset,\n+ 'custom_seed_corpus_dir': experiment_config['custom_seed_corpus_dir'],\n}\nif not local_experiment:\n" }, { "change_type": "MODIFY", "old_path": "experiment/test_data/experiment-config.yaml", "new_path": "experiment/test_data/experiment-config.yaml", "diff": "@@ -31,6 +31,7 @@ git_hash: \"git-hash\"\nno_seeds: false\nno_dictionaries: false\noss_fuzz_corpus: false\n+custom_seed_corpus_dir: null\ndescription: \"Test experiment\"\nconcurrent_builds: null\nrunners_cpus: null\n" }, { "change_type": "MODIFY", "old_path": "experiment/test_run_experiment.py", "new_path": "experiment/test_run_experiment.py", "diff": "@@ -202,6 +202,7 @@ def test_copy_resources_to_bucket(tmp_path):\n'experiment': 'experiment',\n'benchmarks': ['libxslt_xpath'],\n'oss_fuzz_corpus': True,\n+ 'custom_seed_corpus_dir': None,\n}\ntry:\nwith mock.patch('common.filestore_utils.cp') as mocked_filestore_cp:\n" }, { "change_type": "MODIFY", "old_path": "experiment/test_scheduler.py", "new_path": "experiment/test_scheduler.py", "diff": "@@ -118,6 +118,7 @@ docker run \\\\\n-e NO_SEEDS=False \\\\\n-e NO_DICTIONARIES=False \\\\\n-e OSS_FUZZ_CORPUS=False \\\\\n+-e CUSTOM_SEED_CORPUS_DIR=None \\\\\n-e DOCKER_REGISTRY=gcr.io/fuzzbench -e CLOUD_PROJECT=fuzzbench -e CLOUD_COMPUTE_ZONE=us-central1-a \\\\\n-e EXPERIMENT_FILESTORE=gs://experiment-data \\\\\n-e REPORT_FILESTORE=gs://web-reports \\\\\n" } ]
Python
Apache License 2.0
google/fuzzbench
New option for custom seed corpus (#1395)
258,375
07.06.2022 21:39:37
-25,200
5408256b0fb01e8a4791a90f2d60d0e38b4ed30c
parameterize snapshot period
[ { "change_type": "MODIFY", "old_path": "experiment/run_experiment.py", "new_path": "experiment/run_experiment.py", "diff": "@@ -77,6 +77,8 @@ def read_and_validate_experiment_config(config_filename: str) -> Dict:\nbool_params = {'private', 'merge_with_nonprivate'}\nlocal_experiment = config.get('local_experiment', False)\n+ snapshot_period = config.get('snapshot_period',\n+ experiment_utils.DEFAULT_SNAPSHOT_SECONDS)\nif not local_experiment:\nrequired_params = required_params.union(cloud_config)\n@@ -133,6 +135,7 @@ def read_and_validate_experiment_config(config_filename: str) -> Dict:\nraise ValidationError('Config: %s is invalid.' % config_filename)\nconfig['local_experiment'] = local_experiment\n+ config['snapshot_period'] = snapshot_period\nreturn config\n@@ -416,6 +419,8 @@ class LocalDispatcher(BaseDispatcher):\nset_report_filestore_arg = (\n'REPORT_FILESTORE={report_filestore}'.format(\nreport_filestore=self.config['report_filestore']))\n+ set_snapshot_period_arg = 'SNAPSHOT_PERIOD={snapshot_period}'.format(\n+ snapshot_period=self.config['snapshot_period'])\ndocker_image_url = '{docker_registry}/dispatcher-image'.format(\ndocker_registry=docker_registry)\ncommand = [\n@@ -438,6 +443,8 @@ class LocalDispatcher(BaseDispatcher):\n'-e',\nset_experiment_filestore_arg,\n'-e',\n+ set_snapshot_period_arg,\n+ '-e',\nset_report_filestore_arg,\n'-e',\nset_docker_registry_arg,\n" } ]
Python
Apache License 2.0
google/fuzzbench
parameterize snapshot period (#1405)
258,388
08.06.2022 09:38:48
14,400
39141786018f727686100a84bc0772649a665d02
Fix failing integration test for measuring coverage Test now fails because we default to branch coverage.
[ { "change_type": "MODIFY", "old_path": "experiment/measurer/test_data/llvm_tools/llvm-cov", "new_path": "experiment/measurer/test_data/llvm_tools/llvm-cov", "diff": "Binary files a/experiment/measurer/test_data/llvm_tools/llvm-cov and b/experiment/measurer/test_data/llvm_tools/llvm-cov differ\n" }, { "change_type": "MODIFY", "old_path": "experiment/measurer/test_data/llvm_tools/llvm-profdata", "new_path": "experiment/measurer/test_data/llvm_tools/llvm-profdata", "diff": "Binary files a/experiment/measurer/test_data/llvm_tools/llvm-profdata and b/experiment/measurer/test_data/llvm_tools/llvm-profdata differ\n" }, { "change_type": "MODIFY", "old_path": "experiment/measurer/test_data/test_measure_snapshot_coverage/freetype2-2017-coverage", "new_path": "experiment/measurer/test_data/test_measure_snapshot_coverage/freetype2-2017-coverage", "diff": "Binary files a/experiment/measurer/test_data/test_measure_snapshot_coverage/freetype2-2017-coverage and b/experiment/measurer/test_data/test_measure_snapshot_coverage/freetype2-2017-coverage differ\n" }, { "change_type": "MODIFY", "old_path": "experiment/measurer/test_measure_manager.py", "new_path": "experiment/measurer/test_measure_manager.py", "diff": "@@ -378,7 +378,7 @@ class TestIntegrationMeasurement:\n# fakefs. A directory containing necessary llvm tools is also added to\n# PATH.\nllvm_tools_path = get_test_data_path('llvm_tools')\n- os.environ[\"PATH\"] += os.pathsep + llvm_tools_path\n+ os.environ['PATH'] += os.pathsep + llvm_tools_path\nos.environ['WORK'] = str(tmp_path)\nmocked_is_cycle_unchanged.return_value = False\n# Set up the coverage binary.\n@@ -423,7 +423,7 @@ class TestIntegrationMeasurement:\nsnapshot_measurer.trial_num, cycle, False)\nassert snapshot\nassert snapshot.time == cycle * experiment_utils.get_snapshot_seconds()\n- assert snapshot.edges_covered == 13178\n+ assert snapshot.edges_covered == 4629\[email protected]('archive_name',\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix failing integration test for measuring coverage (#1408) Test now fails because we default to branch coverage.
258,388
08.06.2022 12:41:08
14,400
889718617d09ff81540a5d73abce74223861851c
Redo failed experiment 2022-06-01-dissecting
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-06-08-dissecting\n+ description: \"Dissecting AFL paper (scheduling)\"\n+ type: bug\n+ fuzzers:\n+ - afl\n+ - afl_scheduling_lifo\n+ - afl_scheduling_random\n+\n- experiment: 2022-06-01-dissecting\ndescription: \"Dissecting AFL paper (scheduling)\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
Redo failed experiment 2022-06-01-dissecting (#1411)
258,388
08.06.2022 19:39:17
14,400
4a43f727bf97f901680452797d06d2bbaf4d367a
Handle RemoteDisconnected in is_local check. Fixes
[ { "change_type": "MODIFY", "old_path": "common/utils.py", "new_path": "common/utils.py", "diff": "\"\"\"Common utilities.\"\"\"\nimport hashlib\n+import http.client\nimport os\nimport urllib.request\nimport urllib.error\n@@ -50,6 +51,8 @@ def is_local():\n_is_local = False\nexcept urllib.error.URLError:\n_is_local = True\n+ except http.client.RemoteDisconnected:\n+ _is_local = True\nreturn _is_local\n" } ]
Python
Apache License 2.0
google/fuzzbench
Handle RemoteDisconnected in is_local check. (#1409) Fixes https://github.com/google/fuzzbench/issues/1401
258,402
13.07.2022 09:51:20
-36,000
e29f74ea46dfe5a83c3e0feebe9835608e4ac6a5
Fix a bug in libfuzzer_dataflow (should have pushed this a long time ago) Update patch because of [this commit](https://github.com/Alan32Liu/llvm-llvm-project/commit/9141d410f2b16964967702b07cf83ae63a73148a).
[ { "change_type": "MODIFY", "old_path": "fuzzers/libfuzzer_dataflow/Trace-store-and-load-commands.patch", "new_path": "fuzzers/libfuzzer_dataflow/Trace-store-and-load-commands.patch", "diff": "-From e7b02154a90480ed6bca8ba7203c70e7b5a27203 Mon Sep 17 00:00:00 2001\n-From: Alan32Liu <[email protected]>\n-Date: Wed, 23 Feb 2022 15:55:17 +1100\n-Subject: [PATCH 1/3] Trace store and load commands\n-\n-Signed-off-by: Alan32Liu <[email protected]>\n----\n- compiler-rt/lib/fuzzer/FuzzerMain.cpp | 2 +\n- compiler-rt/lib/fuzzer/FuzzerTracePC.cpp | 108 +++++++++++++++++++++++\n- compiler-rt/lib/fuzzer/FuzzerTracePC.h | 15 ++++\n- 3 files changed, 125 insertions(+)\n+diff --git a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp\n+index 6b007f2ad45c..23299e36b5e8 100644\n+--- a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp\n++++ b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp\n+@@ -640,6 +640,7 @@ ReadCorpora(const std::vector<std::string> &CorpusDirs,\n+ }\n+ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {\n++ fuzzer::TPC.InitializeMainObjectInformation();\n+ using namespace fuzzer;\n+ assert(argc && argv && \"Argument pointers cannot be nullptr\");\n+ std::string Argv0((*argv)[0]);\ndiff --git a/compiler-rt/lib/fuzzer/FuzzerMain.cpp b/compiler-rt/lib/fuzzer/FuzzerMain.cpp\n-index 75f2f8e75c9b..761bb82ff602 100644\n+index 75f2f8e75c9b..120923992f9f 100644\n--- a/compiler-rt/lib/fuzzer/FuzzerMain.cpp\n+++ b/compiler-rt/lib/fuzzer/FuzzerMain.cpp\n@@ -22,15 +22,8 @@ index 75f2f8e75c9b..761bb82ff602 100644\nextern \"C\" {\n// This function should be defined by the user.\n-@@ -17,5 +18,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);\n- } // extern \"C\"\n-\n- ATTRIBUTE_INTERFACE int main(int argc, char **argv) {\n-+ fuzzer::TPC.InitializeMainObjectInformation();\n- return fuzzer::FuzzerDriver(&argc, &argv, LLVMFuzzerTestOneInput);\n- }\ndiff --git a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp\n-index f12f7aa61bc4..be01bc0c6510 100644\n+index f12f7aa61bc4..c45178254383 100644\n--- a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp\n+++ b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp\n@@ -48,23 +41,21 @@ index f12f7aa61bc4..be01bc0c6510 100644\nnamespace fuzzer {\nTracePC TPC;\n-@@ -392,6 +400,15 @@ void TracePC::HandleCmp(uintptr_t PC, T Arg1, T Arg2) {\n+@@ -392,6 +400,13 @@ void TracePC::HandleCmp(uintptr_t PC, T Arg1, T Arg2) {\nValueProfileMap.AddValue(PC * 128 + 64 + AbsoluteDistance);\n}\n+ATTRIBUTE_TARGET_POPCNT ALWAYS_INLINE\n+ATTRIBUTE_NO_SANITIZE_ALL\n+void TracePC::HandleDf(uintptr_t PC, uintptr_t Addr, uintptr_t MaxPC) {\n-+//fuzzer::Printf(\"[HandleDf] Instrumented : %lu\\n\", Addr);\n+ uintptr_t feature = PC * MaxPC + Addr;\n-+// fuzzer::Printf(\"[HandleDf] Feature value: %lu\\n\", feature);\n+ DataFlowMap.AddValue(feature);\n+}\n+\nATTRIBUTE_NO_SANITIZE_MEMORY\nstatic size_t InternalStrnlen(const char *S, size_t MaxLen) {\nsize_t Len = 0;\n-@@ -616,6 +633,64 @@ void __sanitizer_cov_trace_gep(uintptr_t Idx) {\n+@@ -616,6 +631,48 @@ void __sanitizer_cov_trace_gep(uintptr_t Idx) {\nfuzzer::TPC.HandleCmp(PC, Idx, (uintptr_t)0);\n}\n@@ -77,14 +68,6 @@ index f12f7aa61bc4..be01bc0c6510 100644\n+\n+ uintptr_t PCOffset = PC - main_object_start_address;\n+ uintptr_t LoadOffset = LoadAddr - main_object_start_address;\n-+//\n-+// fuzzer::Printf(\"[TraceLoad] PC : %lu\\n\", PCOffset);\n-+// fuzzer::Printf(\"[TraceLoad] LoadAddr : %lu\\n\", LoadAddr);\n-+// fuzzer::Printf(\"[TraceLoad] main_object_start_address: %lu\\n\",\n-+// main_object_start_address);\n-+// fuzzer::Printf(\"[TraceLoad] PCOffset : %lu\\n\", PCOffset);\n-+// fuzzer::Printf(\"[TraceLoad] LoadOffset : %lu\\n\", LoadOffset);\n-+// fuzzer::Printf(\"[TraceLoad] main_object_size : %lu\\n\", main_object_size);\n+\n+ if (PCOffset >= main_object_size) return;\n+ if (LoadOffset >= main_object_size) return;\n@@ -105,14 +88,6 @@ index f12f7aa61bc4..be01bc0c6510 100644\n+ uintptr_t StoreAddr = reinterpret_cast<uintptr_t>(Addr);\n+ uintptr_t PCOffset = PC - main_object_start_address;\n+ uintptr_t StoreOffset = StoreAddr - main_object_start_address;\n-+//\n-+// fuzzer::Printf(\"[TraceStore] PC : %lu\\n\", PCOffset);\n-+// fuzzer::Printf(\"[TraceStore] StoreAddr : %lu\\n\", StoreAddr);\n-+// fuzzer::Printf(\"[TraceStore] main_object_start_address: %lu\\n\",\n-+// main_object_start_address);\n-+// fuzzer::Printf(\"[TraceStore] PCOffset : %lu\\n\", PCOffset);\n-+// fuzzer::Printf(\"[TraceStore] StoreOffset : %lu\\n\", StoreOffset);\n-+// fuzzer::Printf(\"[TraceStore] main_object_size : %lu\\n\", main_object_size);\n+\n+ if (PCOffset >= main_object_size) return;\n+ if (StoreOffset >= main_object_size) return;\n@@ -129,7 +104,7 @@ index f12f7aa61bc4..be01bc0c6510 100644\nATTRIBUTE_INTERFACE ATTRIBUTE_NO_SANITIZE_MEMORY\nvoid __sanitizer_weak_hook_memcmp(void *caller_pc, const void *s1,\nconst void *s2, size_t n, int result) {\n-@@ -682,4 +757,37 @@ void __sanitizer_weak_hook_memmem(void *called_pc, const void *s1, size_t len1,\n+@@ -682,4 +739,22 @@ void __sanitizer_weak_hook_memmem(void *called_pc, const void *s1, size_t len1,\nif (!fuzzer::RunningUserCallback) return;\nfuzzer::TPC.MMT.Add(reinterpret_cast<const uint8_t *>(s2), len2);\n}\n@@ -139,27 +114,12 @@ index f12f7aa61bc4..be01bc0c6510 100644\n+// The code assumes that the main binary is the the first one to be iterated on.\n+int dl_iterate_phdr_callback(struct dl_phdr_info *info, size_t size,\n+ void *data) {\n-+// PrintErrorAndExitIf(main_object_start_address != kInvalidStartAddress,\n-+// \"main_object_start_address is already set\");\n-+// fuzzer::Printf(\"[INIT] main_object_start_address: %lu\\n\", main_object_start_address);\n-+// fuzzer::Printf(\"[INIT] main_object_size : %lu\\n\", main_object_size);\n+ main_object_start_address = info->dlpi_addr;\n-+// fuzzer::Printf(\"[UPDT] main_object_start_address: %lu\\n\", main_object_start_address);\n+ for (int j = 0; j < info->dlpi_phnum; j++) {\n+ uintptr_t end_offset =\n+ info->dlpi_phdr[j].p_vaddr + info->dlpi_phdr[j].p_memsz;\n+ if (main_object_size < end_offset) main_object_size = end_offset;\n-+// fuzzer::Printf(\"[UPDT] main_object_size : %lu\\n\", main_object_size);\n+ }\n-+// fuzzer::Printf(\"[FINL] main_object_start_address: %lu\\n\", main_object_start_address);\n-+// fuzzer::Printf(\"[FINL] main_object_size : %lu\\n\", main_object_size);\n-+// uintptr_t some_code_address =\n-+// reinterpret_cast<uintptr_t>(&dl_iterate_phdr_callback);\n-+// PrintErrorAndExitIf(main_object_start_address > some_code_address,\n-+// \"main_object_start_address is above the code\");\n-+// PrintErrorAndExitIf(\n-+// main_object_start_address + main_object_size < some_code_address,\n-+// \"main_object_start_address + main_object_size is below the code\");\n+ return 1; // we need only the first header, so return 1.\n+}\n+\n@@ -168,7 +128,7 @@ index f12f7aa61bc4..be01bc0c6510 100644\n+}\n} // extern \"C\"\ndiff --git a/compiler-rt/lib/fuzzer/FuzzerTracePC.h b/compiler-rt/lib/fuzzer/FuzzerTracePC.h\n-index af1f9d81e950..d9e82f1a92b3 100644\n+index af1f9d81e950..ac0976276bdf 100644\n--- a/compiler-rt/lib/fuzzer/FuzzerTracePC.h\n+++ b/compiler-rt/lib/fuzzer/FuzzerTracePC.h\n@@ -212,160 +172,16 @@ index af1f9d81e950..d9e82f1a92b3 100644\nuintptr_t InitialStack;\n};\n-@@ -288,6 +294,15 @@ TracePC::CollectFeatures(Callback HandleFeature) const {\n+@@ -288,6 +294,12 @@ TracePC::CollectFeatures(Callback HandleFeature) const {\nFirstFeature += StackDepthStepFunction(std::numeric_limits<size_t>::max());\n}\n+ // Data Flow feature\n-+ //TODO: Need a flag for using DataFlowMap?\n-+ if (UseValueProfileMask) {\n+ DataFlowMap.ForEach([&](size_t Idx) {\n+ HandleFeature(static_cast<uint32_t>(FirstFeature + Idx));\n+ });\n+ FirstFeature += DataFlowMap.SizeInBits();\n-+ }\n+\nreturn FirstFeature;\n}\n---\n-2.35.1.894.gb6a874cedc-goog\n-\n-\n-From 009c87895b13021fdcb0e28a57324621faa1a07d Mon Sep 17 00:00:00 2001\n-From: Alan32Liu <[email protected]>\n-Date: Wed, 23 Mar 2022 08:18:03 +1100\n-Subject: [PATCH 2/3] Remove debug prints\n-\n-Signed-off-by: Alan32Liu <[email protected]>\n----\n- compiler-rt/lib/fuzzer/FuzzerTracePC.cpp | 33 ------------------------\n- compiler-rt/lib/fuzzer/FuzzerTracePC.h | 1 -\n- 2 files changed, 34 deletions(-)\n-\n-diff --git a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp\n-index be01bc0c6510..c45178254383 100644\n---- a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp\n-+++ b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp\n-@@ -403,9 +403,7 @@ void TracePC::HandleCmp(uintptr_t PC, T Arg1, T Arg2) {\n- ATTRIBUTE_TARGET_POPCNT ALWAYS_INLINE\n- ATTRIBUTE_NO_SANITIZE_ALL\n- void TracePC::HandleDf(uintptr_t PC, uintptr_t Addr, uintptr_t MaxPC) {\n--//fuzzer::Printf(\"[HandleDf] Instrumented : %lu\\n\", Addr);\n- uintptr_t feature = PC * MaxPC + Addr;\n--// fuzzer::Printf(\"[HandleDf] Feature value: %lu\\n\", feature);\n- DataFlowMap.AddValue(feature);\n- }\n-\n-@@ -642,14 +640,6 @@ void TraceLoad(void *Addr) {\n-\n- uintptr_t PCOffset = PC - main_object_start_address;\n- uintptr_t LoadOffset = LoadAddr - main_object_start_address;\n--//\n--// fuzzer::Printf(\"[TraceLoad] PC : %lu\\n\", PCOffset);\n--// fuzzer::Printf(\"[TraceLoad] LoadAddr : %lu\\n\", LoadAddr);\n--// fuzzer::Printf(\"[TraceLoad] main_object_start_address: %lu\\n\",\n--// main_object_start_address);\n--// fuzzer::Printf(\"[TraceLoad] PCOffset : %lu\\n\", PCOffset);\n--// fuzzer::Printf(\"[TraceLoad] LoadOffset : %lu\\n\", LoadOffset);\n--// fuzzer::Printf(\"[TraceLoad] main_object_size : %lu\\n\", main_object_size);\n-\n- if (PCOffset >= main_object_size) return;\n- if (LoadOffset >= main_object_size) return;\n-@@ -670,14 +660,6 @@ void TraceStore(void *Addr) {\n- uintptr_t StoreAddr = reinterpret_cast<uintptr_t>(Addr);\n- uintptr_t PCOffset = PC - main_object_start_address;\n- uintptr_t StoreOffset = StoreAddr - main_object_start_address;\n--//\n--// fuzzer::Printf(\"[TraceStore] PC : %lu\\n\", PCOffset);\n--// fuzzer::Printf(\"[TraceStore] StoreAddr : %lu\\n\", StoreAddr);\n--// fuzzer::Printf(\"[TraceStore] main_object_start_address: %lu\\n\",\n--// main_object_start_address);\n--// fuzzer::Printf(\"[TraceStore] PCOffset : %lu\\n\", PCOffset);\n--// fuzzer::Printf(\"[TraceStore] StoreOffset : %lu\\n\", StoreOffset);\n--// fuzzer::Printf(\"[TraceStore] main_object_size : %lu\\n\", main_object_size);\n-\n- if (PCOffset >= main_object_size) return;\n- if (StoreOffset >= main_object_size) return;\n-@@ -763,27 +745,12 @@ void __sanitizer_weak_hook_memmem(void *called_pc, const void *s1, size_t len1,\n- // The code assumes that the main binary is the the first one to be iterated on.\n- int dl_iterate_phdr_callback(struct dl_phdr_info *info, size_t size,\n- void *data) {\n--// PrintErrorAndExitIf(main_object_start_address != kInvalidStartAddress,\n--// \"main_object_start_address is already set\");\n--// fuzzer::Printf(\"[INIT] main_object_start_address: %lu\\n\", main_object_start_address);\n--// fuzzer::Printf(\"[INIT] main_object_size : %lu\\n\", main_object_size);\n- main_object_start_address = info->dlpi_addr;\n--// fuzzer::Printf(\"[UPDT] main_object_start_address: %lu\\n\", main_object_start_address);\n- for (int j = 0; j < info->dlpi_phnum; j++) {\n- uintptr_t end_offset =\n- info->dlpi_phdr[j].p_vaddr + info->dlpi_phdr[j].p_memsz;\n- if (main_object_size < end_offset) main_object_size = end_offset;\n--// fuzzer::Printf(\"[UPDT] main_object_size : %lu\\n\", main_object_size);\n- }\n--// fuzzer::Printf(\"[FINL] main_object_start_address: %lu\\n\", main_object_start_address);\n--// fuzzer::Printf(\"[FINL] main_object_size : %lu\\n\", main_object_size);\n--// uintptr_t some_code_address =\n--// reinterpret_cast<uintptr_t>(&dl_iterate_phdr_callback);\n--// PrintErrorAndExitIf(main_object_start_address > some_code_address,\n--// \"main_object_start_address is above the code\");\n--// PrintErrorAndExitIf(\n--// main_object_start_address + main_object_size < some_code_address,\n--// \"main_object_start_address + main_object_size is below the code\");\n- return 1; // we need only the first header, so return 1.\n- }\n-\n-diff --git a/compiler-rt/lib/fuzzer/FuzzerTracePC.h b/compiler-rt/lib/fuzzer/FuzzerTracePC.h\n-index d9e82f1a92b3..67eab7425097 100644\n---- a/compiler-rt/lib/fuzzer/FuzzerTracePC.h\n-+++ b/compiler-rt/lib/fuzzer/FuzzerTracePC.h\n-@@ -295,7 +295,6 @@ TracePC::CollectFeatures(Callback HandleFeature) const {\n- }\n-\n- // Data Flow feature\n-- //TODO: Need a flag for using DataFlowMap?\n- if (UseValueProfileMask) {\n- DataFlowMap.ForEach([&](size_t Idx) {\n- HandleFeature(static_cast<uint32_t>(FirstFeature + Idx));\n---\n-2.35.1.894.gb6a874cedc-goog\n-\n-\n-From a5e8d90b5054270936a197797924795fadfef9f5 Mon Sep 17 00:00:00 2001\n-From: Alan32Liu <[email protected]>\n-Date: Thu, 24 Mar 2022 16:29:12 +1100\n-Subject: [PATCH 3/3] Move Initialisation to DuzzerDriver to make it more\n- generalise\n-\n-Signed-off-by: Alan32Liu <[email protected]>\n----\n- compiler-rt/lib/fuzzer/FuzzerDriver.cpp | 1 +\n- compiler-rt/lib/fuzzer/FuzzerMain.cpp | 1 -\n- 2 files changed, 1 insertion(+), 1 deletion(-)\n-\n-diff --git a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp\n-index 6b007f2ad45c..23299e36b5e8 100644\n---- a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp\n-+++ b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp\n-@@ -640,6 +640,7 @@ ReadCorpora(const std::vector<std::string> &CorpusDirs,\n- }\n-\n- int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {\n-+ fuzzer::TPC.InitializeMainObjectInformation();\n- using namespace fuzzer;\n- assert(argc && argv && \"Argument pointers cannot be nullptr\");\n- std::string Argv0((*argv)[0]);\n-diff --git a/compiler-rt/lib/fuzzer/FuzzerMain.cpp b/compiler-rt/lib/fuzzer/FuzzerMain.cpp\n-index 761bb82ff602..120923992f9f 100644\n---- a/compiler-rt/lib/fuzzer/FuzzerMain.cpp\n-+++ b/compiler-rt/lib/fuzzer/FuzzerMain.cpp\n-@@ -18,6 +18,5 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);\n- } // extern \"C\"\n-\n- ATTRIBUTE_INTERFACE int main(int argc, char **argv) {\n-- fuzzer::TPC.InitializeMainObjectInformation();\n- return fuzzer::FuzzerDriver(&argc, &argv, LLVMFuzzerTestOneInput);\n- }\n---\n-2.35.1.894.gb6a874cedc-goog\n-\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix a bug in libfuzzer_dataflow (should have pushed this a long time ago) (#1422) Update patch because of [this commit](https://github.com/Alan32Liu/llvm-llvm-project/commit/9141d410f2b16964967702b07cf83ae63a73148a).
258,402
14.07.2022 07:20:28
-36,000
494fc08da31c84435a9e4238fa3efead3b7b60c8
Update ca-certificates Fix the *server certificate verification failed* error in `honggfuzz_qemu`.
[ { "change_type": "MODIFY", "old_path": "fuzzers/honggfuzz_qemu/builder.Dockerfile", "new_path": "fuzzers/honggfuzz_qemu/builder.Dockerfile", "diff": "@@ -17,6 +17,7 @@ FROM $parent_image\n# Honggfuzz requires libbfd and libunwid.\nRUN apt-get update -y && \\\n+ apt-get upgrade -y ca-certificates && \\\napt-get install -y \\\nlibbfd-dev \\\nlibunwind-dev \\\n" } ]
Python
Apache License 2.0
google/fuzzbench
Update ca-certificates (#1424) Fix the *server certificate verification failed* error in `honggfuzz_qemu`.
258,388
20.07.2022 10:54:10
14,400
faa55785a8c06330c5f11e92d37edc90f90cb16b
Redo 2022-07-13
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-07-20-aflpp\n+ description: \"afl++ libafl tests. Redo 07-13.\"\n+ fuzzers:\n+ - aflplusplus_libafl\n+ - libafl_aflpp\n+ - libafl\n+ - aflplusplus\n+ - aflplusplus_optimal\n+ - honggfuzz\n+ - entropic\n+\n- experiment: 2022-07-13-aflpp\ndescription: \"afl++ libafl tests\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Redo 2022-07-13 (#1430)
258,388
22.07.2022 12:09:23
14,400
e920ef4e52feaecd29806ec064c63ad832a87200
Fix ffmpeg build failure by not specifying depth Fixes
[ { "change_type": "MODIFY", "old_path": "benchmarks/ffmpeg_ffmpeg_demuxer_fuzzer/Dockerfile", "new_path": "benchmarks/ffmpeg_ffmpeg_demuxer_fuzzer/Dockerfile", "diff": "@@ -30,8 +30,10 @@ RUN git clone -n https://gitlab.freedesktop.org/mesa/drm.git\nRUN cd drm; git checkout 5db0f7692d1fdf05f9f6c0c02ffa5a5f4379c1f3\nRUN git clone --depth 1 https://github.com/mstorsjo/fdk-aac.git\nADD https://sourceforge.net/projects/lame/files/latest/download lame.tar.gz\n-RUN git clone --depth 2 git://anongit.freedesktop.org/xorg/lib/libXext\n-RUN (cd /src/libXext; git checkout d965a1a8ce9331d2aaf1c697a29455ad55171b36)\n+RUN git clone git://anongit.freedesktop.org/xorg/lib/libXext && \\\n+ cd /src/libXext && \\\n+ git checkout d965a1a8ce9331d2aaf1c697a29455ad55171b36\n+\nRUN git clone -n git://anongit.freedesktop.org/git/xorg/lib/libXfixes\nRUN cd libXfixes; git checkout 174a94975af710247719310cfc53bd13e1f3b44d\nRUN git clone --depth 1 https://github.com/intel/libva\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix ffmpeg build failure by not specifying depth (#1435) Fixes #1434
258,388
22.07.2022 14:48:17
14,400
d45decbae6a56f649337476cebb90fd0d7824f65
[centipede] Fix compilation flags * [centipede] Fix compilation flags Add compiler flags to instrument edges and comparisions. Also do centipede experiment. * Dont do bug experiment * more missing flags
[ { "change_type": "MODIFY", "old_path": "fuzzers/centipede/fuzzer.py", "new_path": "fuzzers/centipede/fuzzer.py", "diff": "@@ -23,10 +23,12 @@ def build():\n\"\"\"Build benchmark.\"\"\"\n# TODO(Dongge): Build targets with sanitizers.\ncflags = [\n+ '-fno-builtin',\n+ '-gline-tables-only',\n'-ldl',\n'-lrt',\n'-lpthread',\n- '-fsanitize-coverage=trace-loads',\n+ '-fsanitize-coverage=trace-loads,trace-pc-guard,trace-cmp,pc-table',\n]\nutils.append_flags('CFLAGS', cflags)\nutils.append_flags('CXXFLAGS', cflags)\n" }, { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-07-22-centipede\n+ description: \"Test AFL with a new splicing as mutation\"\n+ fuzzers:\n+ - honggfuzz\n+ - aflplusplus\n+ - eclipser\n+ - entropic\n+ - libfuzzer\n+ - lafintel\n+ - afl\n+ - mopt\n+ - fairfuzz\n+ - libfuzzer_dataflow\n+ - centipede\n+\n- experiment: 2022-07-21-afl-new-splicing\ndescription: \"Test AFL with a new splicing as mutation\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
[centipede] Fix compilation flags (#1437) * [centipede] Fix compilation flags Add compiler flags to instrument edges and comparisions. Also do centipede experiment. * Dont do bug experiment * more missing flags
258,388
03.08.2022 10:34:19
25,200
d914f24a07c1fc866894fece5b93f4a8b5f00023
Update checkout_commit.py
[ { "change_type": "MODIFY", "old_path": "docker/benchmark-builder/checkout_commit.py", "new_path": "docker/benchmark-builder/checkout_commit.py", "diff": "@@ -78,7 +78,7 @@ def checkout_repo_commit(commit, repo_dir):\ndef main():\n\"\"\"Check out an OSS-Fuzz project repo.\"\"\"\nif len(sys.argv) != 3:\n- print(\"Usage: %s <commit> <src_dir>\" % sys.argv[0])\n+ print('Usage: {sys.argv[0] <commit> <src_dir>' % sys.argv[0])\nreturn 1\ncommit = sys.argv[1]\n@@ -100,9 +100,9 @@ def main():\ncontinue\nif checkout_success:\nreturn 0\n- print(\"Checkout unsuccessful.\")\n+ print('Checkout unsuccessful.')\nreturn 1\nif __name__ == '__main__':\n- main()\n+ sys.exit(main())\n" } ]
Python
Apache License 2.0
google/fuzzbench
Update checkout_commit.py
258,388
05.08.2022 14:09:55
14,400
bb837a37813095558d8a29f31a0342a9cb4a3e2a
Update experiment-requests.yaml I broke some things yesterday
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# 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#\n+- experiment: 2022-08-04-afl-new-splicing\n+ description: \"Test AFL with a new splicing as mutation\"\n+ type: bug\n+ fuzzers:\n+ - afl\n+ - afl_splicing_mutation\n+\n- experiment: 2022-08-03-afl-new-splicing\ndescription: \"Test AFL with a new splicing as mutation\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
Update experiment-requests.yaml @andreafioraldi I broke some things yesterday
258,403
08.08.2022 13:54:07
25,200
0d01b2921a337c00f3c0d0da6843a8f25788d8c2
Removing unused files and old flags.
[ { "change_type": "MODIFY", "old_path": "fuzzers/libfuzzer/fuzzer.py", "new_path": "fuzzers/libfuzzer/fuzzer.py", "diff": "@@ -38,10 +38,7 @@ def build():\ndef fuzz(input_corpus, output_corpus, target_binary):\n\"\"\"Run fuzzer. Wrapper that uses the defaults when calling\nrun_fuzzer.\"\"\"\n- run_fuzzer(input_corpus,\n- output_corpus,\n- target_binary,\n- extra_flags=['-keep_seed=1', '-cross_over_uniform_dist=1'])\n+ run_fuzzer(input_corpus, output_corpus, target_binary)\ndef run_fuzzer(input_corpus, output_corpus, target_binary, extra_flags=None):\n" }, { "change_type": "DELETE", "old_path": "fuzzers/libfuzzer/fuzzer.yaml", "new_path": null, "diff": "-languages:\n- - go\n- - c++\n" }, { "change_type": "DELETE", "old_path": "fuzzers/libfuzzer/patch.diff", "new_path": null, "diff": "-diff --git a/compiler-rt/lib/fuzzer/FuzzerFork.cpp b/compiler-rt/lib/fuzzer/FuzzerFork.cpp\n-index 84725d2..4e1a506 100644\n---- a/compiler-rt/lib/fuzzer/FuzzerFork.cpp\n-+++ b/compiler-rt/lib/fuzzer/FuzzerFork.cpp\n-@@ -26,6 +26,8 @@\n- #include <queue>\n- #include <sstream>\n- #include <thread>\n-+#include <sys/stat.h>\n-+#include <iostream>\n-\n- namespace fuzzer {\n-\n-@@ -70,6 +72,8 @@ struct FuzzJob {\n- std::string SeedListPath;\n- std::string CFPath;\n- size_t JobId;\n-+ bool Executing = false;\n-+ Vector<std::string> CopiedSeeds;\n-\n- int DftTimeInSeconds = 0;\n-\n-@@ -124,7 +128,6 @@ struct GlobalEnv {\n- Cmd.addFlag(\"reload\", \"0\"); // working in an isolated dir, no reload.\n- Cmd.addFlag(\"print_final_stats\", \"1\");\n- Cmd.addFlag(\"print_funcs\", \"0\"); // no need to spend time symbolizing.\n-- Cmd.addFlag(\"max_total_time\", std::to_string(std::min((size_t)300, JobId)));\n- Cmd.addFlag(\"stop_file\", StopFile());\n- if (!DataFlowBinary.empty()) {\n- Cmd.addFlag(\"data_flow_trace\", DFTDir);\n-@@ -133,11 +136,10 @@ struct GlobalEnv {\n- }\n- auto Job = new FuzzJob;\n- std::string Seeds;\n-- if (size_t CorpusSubsetSize =\n-- std::min(Files.size(), (size_t)sqrt(Files.size() + 2))) {\n-+ if (size_t CorpusSubsetSize = Files.size()) {\n- auto Time1 = std::chrono::system_clock::now();\n- for (size_t i = 0; i < CorpusSubsetSize; i++) {\n-- auto &SF = Files[Rand->SkewTowardsLast(Files.size())];\n-+ auto &SF = Files[i];\n- Seeds += (Seeds.empty() ? \"\" : \",\") + SF;\n- CollectDFT(SF);\n- }\n-@@ -213,11 +215,20 @@ struct GlobalEnv {\n- Set<uint32_t> NewFeatures, NewCov;\n- CrashResistantMerge(Args, {}, MergeCandidates, &FilesToAdd, Features,\n- &NewFeatures, Cov, &NewCov, Job->CFPath, false);\n-+ RemoveFile(Job->CFPath);\n- for (auto &Path : FilesToAdd) {\n-- auto U = FileToVector(Path);\n-- auto NewPath = DirPlusFile(MainCorpusDir, Hash(U));\n-- WriteToFile(U, NewPath);\n-- Files.push_back(NewPath);\n-+ // Only merge files that have not been merged already.\n-+ if (std::find(Job->CopiedSeeds.begin(), Job->CopiedSeeds.end(), Path) == Job->CopiedSeeds.end()) {\n-+ // NOT THREAD SAFE: Fast check whether file still exists.\n-+ struct stat buffer;\n-+ if (stat (Path.c_str(), &buffer) == 0) {\n-+ auto U = FileToVector(Path);\n-+ auto NewPath = DirPlusFile(MainCorpusDir, Hash(U));\n-+ WriteToFile(U, NewPath);\n-+ Files.push_back(NewPath);\n-+ Job->CopiedSeeds.push_back(Path);\n-+ }\n-+ }\n- }\n- Features.insert(NewFeatures.begin(), NewFeatures.end());\n- Cov.insert(NewCov.begin(), NewCov.end());\n-@@ -271,10 +282,19 @@ struct JobQueue {\n- }\n- };\n-\n--void WorkerThread(JobQueue *FuzzQ, JobQueue *MergeQ) {\n-+void WorkerThread(GlobalEnv *Env, JobQueue *FuzzQ, JobQueue *MergeQ) {\n- while (auto Job = FuzzQ->Pop()) {\n-- // Printf(\"WorkerThread: job %p\\n\", Job);\n-+ Job->Executing = true;\n-+ int Sleep_ms = 5 * 60 * 1000;\n-+ std::thread([=]() {\n-+ std::this_thread::sleep_for(std::chrono::milliseconds(Sleep_ms / 5));\n-+ while (Job->Executing) {\n-+ Env->RunOneMergeJob(Job);\n-+ std::this_thread::sleep_for(std::chrono::milliseconds(Sleep_ms));\n-+ }\n-+ }).detach();\n- Job->ExitCode = ExecuteCommand(Job->Cmd);\n-+ Job->Executing = false;\n- MergeQ->Push(Job);\n- }\n- }\n-@@ -335,7 +355,7 @@ void FuzzWithFork(Random &Rand, const FuzzingOptions &Options,\n- size_t JobId = 1;\n- Vector<std::thread> Threads;\n- for (int t = 0; t < NumJobs; t++) {\n-- Threads.push_back(std::thread(WorkerThread, &FuzzQ, &MergeQ));\n-+ Threads.push_back(std::thread(WorkerThread, &Env, &FuzzQ, &MergeQ));\n- FuzzQ.Push(Env.CreateNewJob(JobId++));\n- }\n-\n" } ]
Python
Apache License 2.0
google/fuzzbench
Removing unused files and old flags. (#1449)
258,388
11.08.2022 16:01:59
14,400
14c6c8336786e638efc3288bedb817ad073da1ed
Get rid of clear-cache from documentation Fixes:
[ { "change_type": "MODIFY", "old_path": "docs/getting-started/adding_a_new_fuzzer.md", "new_path": "docs/getting-started/adding_a_new_fuzzer.md", "diff": "@@ -287,9 +287,6 @@ make build-$FUZZER_NAME-all\n* Run `make presubmit` to lint your code and ensure all tests are passing.\n-* Run `make clear-cache` to clear docker containers' caches. Next time you build\n- a project, the container will be built from scratch.\n-\n## Blocklisting benchmarks\nYou should make sure that your fuzzer builds and runs successfully against all\n" } ]
Python
Apache License 2.0
google/fuzzbench
Get rid of clear-cache from documentation (#1454) Fixes: https://github.com/google/fuzzbench/issues/1453
258,402
12.08.2022 20:25:01
-36,000
47e96a805c044e11d25cc0de55c034c195c5c275
Add a new experiment to test centipede
[ { "change_type": "ADD", "old_path": null, "new_path": "config/experiment.yaml", "diff": "+benchmarks:\n+- curl_curl_fuzzer_http\n+- harfbuzz-1.3.2\n+- jsoncpp_jsoncpp_fuzzer\n+- lcms-2017-03-21\n+- libjpeg-turbo-07-2017\n+- libpcap_fuzz_both\n+- libpng-1.2.56\n+- libxml2-v2.9.2\n+- libxslt_xpath\n+- mbedtls_fuzz_dtlsclient\n+- openssl_x509\n+- openthread-2019-12-23\n+- php_php-fuzz-parser\n+- proj4-2017-08-14\n+- re2-2014-12-09\n+- sqlite3_ossfuzz\n+- systemd_fuzz-link-parser\n+- vorbis-2017-12-11\n+- woff2-2016-05-06\n+- zlib_zlib_uncompress_fuzzer\n+cloud_compute_zone: us-central1-b\n+cloud_project: fuzzbench\n+cloud_sql_instance_connection_name: fuzzbench:us-central1:postgres-experiment-db=tcp:5432\n+concurrent_builds: null\n+custom_seed_corpus_dir: null\n+description: null\n+docker_registry: us-central1-docker.pkg.dev/fuzzbench/fuzzbench-private\n+experiment: 2022-08-12-14-04-30m-dongge\n+experiment_filestore: gs://fuzzbench-data-private\n+fuzzers:\n+- centipede\n+- libfuzzer\n+git_hash: c118d449c0ce3e94f9597b4a807b841b33e23b67\n+local_experiment: false\n+max_total_time: 1900\n+measurers_cpus: null\n+merge_with_nonprivate: false\n+no_dictionaries: false\n+no_seeds: false\n+oss_fuzz_corpus: false\n+preemptible_runners: false\n+private: true\n+region_coverage: false\n+report_filestore: gs://fuzzbench-reports-private\n+runner_machine_type: n1-standard-1\n+runner_memory: 12GB\n+runner_num_cpu_cores: 1\n+runners_cpus: null\n+snapshot_period: 900\n+trials: 1\n" }, { "change_type": "ADD", "old_path": null, "new_path": "experiment_instance", "diff": "+d-2022-07-08-17-55-24h-dongge\n+d-2022-07-11-00-13-8h-dongge\n+d-2022-07-11-20-54-24h-dongge\n+d-2022-07-12-22-46-1h-dongge\n+d-2022-07-13-09-45-1h-dongge\n+d-2022-07-16-00-56-24h-dongge\n+d-2022-07-18-10-52-24h-dongge\n+d-2022-07-21-07-42-24h-dongge\n+d-2022-07-21-08-31-24h-dongge\n+d-2022-07-21-10-31-24h-dongge\n+d-2022-07-22-18-15-24h-dongge\n+d-2022-08-03-19-07-15m-dongge\n+d-2022-08-03-21-52-1h-dongge\n+d-2022-08-12-10-43-1h-dongge\n+d-2022-08-12-14-04-30m-dongge\n" }, { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# 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#\n+- experiment: 2022-08-12-centipede\n+ description: \"Test centipede (`no pc_table` error should have been fixed)\"\n+ fuzzers:\n+ - libfuzzer\n+ - centipede\n+\n- experiment: 2022-08-04-afl-new-splicing\ndescription: \"Test AFL with a new splicing as mutation\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
Add a new experiment to test centipede
258,402
12.08.2022 20:34:09
-36,000
0fbf89a9e3040395a1ecb65523bb3929ec2783f1
Uncommit garbage
[ { "change_type": "DELETE", "old_path": "config/experiment.yaml", "new_path": null, "diff": "-benchmarks:\n-- curl_curl_fuzzer_http\n-- harfbuzz-1.3.2\n-- jsoncpp_jsoncpp_fuzzer\n-- lcms-2017-03-21\n-- libjpeg-turbo-07-2017\n-- libpcap_fuzz_both\n-- libpng-1.2.56\n-- libxml2-v2.9.2\n-- libxslt_xpath\n-- mbedtls_fuzz_dtlsclient\n-- openssl_x509\n-- openthread-2019-12-23\n-- php_php-fuzz-parser\n-- proj4-2017-08-14\n-- re2-2014-12-09\n-- sqlite3_ossfuzz\n-- systemd_fuzz-link-parser\n-- vorbis-2017-12-11\n-- woff2-2016-05-06\n-- zlib_zlib_uncompress_fuzzer\n-cloud_compute_zone: us-central1-b\n-cloud_project: fuzzbench\n-cloud_sql_instance_connection_name: fuzzbench:us-central1:postgres-experiment-db=tcp:5432\n-concurrent_builds: null\n-custom_seed_corpus_dir: null\n-description: null\n-docker_registry: us-central1-docker.pkg.dev/fuzzbench/fuzzbench-private\n-experiment: 2022-08-12-14-04-30m-dongge\n-experiment_filestore: gs://fuzzbench-data-private\n-fuzzers:\n-- centipede\n-- libfuzzer\n-git_hash: c118d449c0ce3e94f9597b4a807b841b33e23b67\n-local_experiment: false\n-max_total_time: 1900\n-measurers_cpus: null\n-merge_with_nonprivate: false\n-no_dictionaries: false\n-no_seeds: false\n-oss_fuzz_corpus: false\n-preemptible_runners: false\n-private: true\n-region_coverage: false\n-report_filestore: gs://fuzzbench-reports-private\n-runner_machine_type: n1-standard-1\n-runner_memory: 12GB\n-runner_num_cpu_cores: 1\n-runners_cpus: null\n-snapshot_period: 900\n-trials: 1\n" }, { "change_type": "DELETE", "old_path": "experiment_instance", "new_path": null, "diff": "-d-2022-07-08-17-55-24h-dongge\n-d-2022-07-11-00-13-8h-dongge\n-d-2022-07-11-20-54-24h-dongge\n-d-2022-07-12-22-46-1h-dongge\n-d-2022-07-13-09-45-1h-dongge\n-d-2022-07-16-00-56-24h-dongge\n-d-2022-07-18-10-52-24h-dongge\n-d-2022-07-21-07-42-24h-dongge\n-d-2022-07-21-08-31-24h-dongge\n-d-2022-07-21-10-31-24h-dongge\n-d-2022-07-22-18-15-24h-dongge\n-d-2022-08-03-19-07-15m-dongge\n-d-2022-08-03-21-52-1h-dongge\n-d-2022-08-12-10-43-1h-dongge\n-d-2022-08-12-14-04-30m-dongge\n" } ]
Python
Apache License 2.0
google/fuzzbench
Uncommit garbage
258,377
16.08.2022 03:09:35
-10,800
68291d2c0026cdecba802ce3474ba30757ece93b
Fix saving corpus for a cycle
[ { "change_type": "MODIFY", "old_path": "experiment/resources/runner-startup-script-template.sh", "new_path": "experiment/resources/runner-startup-script-template.sh", "diff": "@@ -57,4 +57,4 @@ docker run \\\n--shm-size=2g \\\n--cap-add SYS_NICE --cap-add SYS_PTRACE \\\n--security-opt seccomp=unconfined \\\n-{{docker_image_url}} 2>&1 | tee /tmp/runner-log.txt\n+{{docker_image_url}} 2>&1 | tee /tmp/runner-log-{{trial_id}}.txt\n" }, { "change_type": "MODIFY", "old_path": "experiment/runner.py", "new_path": "experiment/runner.py", "diff": "@@ -337,14 +337,17 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\ncontinue\nfile_path = os.path.join(root, filename)\n+ try:\nstat_info = os.stat(file_path)\nlast_modified_time = stat_info.st_mtime\n- # Warning: ctime means creation time on Win and may not work as\n- # expected.\n+ # Warning: ctime means creation time on Win and\n+ # may not work as expected.\nlast_changed_time = stat_info.st_ctime\nfile_tuple = File(file_path, last_modified_time,\nlast_changed_time)\nself.corpus_dir_contents.add(file_tuple)\n+ except Exception: # pylint: disable=broad-except\n+ pass\ndef is_corpus_dir_same(self):\n\"\"\"Sets |self.corpus_dir_contents| to the current contents and returns\n" }, { "change_type": "MODIFY", "old_path": "experiment/test_scheduler.py", "new_path": "experiment/test_scheduler.py", "diff": "@@ -129,7 +129,7 @@ docker run \\\\\n--shm-size=2g \\\\\n--cap-add SYS_NICE --cap-add SYS_PTRACE \\\\\n--security-opt seccomp=unconfined \\\\\n-{docker_image_url} 2>&1 | tee /tmp/runner-log.txt'''\n+{docker_image_url} 2>&1 | tee /tmp/runner-log-9.txt'''\nwith mock.patch('common.benchmark_utils.get_fuzz_target',\nreturn_value=expected_target):\n_test_create_trial_instance(benchmark, expected_image, expected_target,\n@@ -174,7 +174,7 @@ docker run \\\\\n--shm-size=2g \\\\\n--cap-add SYS_NICE --cap-add SYS_PTRACE \\\\\n--security-opt seccomp=unconfined \\\\\n-{docker_image_url} 2>&1 | tee /tmp/runner-log.txt'''\n+{docker_image_url} 2>&1 | tee /tmp/runner-log-9.txt'''\n_test_create_trial_instance(benchmark, expected_image, expected_target,\nexpected_startup_script,\nlocal_experiment_config, False)\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix saving corpus for a cycle (#1452)
258,403
18.08.2022 17:29:58
25,200
58eebaf836dd00d4f7f9720ba244118d79d04724
Request new focus experiment
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-08-18-libfuzzer-focus\n+ description: \"Testing with focus function driven by fuzz introspector results\"\n+ fuzzers:\n+ - libfuzzer\n+ - introspector_driven_focus\n+ benchmarks:\n+ - libarchive_libarchive_fuzzer\n+\n- experiment: 2022-08-18-aflpp\ndescription: \"afl++ tests\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Request new focus experiment (#1462)
258,403
24.08.2022 11:46:22
25,200
63ece1cb1b5e50b03fc4a514ab1eaecf044e8619
Check for env before setting it
[ { "change_type": "MODIFY", "old_path": "fuzzers/libfuzzer/fuzzer.py", "new_path": "fuzzers/libfuzzer/fuzzer.py", "diff": "@@ -58,8 +58,14 @@ def run_fuzzer(input_corpus, output_corpus, target_binary, extra_flags=None):\n# only symbolize=1 is respected.\nfor flag in extra_flags:\nif flag.startswith('-focus_function'):\n+ if os.environ['ASAN_OPTIONS']:\nos.environ['ASAN_OPTIONS'] += ':symbolize=1'\n+ else:\n+ os.environ['ASAN_OPTIONS'] = 'symbolize=1'\n+ if os.environ['UBSAN_OPTIONS']:\nos.environ['UBSAN_OPTIONS'] += ':symbolize=1'\n+ else:\n+ os.environ['UBSAN_OPTIONS'] = 'symbolize=1'\nbreak\nflags = [\n" } ]
Python
Apache License 2.0
google/fuzzbench
Check for env before setting it (#1471)
258,403
29.08.2022 09:47:56
25,200
187953de5271389c4d8cc784001bf8c79a16c29a
Fix function name discrepancies between OSS-Fuzz projects and FB benchmarks
[ { "change_type": "MODIFY", "old_path": "fuzzers/introspector_driven_focus/focus_map.yaml", "new_path": "fuzzers/introspector_driven_focus/focus_map.yaml", "diff": "@@ -39,7 +39,7 @@ bloaty_fuzz_target:\n- bloaty::BloatyDoMain(bloaty::Options const&, bloaty::InputFileFactory const&, bloaty::RollupOutput*)\n- google::protobuf::DescriptorProto::IsInitialized() const\ncurl_curl_fuzzer_http:\n-- ossl_connect\n+- Curl_ossl_connect\n- ssl3_connect\n- ssl3_ctrl\n- Curl_is_connected\n@@ -48,8 +48,7 @@ file_magic_fuzzer:\n- file_buffer\n- mget\n- apprentice_sort\n-freetype2-2017:\n-- OSS_FUZZ_png_read_info\n+freetype2-2017: []\nharfbuzz-1.3.2:\n- hb_serialize_context_t::resolve_links()\n- hb_buffer_t::verify(hb_buffer_t*, hb_font_t*, hb_feature_t const*, unsigned int,\n@@ -97,7 +96,6 @@ libjpeg-turbo-07-2017:\n- tjDecompress2\n- tjDestroy\n- alloc_small\n-- init_simd\n- alloc_large\n- access_virt_barray\n- realize_virt_arrays\n@@ -108,11 +106,10 @@ libpcap_fuzz_both:\n- pcap_lex\n- pcap_parse\nlibpng-1.2.56:\n-- OSS_FUZZ_png_init_read_transformations\n-- OSS_FUZZ_png_do_read_transformations\n+- png_init_read_transformations\n+- png_do_read_transformations\nlibxml2-v2.9.2:\n- xmlTextReaderRead\n-- xmlXIncludeLoadFallback\n- xmlNodeDumpOutputInternal\nlibxslt_xpath:\n- htmlParseStartTag\n@@ -122,11 +119,9 @@ libxslt_xpath:\n- xmlParseDocument\nmatio_matio_fuzzer: []\nmbedtls_fuzz_dtlsclient:\n-- mbedtls_ssl_write_client_hello\n- mbedtls_rsa_complete\n- mbedtls_ssl_fetch_input\n- mbedtls_ssl_handshake_step\n-- mbedtls_ssl_write_client_hello\nmruby-2018-05-23:\n- mrb_vm_exec\nmuparser_set_eval_fuzzer:\n@@ -171,7 +166,7 @@ proj4_standard_fuzzer:\nstd::__1::vector, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>\n>, bool, long, unsigned long, double, std::__1::allocator, proj_nlohmann::adl_serializer,\nstd::__1::vector<unsigned char, std::__1::allocator<unsigned char> > > const&)\n-- proj_create_crs_to_crs_from_pj\n+- proj_create_crs_to_crs\n- osgeo::proj::io::createFromUserInput(std::__1::basic_string<char, std::__1::char_traits<char>,\nstd::__1::allocator<char> > const&, std::__1::shared_ptr<osgeo::proj::io::DatabaseContext>\nconst&, bool, pj_ctx*)\n@@ -226,6 +221,5 @@ zstd_stream_decompress:\n- ZSTDv06_decompressBegin_usingDict\n- ZSTDv07_decompressBegin_usingDict\n- ZSTD_decompressSequences\n-- ZSTD_decompressSequencesSplitLitBuffer\n- HUF_decompress4X1_usingDTable_internal\n- ZSTD_decompressStream\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix function name discrepancies between OSS-Fuzz projects and FB benchmarks (#1473)
258,403
29.08.2022 15:47:10
25,200
ef2274015cd89caf6520b434c2bf60bf67a21638
Use extra_flags This makes the `fuzzer.py` re-usable by future variants of `centipede`
[ { "change_type": "MODIFY", "old_path": "fuzzers/centipede/fuzzer.py", "new_path": "fuzzers/centipede/fuzzer.py", "diff": "@@ -80,6 +80,7 @@ def run_fuzzer(input_corpus, output_corpus, target_binary, extra_flags=None):\n'--rss_limit_mb=0',\n'--address_space_limit_mb=0',\n]\n+ flags += extra_flags\ndictionary_path = utils.get_dictionary_path(target_binary)\nif dictionary_path:\nflags.append(f'--dictionary={dictionary_path}')\n" } ]
Python
Apache License 2.0
google/fuzzbench
Use extra_flags (#1475) This makes the `fuzzer.py` re-usable by future variants of `centipede`
258,402
30.08.2022 14:15:36
-36,000
71d2d24c3e759308044d3743295ec32d5f441c41
Reuse the weak references defined in Centipede
[ { "change_type": "MODIFY", "old_path": "fuzzers/centipede/builder.Dockerfile", "new_path": "fuzzers/centipede/builder.Dockerfile", "diff": "@@ -28,5 +28,4 @@ RUN git clone -n \\\nbazel build -c opt :all) && \\\ncp \"$CENTIPEDE_SRC/bazel-bin/centipede\" '/out/centipede'\n-COPY weak.c /src\n-RUN /clang/bin/clang /src/weak.c -c -o /lib/weak.o\n+RUN /clang/bin/clang \"$CENTIPEDE_SRC/weak_sancov_stubs.cc\" -c -o /lib/weak.o\n" }, { "change_type": "DELETE", "old_path": "fuzzers/centipede/weak.c", "new_path": null, "diff": "-// Copyright 2022 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-#include <stdint.h>\n-\n-__attribute__((weak)) void __sanitizer_cov_load1(uint8_t *addr) {}\n-__attribute__((weak)) void __sanitizer_cov_load2(uint16_t *addr) {}\n-__attribute__((weak)) void __sanitizer_cov_load4(uint32_t *addr) {}\n-__attribute__((weak)) void __sanitizer_cov_load8(uint64_t *addr) {}\n-__attribute__((weak)) void __sanitizer_cov_load16(__uint128_t *addr) {}\n-\n-__attribute__((weak)) void __sanitizer_cov_store1(uint8_t *addr) {}\n-__attribute__((weak)) void __sanitizer_cov_store2(uint16_t *addr) {}\n-__attribute__((weak)) void __sanitizer_cov_store4(uint32_t *addr) {}\n-__attribute__((weak)) void __sanitizer_cov_store8(uint64_t *addr) {}\n-__attribute__((weak)) void __sanitizer_cov_store16(__uint128_t *addr) {}\n-\n" } ]
Python
Apache License 2.0
google/fuzzbench
Reuse the weak references defined in Centipede (#1469)
258,402
08.09.2022 22:03:37
-36,000
5648934c75ed503a59066b1d40cfcecabd3ef91c
Launch another round of Centipede exp
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-09-08-centipede\n+ description: \"Another round of centipede experiment\"\n+ fuzzers:\n+ - honggfuzz\n+ - aflplusplus\n+ - eclipser\n+ - entropic\n+ - libfuzzer\n+ - lafintel\n+ - afl\n+ - mopt\n+ - fairfuzz\n+ - libfuzzer_dataflow\n+ - centipede\n+\n- experiment: 2022-08-29-focus-code\ndescription: \"Focus function experiment -- type: code\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Launch another round of Centipede exp (#1485)
258,402
14.09.2022 17:22:34
-36,000
cbe55b937d3dc250a1ef1b9898539ef160636b7b
Add new fuzzers to fuzzer list
[ { "change_type": "MODIFY", "old_path": ".github/workflows/fuzzers.yml", "new_path": ".github/workflows/fuzzers.yml", "diff": "@@ -26,6 +26,16 @@ jobs:\n- aflplusplus_um_random\n- aflsmart\n- centipede\n+ - centipede_corpus_1000\n+ - centipede_corpus_10000\n+ - centipede_counter\n+ - centipede_coverage_frontier\n+ - centipede_no_cmp\n+ - centipede_no_corpus_weight\n+ - centipede_no_dataflow\n+ - centipede_path_10\n+ - centipede_path_5\n+ - centipede_pcpair\n- entropic\n- fairfuzz\n- honggfuzz\n" } ]
Python
Apache License 2.0
google/fuzzbench
Add new fuzzers to fuzzer list
258,388
18.09.2022 14:48:54
14,400
391cad9395848dc2fa1540af7e2833edbeb641a6
Another first fuzz the mutants experiment
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# 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#\n+- experiment: 2022-09-18-aflpp-um\n+ description: \"afl++ um coverage experiments (compare our fuzzers against afl++)\"\n+ fuzzers:\n+ - aflplusplus_um_prioritize\n+ - aflplusplus_um_random\n+ - aflplusplus\n+\n- experiment: 2022-08-31-aflpp-um\ndescription: \"afl++ um coverage experiments (compare our fuzzers against afl++)\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Another first fuzz the mutants experiment
258,394
27.09.2022 15:56:17
-36,000
63cd1fc58c0681f0023745eb7e60d8fba62bdd83
Request new saturated experiment for centipede vs centipede filter
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# 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#\n+- experiment: 2022-09-27-centipede-code-saturated\n+ description: \"Centipede Focus function experiment -- type: code\"\n+ oss-fuzz-corpus: true\n+ fuzzers:\n+ - centipede\n+ - centipede_function_filter\n+ benchmarks:\n+ - curl_curl_fuzzer_http\n+ - jsoncpp_jsoncpp_fuzzer\n+ - libjpeg-turbo-07-2017\n+ - mbedtls_fuzz_dtlsclient\n+ - openthread-2019-12-23\n+ - vorbis-2017-12-11\n+ - freetype2-2017\n+ - harfbuzz-1.3.2\n+ - lcms-2017-03-21\n+ - bloaty_fuzz_target\n+ - libpng-1.2.56\n+ - zlib_zlib_uncompress_fuzzer\n+ - re2-2014-12-09\n+ - libxml2-v2.9.2\n+ - libxslt_xpath\n+ - libpcap_fuzz_both\n+\n- experiment: 2022-09-22-aflpp-um\ndescription: \"afl++ um coverage experiments (compare our fuzzers against afl++)\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Request new saturated experiment for centipede vs centipede filter (#1499)
258,394
27.09.2022 16:04:46
-36,000
1957fc53d1ee2c855d567ba48d16969b0b696ea2
Shorten last request name. Hit the merge button too early, when it failed CI:
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# 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#\n-- experiment: 2022-09-27-centipede-code-saturated\n+- experiment: 2022-09-27-centipede-corpus\ndescription: \"Centipede Focus function experiment -- type: code\"\noss-fuzz-corpus: true\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Shorten last request name. (#1500) Hit the merge button too early, when it failed CI: https://github.com/google/fuzzbench/actions/runs/3133264956/jobs/5086454501
258,388
28.09.2022 06:29:57
14,400
4695d8631bf578644d2f9be837a3f4d8592b2d26
Try to repro 2022-05-06-dissecting-repro
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# 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#\n+- experiment: 2022-05-06-dissecting-repro\n+ description: \"Reproduce: Dissecting AFL paper\"\n+ type: bug\n+ fuzzers:\n+ - afl\n+ - afl_no_favored\n+ - afl_collision_free\n+ - afl_double_timeout\n+ - afl_no_favfactor\n+ - afl_no_trim\n+ - afl_scheduling_lifo\n+ - afl_scheduling_random\n+ - afl_score_max\n+ - afl_score_min\n+ - afl_score_no_novel_prioritization\n+ - afl_score_random\n+ - afl_splicing_mutation\n+\n- experiment: 2022-09-27-centipede-corpus\ndescription: \"Centipede Focus function experiment -- type: code\"\noss-fuzz-corpus: true\n" } ]
Python
Apache License 2.0
google/fuzzbench
Try to repro 2022-05-06-dissecting-repro (#1503)
258,408
28.09.2022 11:51:09
18,000
ce4efb764f9b2ab0b2cf2f0424b6e78d550377ed
Fix typo on build() of AFL++.
[ { "change_type": "MODIFY", "old_path": "fuzzers/aflplusplus/fuzzer.py", "new_path": "fuzzers/aflplusplus/fuzzer.py", "diff": "@@ -213,15 +213,15 @@ def build(*args): # pylint: disable=too-many-branches,too-many-statements\nnew_env['SYMCC_NO_SYMBOLIC_INPUT'] = \"1\"\nnew_env['SYMCC_SILENT'] = \"1\"\n- # For CmpLog build, set the OUT and FUZZ_TARGET environment\n- # variable to point to the new CmpLog build directory.\n+ # For symcc build, set the OUT and FUZZ_TARGET environment\n+ # variable to point to the new symcc build directory.\nnew_env['OUT'] = symcc_build_directory\nfuzz_target = os.getenv('FUZZ_TARGET')\nif fuzz_target:\nnew_env['FUZZ_TARGET'] = os.path.join(symcc_build_directory,\nos.path.basename(fuzz_target))\n- print('Re-building benchmark for CmpLog fuzzing target')\n+ print('Re-building benchmark for symcc fuzzing target')\nutils.build_benchmark(env=new_env)\nshutil.copy('/afl/afl-fuzz', build_directory)\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix typo on build() of AFL++. (#1501)
258,400
30.09.2022 02:07:56
-28,800
9915bd59f6d14098257c0222d22bee11088dff9e
Request experiment for WingFuzz This PR adds WingFuzz, an experimental fuzzer featuring memory coverage guidance.
[ { "change_type": "MODIFY", "old_path": ".github/workflows/fuzzers.yml", "new_path": ".github/workflows/fuzzers.yml", "diff": "@@ -53,6 +53,7 @@ jobs:\n- pythia_bb\n- fafuzz\n- tortoisefuzz\n+ - wingfuzz\n# Binary-only (greybox) fuzzers.\n- eclipser\n- eclipser_um_prioritize\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/ffmpeg_ffmpeg_demuxer_fuzzer/benchmark.yaml", "new_path": "benchmarks/ffmpeg_ffmpeg_demuxer_fuzzer/benchmark.yaml", "diff": "@@ -44,3 +44,4 @@ unsupported_fuzzers:\n- libfuzzer_dataflow_load\n- libfuzzer_dataflow_store\n- libfuzzer_dataflow_pre\n+ - wingfuzz\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/go-ethereum_fuzzvmruntime/benchmark.yaml", "new_path": "benchmarks/go-ethereum_fuzzvmruntime/benchmark.yaml", "diff": "@@ -14,3 +14,4 @@ unsupported_fuzzers:\n- eclipser_um_prioritize\n- libfuzzer_um_random\n- libfuzzer_um_prioritize\n+ - wingfuzz\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/wingfuzz/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\n+FROM $parent_image\n+\n+RUN git clone https://github.com/WingTecherTHU/wingfuzz\n+RUN cd wingfuzz && git checkout f1a8dd2a49fefb7b85ae42e3d204dec2999fc8eb && \\\n+ ./build.sh && cd instrument && ./build.sh && clang -c WeakSym.c && \\\n+ cp ../libFuzzer.a /libWingfuzz.a && cp WeakSym.o / && cp LoadCmpTracer.so /\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/wingfuzz/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 Entropic 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+ cflags = [\n+ '-fsanitize=fuzzer-no-link',\n+ '-fno-sanitize-coverage=trace-cmp',\n+ '-fno-legacy-pass-manager',\n+ '-fpass-plugin=/LoadCmpTracer.so',\n+ # Hack: support non-standard build scripts ignoring LDFLAGS\n+ '-w',\n+ '-Wl,/WeakSym.o'\n+ ]\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'] = '/libWingfuzz.a'\n+\n+ utils.build_benchmark()\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\"\"\"\n+ libfuzzer_fuzzer.run_fuzzer(input_corpus,\n+ output_corpus,\n+ target_binary,\n+ extra_flags=[\n+ '-fork=0', '-keep_seed=1',\n+ '-cross_over_uniform_dist=1',\n+ '-entropic_scale_per_exec_time=1',\n+ '-jobs=2147483647', '-workers=1',\n+ '-reload=0'\n+ ])\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/wingfuzz/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-image\n" }, { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-09-29-wingfuzz\n+ description: \"Wingfuzz coverage experiment (compare against core fuzzers)\"\n+ fuzzers:\n+ - afl\n+ - aflfast\n+ - aflplusplus\n+ - aflsmart\n+ - entropic\n+ - eclipser\n+ - fairfuzz\n+ - honggfuzz\n+ - lafintel\n+ - libfuzzer\n+ - mopt\n+ - wingfuzz\n- experiment: 2022-05-06-dissecting-repro\ndescription: \"Reproduce: Dissecting AFL paper\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
Request experiment for WingFuzz (#1497) This PR adds WingFuzz, an experimental fuzzer featuring memory coverage guidance.
258,388
29.09.2022 17:25:56
14,400
f3afeee7ba6c770cc7b09d4d65823f9e67629c32
Do a main experiment
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "- libfuzzer\n- mopt\n- wingfuzz\n+\n+- experiment: 2022-09-29\n+ description: \"Main coverage experiment\"\n+ type: code\n+ fuzzers:\n+ - honggfuzz\n+ - aflplusplus\n+ - eclipser\n+ - entropic\n+ - libfuzzer\n+ - aflsmart\n+ - lafintel\n+ - afl\n+ - mopt\n+ - aflfast\n+ - fairfuzz\n+ - libafl\n- experiment: 2022-05-06-dissecting-repro\ndescription: \"Reproduce: Dissecting AFL paper\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
Do a main experiment
258,388
03.10.2022 17:37:56
14,400
7132a8f6145950a8ccac3dc757ac641b8aa7da52
Fix benchmark integration script The previous model used a submodule that was never updated and thus the stuff copied from oss-fuzz repo was very old and generally not working. Change this to use the latest oss-fuzz clone.
[ { "change_type": "MODIFY", "old_path": ".gitmodules", "new_path": ".gitmodules", "diff": "-[submodule \"third_party/oss-fuzz\"]\n- path = third_party/oss-fuzz\n- url = https://github.com/google/oss-fuzz.git\n" }, { "change_type": "MODIFY", "old_path": "analysis/test_data/pairwise_unique_coverage_heatmap-failed-diff.png", "new_path": "analysis/test_data/pairwise_unique_coverage_heatmap-failed-diff.png", "diff": "Binary files a/analysis/test_data/pairwise_unique_coverage_heatmap-failed-diff.png and b/analysis/test_data/pairwise_unique_coverage_heatmap-failed-diff.png differ\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/oss_fuzz_benchmark_integration.py", "new_path": "benchmarks/oss_fuzz_benchmark_integration.py", "diff": "will create benchmark.yaml as well as copy the files from OSS-Fuzz to build the\nbenchmark.\"\"\"\nimport argparse\n+import bisect\nimport datetime\nfrom distutils import spawn\nfrom distutils import dir_util\n+import json\nimport os\nimport sys\nimport subprocess\n-import json\n-import bisect\n+import tempfile\n+\nfrom common import utils\nfrom common import benchmark_utils\n@@ -30,8 +32,7 @@ from common import logs\nfrom common import new_process\nfrom common import yaml_utils\n-OSS_FUZZ_DIR = os.path.join(utils.ROOT_DIR, 'third_party', 'oss-fuzz')\n-OSS_FUZZ_REPO_PATH = os.path.join(OSS_FUZZ_DIR, 'infra')\n+OSS_FUZZ_REPO_URL = 'https://github.com/google/oss-fuzz'\nOSS_FUZZ_IMAGE_UPGRADE_DATE = datetime.datetime(\nyear=2021, month=8, day=25, tzinfo=datetime.timezone.utc)\n@@ -77,14 +78,10 @@ class BaseBuilderDockerRepo:\ndef copy_oss_fuzz_files(project, commit_date, benchmark_dir):\n\"\"\"Checks out the right files from OSS-Fuzz to build the benchmark based on\n|project| and |commit_date|. Then copies them to |benchmark_dir|.\"\"\"\n- if not os.path.exists(os.path.join(OSS_FUZZ_DIR, '.git')):\n- logs.error(\n- '%s is not a git repo. Try running: git submodule update --init',\n- OSS_FUZZ_DIR)\n- raise RuntimeError('%s is not a git repo.' % OSS_FUZZ_DIR)\n- oss_fuzz_repo_manager = GitRepoManager(OSS_FUZZ_DIR)\n- project_dir = os.path.join(OSS_FUZZ_DIR, 'projects', project)\n- try:\n+ with tempfile.TemporaryDirectory() as oss_fuzz_dir:\n+ oss_fuzz_repo_manager = GitRepoManager(oss_fuzz_dir)\n+ oss_fuzz_repo_manager.git(['clone', OSS_FUZZ_REPO_URL, oss_fuzz_dir])\n+ project_dir = os.path.join(oss_fuzz_dir, 'projects', project)\n# Find an OSS-Fuzz commit that can be used to build the benchmark.\n_, oss_fuzz_commit, _ = oss_fuzz_repo_manager.git([\n'log', '--before=' + commit_date.isoformat(), '-n1', '--format=%H',\n@@ -98,8 +95,6 @@ def copy_oss_fuzz_files(project, commit_date, benchmark_dir):\ndir_util.copy_tree(project_dir, benchmark_dir)\nos.remove(os.path.join(benchmark_dir, 'project.yaml'))\nreturn True\n- finally:\n- oss_fuzz_repo_manager.git(['reset', '--hard'])\ndef get_benchmark_name(project, fuzz_target, benchmark_name=None):\n" }, { "change_type": "MODIFY", "old_path": "docs/getting-started/prerequisites.md", "new_path": "docs/getting-started/prerequisites.md", "diff": "@@ -23,7 +23,6 @@ Clone the FuzzBench repository to your machine by running the following command:\n```bash\ngit clone https://github.com/google/fuzzbench\ncd fuzzbench\n-git submodule update --init\n```\n## Installing prerequisites\n" }, { "change_type": "MODIFY", "old_path": "experiment/run_experiment.py", "new_path": "experiment/run_experiment.py", "diff": "@@ -41,8 +41,6 @@ from common import yaml_utils\nBENCHMARKS_DIR = os.path.join(utils.ROOT_DIR, 'benchmarks')\nFUZZERS_DIR = os.path.join(utils.ROOT_DIR, 'fuzzers')\n-OSS_FUZZ_PROJECTS_DIR = os.path.join(utils.ROOT_DIR, 'third_party', 'oss-fuzz',\n- 'projects')\nRESOURCES_DIR = os.path.join(utils.ROOT_DIR, 'experiment', 'resources')\nFUZZER_NAME_REGEX = re.compile(r'^[a-z][a-z0-9_]+$')\nEXPERIMENT_CONFIG_REGEX = re.compile(r'^[a-z0-9-]{0,30}$')\n@@ -56,7 +54,6 @@ FILTER_SOURCE_REGEX = re.compile(r'('\nr'\\#*\\#$|'\nr'\\.pytest_cache/|'\nr'.*/test_data/|'\n- r'^third_party/oss-fuzz/build/|'\nr'^docker/generated.mk$|'\nr'^docs/)')\n_OSS_FUZZ_CORPUS_BACKUP_URL_FORMAT = (\n" }, { "change_type": "DELETE", "old_path": "third_party/oss-fuzz", "new_path": null, "diff": "-Subproject commit d39cbb5a8ce75f6187bd7731e0099dbd1c23a3b1\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix benchmark integration script (#1504) The previous model used a submodule that was never updated and thus the stuff copied from oss-fuzz repo was very old and generally not working. Change this to use the latest oss-fuzz clone.
258,380
04.10.2022 13:05:37
14,400
e4ab7e6ebe7a31a476377dad1ca6654475076feb
Fixing bugs with UM fuzzers PR to fix build issues and runtime issues along with starting a new experiment for the UM fuzzer fixed.
[ { "change_type": "MODIFY", "old_path": "fuzzers/aflplusplus_um_random/fuzzer.py", "new_path": "fuzzers/aflplusplus_um_random/fuzzer.py", "diff": "@@ -41,7 +41,7 @@ class TimeoutException(Exception):\nTOTAL_FUZZING_TIME_DEFAULT = 82800 # 23 hours\n-TOTAL_BUILD_TIME = 43200 # 12 hours\n+TOTAL_BUILD_TIME = 10800 # 3 hours\nFUZZ_PROP = 0.5\nDEFAULT_MUTANT_TIMEOUT = 300\nGRACE_TIME = 3600 # 1 hour in seconds\n@@ -131,7 +131,7 @@ def build(): # pylint: disable=too-many-locals,too-many-statements\n# Add grace time for final build at end\nremaining_time = int(TOTAL_BUILD_TIME - (start_time - curr_time) -\nGRACE_TIME)\n-\n+ with utils.restore_directory(src), utils.restore_directory(work):\ntry:\nwith time_limit(remaining_time):\nnum_non_buggy = 1\n@@ -154,7 +154,8 @@ def build(): # pylint: disable=too-many-locals,too-many-statements\nos.system(f\"rm -rf {out}/*\")\naflplusplus_fuzzer.build()\n- if not filecmp.cmp(f'{mutate_bins}/{orig_fuzz_target}',\n+ if not filecmp.cmp(\n+ f'{mutate_bins}/{orig_fuzz_target}',\nf'{out}/{orig_fuzz_target}',\nshallow=False):\nprint(f\"{out}/{orig_fuzz_target}\",\n@@ -191,17 +192,20 @@ def fuzz(input_corpus, output_corpus, target_binary):\nnum_mutants = min(math.ceil(total_mutant_time / timeout), len(mutants))\ninput_corpus_dir = \"/storage/input_corpus\"\n- os.mkdir(\"/storage\")\n- os.mkdir(input_corpus_dir)\n+ os.makedirs(input_corpus_dir, exist_ok=True)\nos.environ['AFL_SKIP_CRASHES'] = \"1\"\nfor mutant in mutants[:num_mutants]:\nos.system(f\"cp -r {input_corpus_dir}/* {input_corpus}/*\")\n+ with utils.restore_directory(input_corpus), utils.restore_directory(\n+ output_corpus):\ntry:\nwith time_limit(timeout):\naflplusplus_fuzzer.fuzz(input_corpus, output_corpus, mutant)\nexcept TimeoutException:\npass\n+ except CalledProcessError:\n+ pass\nos.system(f\"cp -r {output_corpus}/* {input_corpus_dir}/*\")\nos.system(f\"cp -r {input_corpus_dir}/* {input_corpus}/*\")\n" }, { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-10-04-um\n+ description: \"UM fuzzer experiment\"\n+ fuzzers:\n+ - aflplusplus\n+ - aflplusplus_um_random\n+\n- experiment: 2022-09-29-wingfuzz\ndescription: \"Wingfuzz coverage experiment (compare against core fuzzers)\"\nfuzzers:\n- aflfast\n- fairfuzz\n- libafl\n+\n- experiment: 2022-05-06-dissecting-repro\ndescription: \"Reproduce: Dissecting AFL paper\"\ntype: bug\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fixing bugs with UM fuzzers (#1510) PR to fix build issues and runtime issues along with starting a new experiment for the UM fuzzer fixed. Co-authored-by: jonathanmetzman <[email protected]>
258,380
04.10.2022 14:29:18
14,400
5001fcb13f03ca06bc222788ba7cab32af6c54df
Adding 6/12 hour builds for UM fuzzers Add 6/12 hour versions of aflplusplus_um_random fuzzer.
[ { "change_type": "MODIFY", "old_path": ".github/workflows/fuzzers.yml", "new_path": ".github/workflows/fuzzers.yml", "diff": "@@ -27,6 +27,8 @@ jobs:\n- aflplusplus_tracepc\n- aflplusplus_um_prioritize\n- aflplusplus_um_random\n+ - aflplusplus_um_random_6\n+ - aflplusplus_um_random_12\n- aflplusplus_um_parallel\n- aflsmart\n- centipede\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/aflplusplus_um_random_12/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\n+FROM $parent_image\n+\n+RUN apt-get update && apt-get install -y python3\n+RUN pip3 install --upgrade --force pip\n+RUN pip install universalmutator\n+\n+# Install libstdc++ to use llvm_mode.\n+RUN apt-get update && \\\n+ apt-get install -y wget libstdc++-5-dev libtool-bin automake flex bison \\\n+ libglib2.0-dev libpixman-1-dev python3-setuptools unzip \\\n+ apt-utils apt-transport-https ca-certificates\n+\n+# Download and compile afl++.\n+RUN git clone https://github.com/AFLplusplus/AFLplusplus.git /afl && \\\n+ cd /afl && \\\n+ git checkout b847e0f414e7b310e1a68bc501d4e2453bfce70e\n+\n+# Build without Python support as we don't need it.\n+# Set AFL_NO_X86 to skip flaky tests.\n+RUN cd /afl && unset CFLAGS && unset CXXFLAGS && \\\n+ export CC=clang && export AFL_NO_X86=1 && \\\n+ PYTHON_INCLUDE=/ make && make install && \\\n+ make -C utils/aflpp_driver && \\\n+ cp utils/aflpp_driver/libAFLDriver.a /\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/aflplusplus_um_random_12/description.md", "diff": "+# aflplusplus UM (random) - 12 hours\n+\n+Run aflplusplus over mutated code without UM prioritization. Randomly sample\n+list of generated mutants.\n+\n+NOTE: This only works with C or C++ benchmarks.\n+\n+[builder.Dockerfile](builder.Dockerfile)\n+[fuzzer.py](fuzzer.py)\n+[runner.Dockerfile](runner.Dockerfile)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/aflplusplus_um_random_12/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+# This optimized afl++ variant should always be run together with\n+# \"aflplusplus\" to show the difference - a default configured afl++ vs.\n+# a hand-crafted optimized one. afl++ is configured not to enable the good\n+# stuff by default to be as close to vanilla afl as possible.\n+# But this means that the good stuff is hidden away in this benchmark\n+# otherwise.\n+\n+import glob\n+import os\n+from pathlib import Path\n+import random\n+import shutil\n+import filecmp\n+from subprocess import CalledProcessError\n+import time\n+import signal\n+import math\n+from contextlib import contextmanager\n+\n+from fuzzers.aflplusplus import fuzzer as aflplusplus_fuzzer\n+from fuzzers import utils\n+\n+\n+class TimeoutException(Exception):\n+ \"\"\"\"Exception thrown when timeouts occur\"\"\"\n+\n+\n+TOTAL_FUZZING_TIME_DEFAULT = 82800 # 23 hours\n+TOTAL_BUILD_TIME = 43200 # 12 hours\n+FUZZ_PROP = 0.5\n+DEFAULT_MUTANT_TIMEOUT = 300\n+GRACE_TIME = 3600 # 1 hour in seconds\n+MAX_MUTANTS = 200000\n+\n+\n+@contextmanager\n+def time_limit(seconds):\n+ \"\"\"Method to define a time limit before throwing exception\"\"\"\n+\n+ def signal_handler(signum, frame):\n+ raise TimeoutException(\"Timed out!\")\n+\n+ signal.signal(signal.SIGALRM, signal_handler)\n+ signal.alarm(seconds)\n+ try:\n+ yield\n+ finally:\n+ signal.alarm(0)\n+\n+\n+def build(): # pylint: disable=too-many-locals,too-many-statements\n+ \"\"\"Build benchmark.\"\"\"\n+ start_time = time.time()\n+\n+ out = os.getenv(\"OUT\")\n+ src = os.getenv(\"SRC\")\n+ work = os.getenv(\"WORK\")\n+ storage_dir = \"/storage\"\n+ os.mkdir(storage_dir)\n+ mutate_dir = f\"{storage_dir}/mutant_files\"\n+ os.mkdir(mutate_dir)\n+ mutate_bins = f\"{storage_dir}/mutant_bins\"\n+ os.mkdir(mutate_bins)\n+ mutate_scripts = f\"{storage_dir}/mutant_scripts\"\n+ os.mkdir(mutate_scripts)\n+\n+ orig_fuzz_target = os.getenv(\"FUZZ_TARGET\")\n+ with utils.restore_directory(src), utils.restore_directory(work):\n+ aflplusplus_fuzzer.build()\n+ shutil.copy(f\"{out}/{orig_fuzz_target}\",\n+ f\"{mutate_bins}/{orig_fuzz_target}\")\n+ benchmark = os.getenv(\"BENCHMARK\")\n+\n+ source_extensions = [\".c\", \".cc\", \".cpp\"]\n+ # Use heuristic to try to find benchmark directory,\n+ # otherwise look for all files in the current directory.\n+ subdirs = [\n+ name for name in os.listdir(src)\n+ if os.path.isdir(os.path.join(src, name))\n+ ]\n+ benchmark_src_dir = src\n+ for directory in subdirs:\n+ if directory in benchmark:\n+ benchmark_src_dir = os.path.join(src, directory)\n+ break\n+\n+ source_files = []\n+ for extension in source_extensions:\n+ source_files += glob.glob(f\"{benchmark_src_dir}/**/*{extension}\",\n+ recursive=True)\n+ random.shuffle(source_files)\n+\n+ mutants = []\n+ for source_file in source_files:\n+ source_dir = os.path.dirname(source_file).split(src, 1)[1]\n+ Path(f\"{mutate_dir}/{source_dir}\").mkdir(parents=True, exist_ok=True)\n+ os.system(f\"mutate {source_file} --mutantDir \\\n+ {mutate_dir}/{source_dir} --noCheck > /dev/null\")\n+ source_base = os.path.basename(source_file).split(\".\")[0]\n+ mutants_glob = glob.glob(\n+ f\"{mutate_dir}/{source_dir}/{source_base}.mutant.*\")\n+ mutants += [\n+ f\"{source_dir}/{mutant.split('/')[-1]}\"[1:]\n+ for mutant in mutants_glob\n+ ]\n+\n+ if len(mutants) > MAX_MUTANTS:\n+ break\n+\n+ random.shuffle(mutants)\n+ with open(f\"{mutate_dir}/mutants.txt\", \"w\", encoding=\"utf-8\") as f_name:\n+ f_name.writelines(f\"{l}\\n\" for l in mutants)\n+\n+ curr_time = time.time()\n+\n+ # Add grace time for final build at end\n+ remaining_time = int(TOTAL_BUILD_TIME - (start_time - curr_time) -\n+ GRACE_TIME)\n+ with utils.restore_directory(src), utils.restore_directory(work):\n+ try:\n+ with time_limit(remaining_time):\n+ num_non_buggy = 1\n+ ind = 0\n+ while ind < len(mutants):\n+ with utils.restore_directory(src), utils.restore_directory(\n+ work):\n+ mutant = mutants[ind]\n+ suffix = \".\" + mutant.split(\".\")[-1]\n+ mpart = \".mutant.\" + mutant.split(\".mutant.\")[1]\n+ source_file = f\"{src}/{mutant.replace(mpart, suffix)}\"\n+ print(source_file)\n+ print(f\"{mutate_dir}/{mutant}\")\n+ os.system(f\"cp {source_file} {mutate_dir}/orig\")\n+ os.system(f\"cp {mutate_dir}/{mutant} {source_file}\")\n+\n+ try:\n+ new_fuzz_target = f\"{os.getenv('FUZZ_TARGET')}\"\\\n+ f\".{num_non_buggy}\"\n+\n+ os.system(f\"rm -rf {out}/*\")\n+ aflplusplus_fuzzer.build()\n+ if not filecmp.cmp(\n+ f'{mutate_bins}/{orig_fuzz_target}',\n+ f'{out}/{orig_fuzz_target}',\n+ shallow=False):\n+ print(f\"{out}/{orig_fuzz_target}\",\n+ f\"{mutate_bins}/{new_fuzz_target}\")\n+ shutil.copy(f\"{out}/{orig_fuzz_target}\",\n+ f\"{mutate_bins}/{new_fuzz_target}\")\n+ num_non_buggy += 1\n+ else:\n+ print(\"EQUAL\")\n+ except RuntimeError:\n+ pass\n+ except CalledProcessError:\n+ pass\n+ os.system(f\"cp {mutate_dir}/orig {source_file}\")\n+ ind += 1\n+ except TimeoutException:\n+ pass\n+\n+ os.system(f\"rm -rf {out}/*\")\n+ aflplusplus_fuzzer.build()\n+ os.system(f\"cp {mutate_bins}/* {out}/\")\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\"\"\"\n+ total_fuzzing_time = int(\n+ os.getenv('MAX_TOTAL_TIME', str(TOTAL_FUZZING_TIME_DEFAULT)))\n+ total_mutant_time = int(FUZZ_PROP * total_fuzzing_time)\n+\n+ mutants = glob.glob(f\"{target_binary}.*\")\n+ random.shuffle(mutants)\n+ timeout = max(DEFAULT_MUTANT_TIMEOUT,\n+ int(total_mutant_time / max(len(mutants), 1)))\n+ num_mutants = min(math.ceil(total_mutant_time / timeout), len(mutants))\n+\n+ input_corpus_dir = \"/storage/input_corpus\"\n+ os.makedirs(input_corpus_dir, exist_ok=True)\n+ os.environ['AFL_SKIP_CRASHES'] = \"1\"\n+\n+ for mutant in mutants[:num_mutants]:\n+ os.system(f\"cp -r {input_corpus_dir}/* {input_corpus}/*\")\n+ with utils.restore_directory(input_corpus), utils.restore_directory(\n+ output_corpus):\n+ try:\n+ with time_limit(timeout):\n+ aflplusplus_fuzzer.fuzz(input_corpus, output_corpus, mutant)\n+ except TimeoutException:\n+ pass\n+ except CalledProcessError:\n+ pass\n+ os.system(f\"cp -r {output_corpus}/* {input_corpus_dir}/*\")\n+\n+ os.system(f\"cp -r {input_corpus_dir}/* {input_corpus}/*\")\n+ aflplusplus_fuzzer.fuzz(input_corpus, output_corpus, target_binary)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/aflplusplus_um_random_12/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-image\n+\n+# This makes interactive docker runs painless:\n+ENV LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:/out\"\n+#ENV AFL_MAP_SIZE=2621440\n+ENV PATH=\"$PATH:/out\"\n+ENV AFL_SKIP_CPUFREQ=1\n+ENV AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1\n+ENV AFL_TESTCACHE_SIZE=2\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/aflplusplus_um_random_6/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\n+FROM $parent_image\n+\n+RUN apt-get update && apt-get install -y python3\n+RUN pip3 install --upgrade --force pip\n+RUN pip install universalmutator\n+\n+# Install libstdc++ to use llvm_mode.\n+RUN apt-get update && \\\n+ apt-get install -y wget libstdc++-5-dev libtool-bin automake flex bison \\\n+ libglib2.0-dev libpixman-1-dev python3-setuptools unzip \\\n+ apt-utils apt-transport-https ca-certificates\n+\n+# Download and compile afl++.\n+RUN git clone https://github.com/AFLplusplus/AFLplusplus.git /afl && \\\n+ cd /afl && \\\n+ git checkout b847e0f414e7b310e1a68bc501d4e2453bfce70e\n+\n+# Build without Python support as we don't need it.\n+# Set AFL_NO_X86 to skip flaky tests.\n+RUN cd /afl && unset CFLAGS && unset CXXFLAGS && \\\n+ export CC=clang && export AFL_NO_X86=1 && \\\n+ PYTHON_INCLUDE=/ make && make install && \\\n+ make -C utils/aflpp_driver && \\\n+ cp utils/aflpp_driver/libAFLDriver.a /\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/aflplusplus_um_random_6/description.md", "diff": "+# aflplusplus UM (random) - 6 hours\n+\n+Run aflplusplus over mutated code without UM prioritization. Randomly sample\n+list of generated mutants.\n+\n+NOTE: This only works with C or C++ benchmarks.\n+\n+[builder.Dockerfile](builder.Dockerfile)\n+[fuzzer.py](fuzzer.py)\n+[runner.Dockerfile](runner.Dockerfile)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/aflplusplus_um_random_6/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+# This optimized afl++ variant should always be run together with\n+# \"aflplusplus\" to show the difference - a default configured afl++ vs.\n+# a hand-crafted optimized one. afl++ is configured not to enable the good\n+# stuff by default to be as close to vanilla afl as possible.\n+# But this means that the good stuff is hidden away in this benchmark\n+# otherwise.\n+\n+import glob\n+import os\n+from pathlib import Path\n+import random\n+import shutil\n+import filecmp\n+from subprocess import CalledProcessError\n+import time\n+import signal\n+import math\n+from contextlib import contextmanager\n+\n+from fuzzers.aflplusplus import fuzzer as aflplusplus_fuzzer\n+from fuzzers import utils\n+\n+\n+class TimeoutException(Exception):\n+ \"\"\"\"Exception thrown when timeouts occur\"\"\"\n+\n+\n+TOTAL_FUZZING_TIME_DEFAULT = 82800 # 23 hours\n+TOTAL_BUILD_TIME = 21600 # 6 hours\n+FUZZ_PROP = 0.5\n+DEFAULT_MUTANT_TIMEOUT = 300\n+GRACE_TIME = 3600 # 1 hour in seconds\n+MAX_MUTANTS = 200000\n+\n+\n+@contextmanager\n+def time_limit(seconds):\n+ \"\"\"Method to define a time limit before throwing exception\"\"\"\n+\n+ def signal_handler(signum, frame):\n+ raise TimeoutException(\"Timed out!\")\n+\n+ signal.signal(signal.SIGALRM, signal_handler)\n+ signal.alarm(seconds)\n+ try:\n+ yield\n+ finally:\n+ signal.alarm(0)\n+\n+\n+def build(): # pylint: disable=too-many-locals,too-many-statements\n+ \"\"\"Build benchmark.\"\"\"\n+ start_time = time.time()\n+\n+ out = os.getenv(\"OUT\")\n+ src = os.getenv(\"SRC\")\n+ work = os.getenv(\"WORK\")\n+ storage_dir = \"/storage\"\n+ os.mkdir(storage_dir)\n+ mutate_dir = f\"{storage_dir}/mutant_files\"\n+ os.mkdir(mutate_dir)\n+ mutate_bins = f\"{storage_dir}/mutant_bins\"\n+ os.mkdir(mutate_bins)\n+ mutate_scripts = f\"{storage_dir}/mutant_scripts\"\n+ os.mkdir(mutate_scripts)\n+\n+ orig_fuzz_target = os.getenv(\"FUZZ_TARGET\")\n+ with utils.restore_directory(src), utils.restore_directory(work):\n+ aflplusplus_fuzzer.build()\n+ shutil.copy(f\"{out}/{orig_fuzz_target}\",\n+ f\"{mutate_bins}/{orig_fuzz_target}\")\n+ benchmark = os.getenv(\"BENCHMARK\")\n+\n+ source_extensions = [\".c\", \".cc\", \".cpp\"]\n+ # Use heuristic to try to find benchmark directory,\n+ # otherwise look for all files in the current directory.\n+ subdirs = [\n+ name for name in os.listdir(src)\n+ if os.path.isdir(os.path.join(src, name))\n+ ]\n+ benchmark_src_dir = src\n+ for directory in subdirs:\n+ if directory in benchmark:\n+ benchmark_src_dir = os.path.join(src, directory)\n+ break\n+\n+ source_files = []\n+ for extension in source_extensions:\n+ source_files += glob.glob(f\"{benchmark_src_dir}/**/*{extension}\",\n+ recursive=True)\n+ random.shuffle(source_files)\n+\n+ mutants = []\n+ for source_file in source_files:\n+ source_dir = os.path.dirname(source_file).split(src, 1)[1]\n+ Path(f\"{mutate_dir}/{source_dir}\").mkdir(parents=True, exist_ok=True)\n+ os.system(f\"mutate {source_file} --mutantDir \\\n+ {mutate_dir}/{source_dir} --noCheck > /dev/null\")\n+ source_base = os.path.basename(source_file).split(\".\")[0]\n+ mutants_glob = glob.glob(\n+ f\"{mutate_dir}/{source_dir}/{source_base}.mutant.*\")\n+ mutants += [\n+ f\"{source_dir}/{mutant.split('/')[-1]}\"[1:]\n+ for mutant in mutants_glob\n+ ]\n+\n+ if len(mutants) > MAX_MUTANTS:\n+ break\n+\n+ random.shuffle(mutants)\n+ with open(f\"{mutate_dir}/mutants.txt\", \"w\", encoding=\"utf-8\") as f_name:\n+ f_name.writelines(f\"{l}\\n\" for l in mutants)\n+\n+ curr_time = time.time()\n+\n+ # Add grace time for final build at end\n+ remaining_time = int(TOTAL_BUILD_TIME - (start_time - curr_time) -\n+ GRACE_TIME)\n+ with utils.restore_directory(src), utils.restore_directory(work):\n+ try:\n+ with time_limit(remaining_time):\n+ num_non_buggy = 1\n+ ind = 0\n+ while ind < len(mutants):\n+ with utils.restore_directory(src), utils.restore_directory(\n+ work):\n+ mutant = mutants[ind]\n+ suffix = \".\" + mutant.split(\".\")[-1]\n+ mpart = \".mutant.\" + mutant.split(\".mutant.\")[1]\n+ source_file = f\"{src}/{mutant.replace(mpart, suffix)}\"\n+ print(source_file)\n+ print(f\"{mutate_dir}/{mutant}\")\n+ os.system(f\"cp {source_file} {mutate_dir}/orig\")\n+ os.system(f\"cp {mutate_dir}/{mutant} {source_file}\")\n+\n+ try:\n+ new_fuzz_target = f\"{os.getenv('FUZZ_TARGET')}\"\\\n+ f\".{num_non_buggy}\"\n+\n+ os.system(f\"rm -rf {out}/*\")\n+ aflplusplus_fuzzer.build()\n+ if not filecmp.cmp(\n+ f'{mutate_bins}/{orig_fuzz_target}',\n+ f'{out}/{orig_fuzz_target}',\n+ shallow=False):\n+ print(f\"{out}/{orig_fuzz_target}\",\n+ f\"{mutate_bins}/{new_fuzz_target}\")\n+ shutil.copy(f\"{out}/{orig_fuzz_target}\",\n+ f\"{mutate_bins}/{new_fuzz_target}\")\n+ num_non_buggy += 1\n+ else:\n+ print(\"EQUAL\")\n+ except RuntimeError:\n+ pass\n+ except CalledProcessError:\n+ pass\n+ os.system(f\"cp {mutate_dir}/orig {source_file}\")\n+ ind += 1\n+ except TimeoutException:\n+ pass\n+\n+ os.system(f\"rm -rf {out}/*\")\n+ aflplusplus_fuzzer.build()\n+ os.system(f\"cp {mutate_bins}/* {out}/\")\n+\n+\n+def fuzz(input_corpus, output_corpus, target_binary):\n+ \"\"\"Run fuzzer.\"\"\"\n+ total_fuzzing_time = int(\n+ os.getenv('MAX_TOTAL_TIME', str(TOTAL_FUZZING_TIME_DEFAULT)))\n+ total_mutant_time = int(FUZZ_PROP * total_fuzzing_time)\n+\n+ mutants = glob.glob(f\"{target_binary}.*\")\n+ random.shuffle(mutants)\n+ timeout = max(DEFAULT_MUTANT_TIMEOUT,\n+ int(total_mutant_time / max(len(mutants), 1)))\n+ num_mutants = min(math.ceil(total_mutant_time / timeout), len(mutants))\n+\n+ input_corpus_dir = \"/storage/input_corpus\"\n+ os.makedirs(input_corpus_dir, exist_ok=True)\n+ os.environ['AFL_SKIP_CRASHES'] = \"1\"\n+\n+ for mutant in mutants[:num_mutants]:\n+ os.system(f\"cp -r {input_corpus_dir}/* {input_corpus}/*\")\n+ with utils.restore_directory(input_corpus), utils.restore_directory(\n+ output_corpus):\n+ try:\n+ with time_limit(timeout):\n+ aflplusplus_fuzzer.fuzz(input_corpus, output_corpus, mutant)\n+ except TimeoutException:\n+ pass\n+ except CalledProcessError:\n+ pass\n+ os.system(f\"cp -r {output_corpus}/* {input_corpus_dir}/*\")\n+\n+ os.system(f\"cp -r {input_corpus_dir}/* {input_corpus}/*\")\n+ aflplusplus_fuzzer.fuzz(input_corpus, output_corpus, target_binary)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "fuzzers/aflplusplus_um_random_6/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-image\n+\n+# This makes interactive docker runs painless:\n+ENV LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:/out\"\n+#ENV AFL_MAP_SIZE=2621440\n+ENV PATH=\"$PATH:/out\"\n+ENV AFL_SKIP_CPUFREQ=1\n+ENV AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1\n+ENV AFL_TESTCACHE_SIZE=2\n" }, { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-10-04-um-6-12\n+ description: \"UM fuzzer experiment\"\n+ fuzzers:\n+ - aflplusplus\n+ - aflplusplus_um_random_6\n+ - aflplusplus_um_random_12\n+\n- experiment: 2022-10-04-um\ndescription: \"UM fuzzer experiment\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Adding 6/12 hour builds for UM fuzzers (#1513) Add 6/12 hour versions of aflplusplus_um_random fuzzer. Co-authored-by: jonathanmetzman <[email protected]>
258,380
06.10.2022 11:46:26
14,400
36029fa4a5de92fcf08c559a837c5bb0c30e4134
Add large experiment for all UM fuzzers Adding new experiment for all UM fuzzers
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-10-06-um-full\n+ description: \"UM fuzzer experiment\"\n+ fuzzers:\n+ - aflplusplus\n+ - aflplusplus_um_parallel\n+ - aflplusplus\n+ - libfuzzer_um_prioritize\n+ - libfuzzer_um_random\n+ - libfuzzer_um_parallel\n+ - libfuzzer\n+ - afl_um_prioritize\n+ - afl_um_random\n+ - afl_um_parallel\n+ - afl\n+ - eclipser_um_prioritize\n+ - eclipser_um_random\n+ - eclipser_um_parallel\n+ - eclipser\n+ - honggfuzz_um_prioritize\n+ - honggfuzz_um_random\n+ - honggfuzz_um_parallel\n+ - honggfuzz\n+\n- experiment: 2022-10-05-um-3\ndescription: \"UM fuzzer experiment\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Add large experiment for all UM fuzzers (#1516) Adding new experiment for all UM fuzzers Co-authored-by: jonathanmetzman <[email protected]>
258,380
12.10.2022 00:07:28
14,400
51f17f8f84bfc4cdce53a105d7d6532690defc45
Run UM only for failing benchmarks New experiment to run UM fuzzers for only failing benchmarks.
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-10-11-um-3\n+ description: \"UM fuzzer experiment\"\n+ fuzzers:\n+ - aflplusplus\n+ - aflplusplus_um_random_3\n+ benchmarks:\n+ - bloaty_fuzz_target\n+ - curl_curl_fuzzer_http\n+ - harfbuzz-1.3.2\n+ - lcms-2017-03-21\n+ - libjpeg-turbo-07-2017\n+ - mbedtls_fuzz_dtlsclient\n+ - openthread-2019-12-23\n+ - proj4-2017-08-14\n+ - re2-2014-12-09\n+ - sqlite3_ossfuzz\n+ - vorbis-2017-12-11\n+ - zlib_zlib_uncompress_fuzzer\n+\n- experiment: 2022-10-07-um-3b\ndescription: \"UM fuzzer experiment\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Run UM only for failing benchmarks (#1520) New experiment to run UM fuzzers for only failing benchmarks. Co-authored-by: jonathanmetzman <[email protected]>
258,397
12.10.2022 22:32:53
-19,080
bb0e6327bdaec5176c7074e5abf738c4ec3ee0cc
Update README.md Image Border In readme.md file * For better looking in dark mode
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -23,8 +23,13 @@ your fuzzer and generate a report comparing your fuzzer to others.\nSee [a sample report](https://www.fuzzbench.com/reports/sample/index.html).\n## Overview\n+<kbd>\n+\n![FuzzBench Service diagram](docs/images/FuzzBench-service.png)\n+</kbd>\n+\n+\n## Sample Report\nYou can view our sample report\n" } ]
Python
Apache License 2.0
google/fuzzbench
Update README.md (#1519) Image Border In readme.md file * For better looking in dark mode
258,388
13.10.2022 11:21:00
14,400
97e17b1638faa0b361093b3c79906ad168c7f5b7
[build] improve debugging
[ { "change_type": "MODIFY", "old_path": "experiment/build/gcb_build.py", "new_path": "experiment/build/gcb_build.py", "diff": "@@ -48,7 +48,10 @@ def build_base_images():\nimage_templates = {\nimage: buildable_images[image] for image in ['base-image', 'worker']\n}\n- config = generate_cloudbuild.create_cloudbuild_spec(image_templates,\n+ config = generate_cloudbuild.create_cloudbuild_spec(\n+ image_templates,\n+ benchmark='no-benchmark',\n+ fuzzer='no-fuzzer',\nbuild_base_images=True)\n_build(config, 'base-images')\n@@ -63,7 +66,8 @@ def build_coverage(benchmark):\nimage_specs['type'] == 'coverage')\n}\nconfig = generate_cloudbuild.create_cloudbuild_spec(image_templates,\n- benchmark=benchmark)\n+ benchmark=benchmark,\n+ fuzzer='coverage')\nconfig_name = 'benchmark-{benchmark}-coverage'.format(benchmark=benchmark)\n_build(config, config_name)\n@@ -117,8 +121,9 @@ def build_fuzzer_benchmark(fuzzer: str, benchmark: str):\nif image_specs['type'] in ('base', 'coverage', 'dispatcher'):\ncontinue\nimage_templates[image_name] = image_specs\n- config = generate_cloudbuild.create_cloudbuild_spec(image_templates)\nconfig_name = 'benchmark-{benchmark}-fuzzer-{fuzzer}'.format(\nbenchmark=benchmark, fuzzer=fuzzer)\n-\n+ config = generate_cloudbuild.create_cloudbuild_spec(image_templates,\n+ benchmark=benchmark,\n+ fuzzer=fuzzer)\n_build(config, config_name)\n" }, { "change_type": "MODIFY", "old_path": "experiment/build/generate_cloudbuild.py", "new_path": "experiment/build/generate_cloudbuild.py", "diff": "@@ -22,7 +22,7 @@ from common import yaml_utils\nfrom common.utils import ROOT_DIR\nfrom experiment.build import build_utils\n-DOCKER_IMAGE = 'docker:19.03.12'\n+DOCKER_IMAGE = 'gcr.io/cloud-builders/docker'\nSTANDARD_DOCKER_REGISTRY = 'gcr.io/fuzzbench'\n@@ -118,8 +118,10 @@ def get_docker_registry():\ndef create_cloudbuild_spec(image_templates,\n- benchmark='',\n- build_base_images=False):\n+ benchmark,\n+ fuzzer,\n+ build_base_images=False,\n+ cloudbuild_tag=None):\n\"\"\"Generates Cloud Build specification.\nArgs:\n@@ -131,6 +133,8 @@ def create_cloudbuild_spec(image_templates,\nGCB build steps.\n\"\"\"\ncloudbuild_spec = {'steps': [], 'images': []}\n+ if cloudbuild_tag is not None:\n+ cloudbuild_spec['tags'] = [f'fuzzer-{fuzzer}', f'benchmark-{benchmark}']\n# Workaround for bug https://github.com/moby/moby/issues/40262.\n# This is only needed for base-image as it inherits from ubuntu:xenial.\n@@ -142,6 +146,14 @@ def create_cloudbuild_spec(image_templates,\n'args': ['pull', 'ubuntu:xenial'],\n})\n+ # TODO(metzman): Figure out how to do this to solve log length issue.\n+ # cloudbuild_spec['steps'].append({\n+ # 'id': 'buildx-create',\n+ # 'name': DOCKER_IMAGE,\n+ # 'args': ['buildx', 'create', '--use', 'buildxbuilder', '--driver-opt',\n+ # 'env.BUILDKIT_STEP_LOG_MAX_SIZE=500000000']\n+ # })\n+\nfor image_name, image_specs in image_templates.items():\nstep = {\n'id': image_name,\n@@ -149,12 +161,17 @@ def create_cloudbuild_spec(image_templates,\n'name': DOCKER_IMAGE,\n}\nstep['args'] = [\n- 'build', '--tag',\n- _get_experiment_image_tag(image_specs), '--tag',\n- _get_gcb_image_tag(image_specs), '--tag',\n- _get_cachable_image_tag(image_specs), '--cache-from',\n- _get_cachable_image_tag(image_specs), '--build-arg',\n- 'BUILDKIT_INLINE_CACHE=1'\n+ 'build',\n+ '--tag',\n+ _get_experiment_image_tag(image_specs),\n+ '--tag',\n+ _get_gcb_image_tag(image_specs),\n+ '--tag',\n+ _get_cachable_image_tag(image_specs),\n+ '--cache-from',\n+ _get_cachable_image_tag(image_specs),\n+ '--build-arg',\n+ 'BUILDKIT_INLINE_CACHE=1',\n]\nfor build_arg in image_specs.get('build_arg', []):\nstep['args'] += ['--build-arg', build_arg]\n@@ -186,7 +203,10 @@ def main():\nimage_templates = yaml_utils.read(\nos.path.join(ROOT_DIR, 'docker', 'image_types.yaml'))\nbase_images_spec = create_cloudbuild_spec(\n- {'base-image': image_templates['base-image']}, build_base_images=True)\n+ {'base-image': image_templates['base-image']},\n+ build_base_images=True,\n+ benchmark='no-benchmark',\n+ fuzzer='no-fuzzer')\nbase_images_spec_file = os.path.join(ROOT_DIR, 'docker', 'gcb',\n'base-images.yaml')\nyaml_utils.write(base_images_spec_file, base_images_spec)\n" }, { "change_type": "MODIFY", "old_path": "experiment/build/test_generate_cloudbuild.py", "new_path": "experiment/build/test_generate_cloudbuild.py", "diff": "@@ -30,18 +30,21 @@ def test_generate_cloudbuild_spec_build_base_image(experiment):\n}\n}\ngenerated_spec = generate_cloudbuild.create_cloudbuild_spec(\n- image_templates, build_base_images=True)\n+ image_templates,\n+ benchmark='no-benchmark',\n+ fuzzer='no-fuzzer',\n+ build_base_images=True)\nexpected_spec = {\n'steps': [{\n'id': 'pull-ubuntu-xenial',\n'env': ['DOCKER_BUILDKIT=1'],\n- 'name': 'docker:19.03.12',\n+ 'name': 'gcr.io/cloud-builders/docker',\n'args': ['pull', 'ubuntu:xenial']\n}, {\n'id': 'base-image',\n'env': ['DOCKER_BUILDKIT=1'],\n- 'name': 'docker:19.03.12',\n+ 'name': 'gcr.io/cloud-builders/docker',\n'args': [\n'build', '--tag', 'gcr.io/fuzzbench/base-image:test-experiment',\n'--tag', 'gcr.io/fuzzbench/base-image', '--tag',\n@@ -75,18 +78,21 @@ def test_generate_cloudbuild_spec_other_registry(experiment):\n}\n}\ngenerated_spec = generate_cloudbuild.create_cloudbuild_spec(\n- image_templates, build_base_images=True)\n+ image_templates,\n+ benchmark='no-benchmark',\n+ fuzzer='no-fuzzer',\n+ build_base_images=True)\nexpected_spec = {\n'steps': [{\n'id': 'pull-ubuntu-xenial',\n'env': ['DOCKER_BUILDKIT=1'],\n- 'name': 'docker:19.03.12',\n+ 'name': 'gcr.io/cloud-builders/docker',\n'args': ['pull', 'ubuntu:xenial']\n}, {\n'id': 'base-image',\n'env': ['DOCKER_BUILDKIT=1'],\n- 'name': 'docker:19.03.12',\n+ 'name': 'gcr.io/cloud-builders/docker',\n'args': [\n'build', '--tag', 'gcr.io/not-fuzzbench/base-image'\n':test-experiment', '--tag', 'gcr.io/fuzzbench/base-image',\n@@ -122,13 +128,17 @@ def test_generate_cloudbuild_spec_build_fuzzer_benchmark(experiment):\n}\n}\n- generated_spec = generate_cloudbuild.create_cloudbuild_spec(image_templates)\n+ generated_spec = generate_cloudbuild.create_cloudbuild_spec(\n+ image_templates,\n+ benchmark='no-benchmark',\n+ fuzzer='no-fuzzer',\n+ )\nexpected_spec = {\n'steps': [{\n'id': 'afl-zlib-builder-intermediate',\n'env': ['DOCKER_BUILDKIT=1'],\n- 'name': 'docker:19.03.12',\n+ 'name': 'gcr.io/cloud-builders/docker',\n'args': [\n'build', '--tag',\n'gcr.io/fuzzbench/builders/afl/zlib-intermediate'\n@@ -186,13 +196,13 @@ def test_generate_cloudbuild_spec_build_benchmark_coverage(experiment):\n}\ngenerated_spec = generate_cloudbuild.create_cloudbuild_spec(\n- image_templates, benchmark='zlib')\n+ image_templates, benchmark='zlib', fuzzer='no-fuzzer')\nexpected_spec = {\n'steps': [{\n'id': 'zlib-project-builder',\n'env': ['DOCKER_BUILDKIT=1'],\n- 'name': 'docker:19.03.12',\n+ 'name': 'gcr.io/cloud-builders/docker',\n'args': [\n'build', '--tag',\n'gcr.io/fuzzbench/builders/benchmark/zlib:test-experiment',\n@@ -206,7 +216,7 @@ def test_generate_cloudbuild_spec_build_benchmark_coverage(experiment):\n}, {\n'id': 'coverage-zlib-builder-intermediate',\n'env': ['DOCKER_BUILDKIT=1'],\n- 'name': 'docker:19.03.12',\n+ 'name': 'gcr.io/cloud-builders/docker',\n'args': [\n'build', '--tag',\n'gcr.io/fuzzbench/builders/coverage/zlib-intermediate:'\n@@ -224,7 +234,7 @@ def test_generate_cloudbuild_spec_build_benchmark_coverage(experiment):\n}, {\n'id': 'coverage-zlib-builder',\n'env': ['DOCKER_BUILDKIT=1'],\n- 'name': 'docker:19.03.12',\n+ 'name': 'gcr.io/cloud-builders/docker',\n'args': [\n'build', '--tag',\n'gcr.io/fuzzbench/builders/coverage/zlib:test-experiment',\n@@ -240,7 +250,7 @@ def test_generate_cloudbuild_spec_build_benchmark_coverage(experiment):\n'wait_for': ['coverage-zlib-builder-intermediate']\n}, {\n'name':\n- 'docker:19.03.12',\n+ 'gcr.io/cloud-builders/docker',\n'args': [\n'run', '-v', '/workspace/out:/host-out',\n'gcr.io/fuzzbench/builders/coverage/zlib:test-experiment',\n" } ]
Python
Apache License 2.0
google/fuzzbench
[build] improve debugging (#1511) Co-authored-by: Alan32Liu <[email protected]>
258,388
13.10.2022 14:41:23
14,400
906023a4f5e902285b8ad3255e18d5f7df118fde
Use private buildpools for build
[ { "change_type": "MODIFY", "old_path": "experiment/build/builder.py", "new_path": "experiment/build/builder.py", "diff": "import argparse\nimport itertools\n+import multiprocessing\nfrom multiprocessing import pool as mp_pool\nimport os\nimport random\n@@ -40,10 +41,8 @@ if not experiment_utils.is_local_experiment():\nelse:\nimport experiment.build.local_build as buildlib\n-# FIXME: Use 10 as default quota.\n-# Even though it says queueing happen, we end up exceeding limits on \"get\", so\n-# be conservative. Use 30 for now since this is limit for FuzzBench service.\n-DEFAULT_MAX_CONCURRENT_BUILDS = 30\n+DEFAULT_MAX_CONCURRENT_BUILDS = max(min(2 * multiprocessing.cpu_count(), 150),\n+ 30)\n# Build attempts and wait interval.\nNUM_BUILD_ATTEMPTS = 3\n" }, { "change_type": "MODIFY", "old_path": "experiment/build/gcb_build.py", "new_path": "experiment/build/gcb_build.py", "diff": "@@ -30,10 +30,9 @@ CONFIG_DIR = 'config'\n# Maximum time to wait for a GCB config to finish build.\nGCB_BUILD_TIMEOUT = 13 * 60 * 60 # 4 hours.\n-# High cpu and memory configuration, matches OSS-Fuzz.\n-GCB_MACHINE_TYPE = 'n1-highcpu-32'\n-\n-DISK_SIZE = '200GB'\n+# TODO(metzman): Make configurable.\n+WORKER_POOL_NAME = (\n+ 'projects/fuzzbench/locations/us-central1/workerPools/buildpool')\nlogger = logs.Logger('builder') # pylint: disable=invalid-name\n@@ -82,11 +81,10 @@ def _build(\nlogger.debug('Using build configuration: %s' % config)\nconfig_arg = '--config=%s' % config_file.name\n- machine_type_arg = '--machine-type=%s' % GCB_MACHINE_TYPE\n- disk_size_arg = '--disk-size=%s' % DISK_SIZE\n# Use \"s\" suffix to denote seconds.\ntimeout_arg = '--timeout=%ds' % timeout_seconds\n+ worker_pool_arg = f'--worker-pool={WORKER_POOL_NAME}'\ncommand = [\n'gcloud',\n@@ -95,8 +93,7 @@ def _build(\nstr(utils.ROOT_DIR),\nconfig_arg,\ntimeout_arg,\n- machine_type_arg,\n- disk_size_arg,\n+ worker_pool_arg,\n]\n# Don't write to stdout to make concurrent building faster. Otherwise\n@@ -109,6 +106,7 @@ def _build(\n# TODO(metzman): Refactor code so that local_build stores logs as well.\nbuild_utils.store_build_logs(config_name, result)\nif result.retcode != 0:\n+ logs.error('%s resulted in %s.', command, result)\nraise subprocess.CalledProcessError(result.retcode, command)\nreturn result\n" } ]
Python
Apache License 2.0
google/fuzzbench
Use private buildpools for build (#1523)
258,388
20.10.2022 16:37:10
14,400
53b37d364556106e8c54e6b7925ac8296599f69d
Fix curl_curl_fuzzer_http benchmark. Fixes
[ { "change_type": "MODIFY", "old_path": "benchmarks/curl_curl_fuzzer_http/Dockerfile", "new_path": "benchmarks/curl_curl_fuzzer_http/Dockerfile", "diff": "@@ -19,7 +19,7 @@ FROM gcr.io/oss-fuzz-base/base-builder@sha256:1b6a6993690fa947df74ceabbf6a1f89a4\n# Curl will be checked out to the commit hash specified in benchmark.yaml.\nRUN git clone --depth 1 https://github.com/curl/curl.git /src/curl\nRUN git clone https://github.com/curl/curl-fuzzer /src/curl_fuzzer\n-RUN git -C /src/curl_fuzzer checkout 543b9926cc322a18ad30945dc55d78dbbfa679e1\n+RUN git -C /src/curl_fuzzer checkout dd486c1e5910e722e43c451d4de928ac80f5967d\n# Use curl-fuzzer's scripts to get latest dependencies.\nRUN $SRC/curl_fuzzer/scripts/ossfuzzdeps.sh\n" }, { "change_type": "MODIFY", "old_path": "benchmarks/curl_curl_fuzzer_http/benchmark.yaml", "new_path": "benchmarks/curl_curl_fuzzer_http/benchmark.yaml", "diff": "# See the License for the specific language governing permissions and\n# limitations under the License.\n-commit: 376d5bb323c03c0fc4af266c03abac8f067fbd0e\n-commit_date: 2020-07-26 21:48:36+00:00\n+commit: a20f74a16ae1e89be170eeaa6059b37e513392a4\n+commit_date: 2022-10-20T09:10:15+00:00\nfuzz_target: curl_fuzzer_http\nproject: curl\nunsupported_fuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix curl_curl_fuzzer_http benchmark. (#1534) Fixes #1528
258,388
24.10.2022 14:07:07
14,400
5624dfea608c1ff55a11f82ac8f724877b7c85fa
[curl] mess up cache to fix
[ { "change_type": "MODIFY", "old_path": "benchmarks/curl_curl_fuzzer_http/Dockerfile", "new_path": "benchmarks/curl_curl_fuzzer_http/Dockerfile", "diff": "FROM gcr.io/oss-fuzz-base/base-builder@sha256:1b6a6993690fa947df74ceabbf6a1f89a46d7e4277492addcd45a8525e34be5a\n# Curl will be checked out to the commit hash specified in benchmark.yaml.\n-RUN git clone --depth 1 https://github.com/curl/curl.git /src/curl\nRUN git clone https://github.com/curl/curl-fuzzer /src/curl_fuzzer\nRUN git -C /src/curl_fuzzer checkout dd486c1e5910e722e43c451d4de928ac80f5967d\n+RUN git clone --depth 1 https://github.com/curl/curl.git /src/curl\n# Use curl-fuzzer's scripts to get latest dependencies.\nRUN $SRC/curl_fuzzer/scripts/ossfuzzdeps.sh\n" } ]
Python
Apache License 2.0
google/fuzzbench
[curl] mess up cache to fix #1528 (#1536)
258,388
25.10.2022 10:13:58
14,400
da05da0dcb3680deee9d894d1bfa61edbbf4a90c
Remove a bunch of fuzzers from CI testing
[ { "change_type": "MODIFY", "old_path": ".github/workflows/fuzzers.yml", "new_path": ".github/workflows/fuzzers.yml", "diff": "@@ -95,20 +95,6 @@ jobs:\n- afl_random_favored\n- entropic_execute_final\n- libfuzzer_exeute_final\n- - afl_no_favored\n- - afl_collision_free\n- - afl_double_timeout\n- - afl_no_favfactor\n- - afl_no_trim\n- - afl_scheduling_lifo\n- - afl_scheduling_random\n- - afl_score_max\n- - afl_score_min\n- - afl_score_no_novel_prioritization\n- - afl_score_random\n- - afl_splicing_mutation\n- - afl_virginmap\n- - afl_maxmap\n- introspector_driven_focus\n- libfuzzer_fork_parallel\n- centipede_function_filter\n" } ]
Python
Apache License 2.0
google/fuzzbench
Remove a bunch of fuzzers from CI testing (#1537)
258,402
01.11.2022 14:16:50
-39,600
2ee25c513299c859b95a32a6ff9c8d8b24f9ee62
More configurable builds Address 1. Make the worker pool configurable; 2. Make the number of concurrent builds configurable.
[ { "change_type": "MODIFY", "old_path": "experiment/build/builder.py", "new_path": "experiment/build/builder.py", "diff": "import argparse\nimport itertools\n-import multiprocessing\nfrom multiprocessing import pool as mp_pool\nimport os\nimport random\n@@ -35,15 +34,13 @@ from common import utils\nfrom common import logs\nfrom experiment.build import build_utils\n+from experiment.run_experiment import DEFAULT_CONCURRENT_BUILDS\nif not experiment_utils.is_local_experiment():\nimport experiment.build.gcb_build as buildlib\nelse:\nimport experiment.build.local_build as buildlib\n-DEFAULT_MAX_CONCURRENT_BUILDS = max(min(2 * multiprocessing.cpu_count(), 150),\n- 30)\n-\n# Build attempts and wait interval.\nNUM_BUILD_ATTEMPTS = 3\nBUILD_FAIL_WAIT = 5 * 60\n@@ -109,17 +106,13 @@ def build_measurer(benchmark: str) -> bool:\nreturn False\n-def build_all_measurers(\n- benchmarks: List[str],\n- num_concurrent_builds: int = DEFAULT_MAX_CONCURRENT_BUILDS\n-) -> List[str]:\n+def build_all_measurers(benchmarks: List[str]) -> List[str]:\n\"\"\"Build measurers for each benchmark in |benchmarks| in parallel\nReturns a list of benchmarks built successfully.\"\"\"\nlogger.info('Building measurers.')\nfilesystem.recreate_directory(build_utils.get_coverage_binaries_dir())\nbuild_measurer_args = [(benchmark,) for benchmark in benchmarks]\n- successful_calls = retry_build_loop(build_measurer, build_measurer_args,\n- num_concurrent_builds)\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@@ -142,12 +135,12 @@ def split_successes_and_failures(inputs: List,\nreturn successes, failures\n-def retry_build_loop(build_func: Callable, inputs: List[Tuple],\n- num_concurrent_builds: int) -> List:\n+def retry_build_loop(build_func: Callable, inputs: List[Tuple]) -> List:\n\"\"\"Calls |build_func| in parallel on |inputs|. Repeat on failures up to\n|NUM_BUILD_ATTEMPTS| times. Returns the list of inputs that |build_func| was\ncalled successfully on.\"\"\"\nsuccesses = []\n+ num_concurrent_builds = os.getenv('CONCURRENT_BUILDS')\nlogs.info('Concurrent builds: %d.', num_concurrent_builds)\nwith mp_pool.ThreadPool(num_concurrent_builds) as pool:\nfor _ in range(NUM_BUILD_ATTEMPTS):\n@@ -185,11 +178,8 @@ def build_fuzzer_benchmark(fuzzer: str, benchmark: str) -> bool:\nreturn True\n-def build_all_fuzzer_benchmarks(\n- fuzzers: List[str],\n- benchmarks: List[str],\n- num_concurrent_builds: int = DEFAULT_MAX_CONCURRENT_BUILDS\n-) -> List[str]:\n+def build_all_fuzzer_benchmarks(fuzzers: List[str],\n+ benchmarks: List[str]) -> List[str]:\n\"\"\"Build fuzzer,benchmark images for all pairs of |fuzzers| and |benchmarks|\nin parallel. Returns a list of fuzzer,benchmark pairs that built\nsuccessfully.\"\"\"\n@@ -200,8 +190,7 @@ def build_all_fuzzer_benchmarks(\n# TODO(metzman): Use an asynchronous unordered map variant to schedule\n# eagerly.\nsuccessful_calls = retry_build_loop(build_fuzzer_benchmark,\n- build_fuzzer_benchmark_args,\n- num_concurrent_builds)\n+ build_fuzzer_benchmark_args)\nlogger.info('Done building fuzzer benchmarks.')\nreturn successful_calls\n@@ -222,20 +211,20 @@ def main():\nhelp='Fuzzer names.',\nnargs='+',\nrequired=True)\n-\nparser.add_argument('-n',\n'--num-concurrent-builds',\nhelp='Max concurrent builds allowed.',\ntype=int,\n- default=DEFAULT_MAX_CONCURRENT_BUILDS,\n+ default=DEFAULT_CONCURRENT_BUILDS,\nrequired=False)\nlogs.initialize()\nargs = parser.parse_args()\n-\n- build_all_fuzzer_benchmarks(args.fuzzers, args.benchmarks,\n+ os.environ['CONCURRENT_BUILDS'] = os.getenv('CONCURRENT_BUILDS',\nargs.num_concurrent_builds)\n+ build_all_fuzzer_benchmarks(args.fuzzers, args.benchmarks)\n+\nreturn 0\n" }, { "change_type": "MODIFY", "old_path": "experiment/build/gcb_build.py", "new_path": "experiment/build/gcb_build.py", "diff": "# limitations under the License.\n\"\"\"Module for building things on Google Cloud Build for use in trials.\"\"\"\n+import os\nimport subprocess\nimport tempfile\nfrom typing import Dict\n@@ -30,10 +31,6 @@ CONFIG_DIR = 'config'\n# Maximum time to wait for a GCB config to finish build.\nGCB_BUILD_TIMEOUT = 13 * 60 * 60 # 4 hours.\n-# TODO(metzman): Make configurable.\n-WORKER_POOL_NAME = (\n- 'projects/fuzzbench/locations/us-central1/workerPools/buildpool')\n-\nlogger = logs.Logger('builder') # pylint: disable=invalid-name\n@@ -81,10 +78,8 @@ def _build(\nlogger.debug('Using build configuration: %s' % config)\nconfig_arg = '--config=%s' % config_file.name\n-\n# Use \"s\" suffix to denote seconds.\ntimeout_arg = '--timeout=%ds' % timeout_seconds\n- worker_pool_arg = f'--worker-pool={WORKER_POOL_NAME}'\ncommand = [\n'gcloud',\n@@ -93,9 +88,13 @@ def _build(\nstr(utils.ROOT_DIR),\nconfig_arg,\ntimeout_arg,\n- worker_pool_arg,\n]\n+ worker_pool_name = os.getenv('WORKER_POOL_NAME')\n+ if worker_pool_name:\n+ worker_pool_arg = (f'--worker-pool={worker_pool_name}')\n+ command.append(worker_pool_arg)\n+\n# Don't write to stdout to make concurrent building faster. Otherwise\n# writing becomes the bottleneck.\nresult = new_process.execute(command,\n" }, { "change_type": "MODIFY", "old_path": "experiment/dispatcher.py", "new_path": "experiment/dispatcher.py", "diff": "@@ -89,7 +89,7 @@ def _initialize_trials_in_db(trials: List[models.Trial]):\ndb_utils.bulk_save(trials)\n-class Experiment: # pylint: disable=too-many-instance-attributes\n+class Experiment:\n\"\"\"Class representing an experiment.\"\"\"\ndef __init__(self, experiment_config_filepath: str):\n@@ -103,11 +103,9 @@ class Experiment: # pylint: disable=too-many-instance-attributes\nself.preemptible = self.config.get('preemptible_runners')\n-def build_images_for_trials(fuzzers: List[str],\n- benchmarks: List[str],\n+def build_images_for_trials(fuzzers: List[str], benchmarks: List[str],\nnum_trials: int,\n- preemptible: bool,\n- concurrent_builds=None) -> List[models.Trial]:\n+ preemptible: bool) -> List[models.Trial]:\n\"\"\"Builds the images needed to run |experiment| and returns a list of trials\nthat can be run for experiment. This is the number of trials specified in\nexperiment times each pair of fuzzer+benchmark that builds successfully.\"\"\"\n@@ -116,14 +114,8 @@ def build_images_for_trials(fuzzers: List[str],\nbuilder.build_base_images()\n# Only build fuzzers for benchmarks whose measurers built successfully.\n- if concurrent_builds is None:\nbenchmarks = builder.build_all_measurers(benchmarks)\n- build_successes = builder.build_all_fuzzer_benchmarks(\n- fuzzers, benchmarks)\n- else:\n- benchmarks = builder.build_all_measurers(benchmarks, concurrent_builds)\n- build_successes = builder.build_all_fuzzer_benchmarks(\n- fuzzers, benchmarks, concurrent_builds)\n+ build_successes = builder.build_all_fuzzer_benchmarks(fuzzers, benchmarks)\nexperiment_name = experiment_utils.get_experiment_name()\ntrials = []\nfor fuzzer, benchmark in build_successes:\n@@ -155,8 +147,7 @@ def dispatcher_main():\ntrials = build_images_for_trials(experiment.fuzzers, experiment.benchmarks,\nexperiment.num_trials,\n- experiment.preemptible,\n- experiment.config['concurrent_builds'])\n+ experiment.preemptible)\n_initialize_trials_in_db(trials)\ncreate_work_subdirs(['experiment-folders', 'measurement-folders'])\n" }, { "change_type": "MODIFY", "old_path": "experiment/resources/dispatcher-startup-script-template.sh", "new_path": "experiment/resources/dispatcher-startup-script-template.sh", "diff": "@@ -26,6 +26,8 @@ docker run --rm \\\n-e POSTGRES_PASSWORD={{postgres_password}} \\\n-e CLOUD_SQL_INSTANCE_CONNECTION_NAME={{cloud_sql_instance_connection_name}} \\\n-e DOCKER_REGISTRY={{docker_registry}} \\\n+ -e CONCURRENT_BUILDS={{concurrent_builds}} \\\n+ -e WORKER_POOL_NAME={{worker_pool_name}} \\\n--cap-add=SYS_PTRACE --cap-add=SYS_NICE \\\n-v /var/run/docker.sock:/var/run/docker.sock --name=dispatcher-container \\\n{{docker_registry}}/dispatcher-image /work/startup-dispatcher.sh\n" }, { "change_type": "MODIFY", "old_path": "experiment/run_experiment.py", "new_path": "experiment/run_experiment.py", "diff": "@@ -22,7 +22,8 @@ import subprocess\nimport sys\nimport tarfile\nimport tempfile\n-from typing import Dict, List\n+from collections import namedtuple\n+from typing import Dict, List, Union, NamedTuple\nimport jinja2\nimport yaml\n@@ -59,80 +60,134 @@ FILTER_SOURCE_REGEX = re.compile(r'('\n_OSS_FUZZ_CORPUS_BACKUP_URL_FORMAT = (\n'gs://{project}-backup.clusterfuzz-external.appspot.com/corpus/'\n'libFuzzer/{fuzz_target}/public.zip')\n+DEFAULT_CONCURRENT_BUILDS = 30\n-def read_and_validate_experiment_config(config_filename: str) -> Dict:\n- \"\"\"Reads |config_filename|, validates it, finds as many errors as possible,\n- and returns it.\"\"\"\n- config = yaml_utils.read(config_filename)\n- filestore_params = {'experiment_filestore', 'report_filestore'}\n- cloud_config = {'cloud_compute_zone', 'cloud_project'}\n- docker_config = {'docker_registry'}\n- string_params = cloud_config.union(filestore_params).union(docker_config)\n- int_params = {'trials', 'max_total_time'}\n- required_params = int_params.union(filestore_params).union(docker_config)\n- bool_params = {'private', 'merge_with_nonprivate'}\n+def _set_default_config_values(config: Dict[str, Union[int, str, bool]],\n+ local_experiment: bool):\n+ \"\"\"Set the default configuration values if they are not specified.\"\"\"\n+ config['local_experiment'] = local_experiment\n+ config['worker_pool_name'] = config.get('worker_pool_name', '')\n+ config['snapshot_period'] = config.get(\n+ 'snapshot_period', experiment_utils.DEFAULT_SNAPSHOT_SECONDS)\n- local_experiment = config.get('local_experiment', False)\n- snapshot_period = config.get('snapshot_period',\n- experiment_utils.DEFAULT_SNAPSHOT_SECONDS)\n- if not local_experiment:\n- required_params = required_params.union(cloud_config)\n- valid = True\n+def _validate_config_parameters(\n+ config: Dict[str, Union[int, str, bool]],\n+ config_requirements: Dict[str, NamedTuple]) -> bool:\n+ \"\"\"Validates if the required |params| exist in |config|.\"\"\"\nif 'cloud_experiment_bucket' in config or 'cloud_web_bucket' in config:\nlogs.error('\"cloud_experiment_bucket\" and \"cloud_web_bucket\" are now '\n'\"experiment_filestore\" and \"report_filestore\".')\n- for param in required_params:\n- if param not in config:\n- valid = False\n- logs.error('Config does not contain \"%s\".', param)\n+ missing_params, optional_params = [], []\n+ for param, requirement in config_requirements.items():\n+ if param in config:\ncontinue\n-\n- value = config[param]\n- if param in int_params and not isinstance(value, int):\n- valid = False\n- logs.error('Config parameter \"%s\" is \"%s\". It must be an int.',\n- param, value)\n+ if requirement.mandatory:\n+ missing_params.append(param)\ncontinue\n+ optional_params.append(param)\n+\n+ for param in missing_params:\n+ logs.error('Config does not contain required parameter \"%s\".', param)\n+\n+ # Notify if any optional parameters are missing in config.\n+ for param in optional_params:\n+ logs.info('Config does not contain optional parameter \"%s\".', param)\n+\n+ return not missing_params\n+\n- if param in string_params and (not isinstance(value, str) or\n- value != value.lower()):\n+# pylint: disable=too-many-arguments\n+def _validate_config_values(config: Dict[str, Union[str, int, bool]],\n+ config_requirements: Dict[str, NamedTuple]) -> bool:\n+ \"\"\"Validates if |params| types and formats in |config| are correct.\"\"\"\n+\n+ valid = True\n+ for param, value in config.items():\n+ requirement = config_requirements.get(param, None)\n+ # Unrecognised parameter.\n+ error_param = 'Config parameter \"%s\" is \"%s\".'\n+ if requirement is None:\nvalid = False\n- logs.error(\n- 'Config parameter \"%s\" is \"%s\". It must be a lowercase string.',\n- param, str(value))\n+ error_reason = 'This parameter is not recognized.'\n+ logs.error(f'{error_param} {error_reason}', param, str(value))\ncontinue\n- if param in bool_params and not isinstance(value, bool):\n+ if not isinstance(value, requirement.type):\nvalid = False\n- logs.error('Config parameter \"%s\" is \"%s\". It must be a bool.',\n- param, str(value))\n- continue\n+ error_reason = f'It must be a {requirement.type}.'\n+ logs.error(f'{error_param} {error_reason}', param, str(value))\n- if param not in filestore_params:\n+ if not isinstance(value, str):\ncontinue\n- if local_experiment and not value.startswith('/'):\n+ if requirement.lowercase and not value.islower():\nvalid = False\n- logs.error(\n- 'Config parameter \"%s\" is \"%s\". Local experiments only support '\n- 'using Posix file systems as filestores.', param, value)\n- continue\n+ error_reason = 'It must be a lowercase string.'\n+ logs.error(f'{error_param} {error_reason}', param, str(value))\n- if not local_experiment and not value.startswith('gs://'):\n+ if requirement.startswith and not value.startswith(\n+ requirement.startswith):\nvalid = False\n- logs.error(\n- 'Config parameter \"%s\" is \"%s\". '\n- 'It must start with gs:// when running on Google Cloud.', param,\n- value)\n+ error_reason = (\n+ 'Local experiments only support Posix file systems filestores.'\n+ if config.get('local_experiment', False) else\n+ 'Google Cloud experiments must start with \"gs://\".')\n+ logs.error(f'{error_param} {error_reason}', param, value)\n- if not valid:\n+ return valid\n+\n+\n+# pylint: disable=too-many-locals\n+def read_and_validate_experiment_config(config_filename: str) -> Dict:\n+ \"\"\"Reads |config_filename|, validates it, finds as many errors as possible,\n+ and returns it.\"\"\"\n+ # Reads config from file.\n+ config = yaml_utils.read(config_filename)\n+\n+ # Validates config contains all the required parameters.\n+ local_experiment = config.get('local_experiment', False)\n+\n+ # Requirement of each config field.\n+ Requirement = namedtuple('Requirement',\n+ ['mandatory', 'type', 'lowercase', 'startswith'])\n+ config_requirements = {\n+ 'experiment_filestore':\n+ Requirement(True, str, True, '/' if local_experiment else 'gs://'),\n+ 'report_filestore':\n+ Requirement(True, str, True, '/' if local_experiment else 'gs://'),\n+ 'docker_registry':\n+ Requirement(True, str, True, ''),\n+ 'trials':\n+ Requirement(True, int, False, ''),\n+ 'max_total_time':\n+ Requirement(True, int, False, ''),\n+ 'cloud_compute_zone':\n+ Requirement(not local_experiment, str, True, ''),\n+ 'cloud_project':\n+ Requirement(not local_experiment, str, True, ''),\n+ 'worker_pool_name':\n+ Requirement(not local_experiment, str, False, ''),\n+ 'experiment':\n+ Requirement(False, str, False, ''),\n+ 'snapshot_period':\n+ Requirement(False, int, False, ''),\n+ 'local_experiment':\n+ Requirement(False, bool, False, ''),\n+ 'private':\n+ Requirement(False, bool, False, ''),\n+ 'merge_with_nonprivate':\n+ Requirement(False, bool, False, ''),\n+ }\n+\n+ all_params_valid = _validate_config_parameters(config, config_requirements)\n+ all_values_valid = _validate_config_values(config, config_requirements)\n+ if not all_params_valid or not all_values_valid:\nraise ValidationError('Config: %s is invalid.' % config_filename)\n- config['local_experiment'] = local_experiment\n- config['snapshot_period'] = snapshot_period\n+ _set_default_config_values(config, local_experiment)\nreturn config\n@@ -237,7 +292,7 @@ def start_experiment( # pylint: disable=too-many-arguments\nno_dictionaries=False,\noss_fuzz_corpus=False,\nallow_uncommitted_changes=False,\n- concurrent_builds=None,\n+ concurrent_builds=DEFAULT_CONCURRENT_BUILDS,\nmeasurers_cpus=None,\nrunners_cpus=None,\nregion_coverage=False,\n@@ -420,19 +475,15 @@ class LocalDispatcher(BaseDispatcher):\nreport_filestore=self.config['report_filestore']))\nset_snapshot_period_arg = 'SNAPSHOT_PERIOD={snapshot_period}'.format(\nsnapshot_period=self.config['snapshot_period'])\n+ set_concurrent_builds_arg = (\n+ f'CONCURRENT_BUILDS={self.config[\"concurrent_builds\"]}')\n+ set_worker_pool_name_arg = (\n+ f'WORKER_POOL_NAME={self.config[\"worker_pool_name\"]}')\ndocker_image_url = '{docker_registry}/dispatcher-image'.format(\ndocker_registry=docker_registry)\n- command = [\n- 'docker',\n- 'run',\n- '-ti',\n- '--rm',\n- '-v',\n- '/var/run/docker.sock:/var/run/docker.sock',\n- '-v',\n- shared_experiment_filestore_arg,\n- '-v',\n- shared_report_filestore_arg,\n+ environment_args = [\n+ '-e',\n+ 'LOCAL_EXPERIMENT=True',\n'-e',\nset_instance_name_arg,\n'-e',\n@@ -448,7 +499,22 @@ class LocalDispatcher(BaseDispatcher):\n'-e',\nset_docker_registry_arg,\n'-e',\n- 'LOCAL_EXPERIMENT=True',\n+ set_concurrent_builds_arg,\n+ '-e',\n+ set_worker_pool_name_arg,\n+ ]\n+ command = [\n+ 'docker',\n+ 'run',\n+ '-ti',\n+ '--rm',\n+ '-v',\n+ '/var/run/docker.sock:/var/run/docker.sock',\n+ '-v',\n+ shared_experiment_filestore_arg,\n+ '-v',\n+ shared_report_filestore_arg,\n+ ] + environment_args + [\n'--shm-size=2g',\n'--cap-add=SYS_PTRACE',\n'--cap-add=SYS_NICE',\n@@ -505,6 +571,8 @@ class GoogleCloudDispatcher(BaseDispatcher):\n'cloud_sql_instance_connection_name':\n(cloud_sql_instance_connection_name),\n'docker_registry': self.config['docker_registry'],\n+ 'concurrent_builds': self.config['concurrent_builds'],\n+ 'worker_pool_name': self.config['worker_pool_name']\n}\nreturn template.render(**kwargs)\n@@ -557,6 +625,7 @@ def main():\nparser.add_argument('-cb',\n'--concurrent-builds',\nhelp='Max concurrent builds allowed.',\n+ default=DEFAULT_CONCURRENT_BUILDS,\nrequired=False)\nparser.add_argument('-mc',\n'--measurers-cpus',\n" }, { "change_type": "MODIFY", "old_path": "experiment/test_run_experiment.py", "new_path": "experiment/test_run_experiment.py", "diff": "@@ -48,14 +48,25 @@ class TestReadAndValdiateExperimentConfig(unittest.TestCase):\ndef setUp(self):\nself.config_filename = 'config'\nself.config = {\n- 'experiment_filestore': 'gs://bucket',\n- 'report_filestore': 'gs://web-bucket',\n- 'experiment': 'experiment-name',\n- 'docker_registry': 'gcr.io/fuzzbench',\n- 'cloud_project': 'fuzzbench',\n- 'cloud_compute_zone': 'us-central1-a',\n- 'trials': 10,\n- 'max_total_time': 1000,\n+ 'experiment_filestore':\n+ 'gs://bucket',\n+ 'report_filestore':\n+ 'gs://web-bucket',\n+ 'experiment':\n+ 'experiment-name',\n+ 'docker_registry':\n+ 'gcr.io/fuzzbench',\n+ 'cloud_project':\n+ 'fuzzbench',\n+ 'cloud_compute_zone':\n+ 'us-central1-a',\n+ 'trials':\n+ 10,\n+ 'max_total_time':\n+ 1000,\n+ 'worker_pool_name': (\n+ 'projects/fuzzbench/locations/us-central1/workerpools/buildpool'\n+ ),\n}\[email protected]('common.logs.error')\n@@ -69,22 +80,28 @@ class TestReadAndValdiateExperimentConfig(unittest.TestCase):\nwith pytest.raises(run_experiment.ValidationError):\nrun_experiment.read_and_validate_experiment_config(\n'config_file')\n- mocked_error.assert_called_with('Config does not contain \"%s\".',\n- 'trials')\n+ mocked_error.assert_called_with(\n+ 'Config does not contain required parameter \"%s\".', 'trials')\[email protected]('common.logs.error')\ndef test_missing_required_cloud(self, mocked_error):\n\"\"\"Tests that an error is logged when the config file is missing a\nrequired cloudconfig parameter.\"\"\"\n- # All but cloud_compute_zone.\n- del self.config['cloud_compute_zone']\n+ # All but each cloud_param defined in run_experiment.py.\n+ cloud_params = {\n+ 'cloud_compute_zone', 'cloud_project', 'worker_pool_name'\n+ }\n+ for cloud_param in cloud_params:\n+ test_config = self.config.copy()\n+ del test_config[cloud_param]\nwith mock.patch('common.yaml_utils.read') as mocked_read_yaml:\n- mocked_read_yaml.return_value = self.config\n+ mocked_read_yaml.return_value = test_config\nwith pytest.raises(run_experiment.ValidationError):\nrun_experiment.read_and_validate_experiment_config(\n'config_file')\n- mocked_error.assert_called_with('Config does not contain \"%s\".',\n- 'cloud_compute_zone')\n+ mocked_error.assert_called_with(\n+ 'Config does not contain required parameter \"%s\".',\n+ cloud_param)\ndef test_invalid_upper(self):\n\"\"\"Tests that an error is logged when the config file has a config\n@@ -99,7 +116,7 @@ class TestReadAndValdiateExperimentConfig(unittest.TestCase):\nparameter that should be a string but is not.\"\"\"\nself._test_invalid(\n'experiment_filestore', 1,\n- 'Config parameter \"%s\" is \"%s\". It must be a lowercase string.')\n+ f'Config parameter \"%s\" is \"%s\". It must be a {str}.')\ndef test_invalid_local_filestore(self):\n\"\"\"Tests that an error is logged when the config file has a config\n@@ -108,7 +125,7 @@ class TestReadAndValdiateExperimentConfig(unittest.TestCase):\nself.config['experiment_filestore'] = '/user/test/folder'\nself._test_invalid(\n'report_filestore', 'gs://wrong-here', 'Config parameter \"%s\" is '\n- '\"%s\". Local experiments only support using Posix file systems as '\n+ '\"%s\". Local experiments only support Posix file systems '\n'filestores.')\ndef test_invalid_cloud_filestore(self):\n@@ -116,7 +133,7 @@ class TestReadAndValdiateExperimentConfig(unittest.TestCase):\nparameter that should be a GCS bucket but is not.\"\"\"\nself._test_invalid(\n'experiment_filestore', 'invalid', 'Config parameter \"%s\" is \"%s\". '\n- 'It must start with gs:// when running on Google Cloud.')\n+ 'Google Cloud experiments must start with \"gs://\".')\[email protected]('common.logs.error')\ndef test_multiple_invalid(self, mocked_error):\n@@ -130,10 +147,10 @@ class TestReadAndValdiateExperimentConfig(unittest.TestCase):\nrun_experiment.read_and_validate_experiment_config(\n'config_file')\nmocked_error.assert_any_call(\n- 'Config parameter \"%s\" is \"%s\". It must be a lowercase string.',\n+ f'Config parameter \"%s\" is \"%s\". It must be a {str}.',\n'experiment_filestore', str(self.config['experiment_filestore']))\nmocked_error.assert_any_call(\n- 'Config parameter \"%s\" is \"%s\". It must be a lowercase string.',\n+ f'Config parameter \"%s\" is \"%s\". It must be a {str}.',\n'report_filestore', str(self.config['report_filestore']))\[email protected]('common.logs.error')\n" } ]
Python
Apache License 2.0
google/fuzzbench
More configurable builds (#1535) Address #1512: 1. Make the worker pool configurable; 2. Make the number of concurrent builds configurable.
258,402
02.11.2022 10:20:23
-39,600
40843bc313d46484e48058d6a6203a8841eba754
Fix parameters validation Validating command line parameters (`concurrent_builds`, `runners_cpu`, `measurers_cpu`) with `argparser`'s built-in typecheck.
[ { "change_type": "MODIFY", "old_path": "experiment/run_experiment.py", "new_path": "experiment/run_experiment.py", "diff": "@@ -574,6 +574,8 @@ class GoogleCloudDispatcher(BaseDispatcher):\n'concurrent_builds': self.config['concurrent_builds'],\n'worker_pool_name': self.config['worker_pool_name']\n}\n+ if 'worker_pool_name' in self.config:\n+ kwargs['worker_pool_name'] = self.config['worker_pool_name']\nreturn template.render(**kwargs)\ndef write_startup_script(self, startup_script_file):\n@@ -626,14 +628,17 @@ def main():\n'--concurrent-builds',\nhelp='Max concurrent builds allowed.',\ndefault=DEFAULT_CONCURRENT_BUILDS,\n+ type=int,\nrequired=False)\nparser.add_argument('-mc',\n'--measurers-cpus',\nhelp='Cpus available to the measurers.',\n+ type=int,\nrequired=False)\nparser.add_argument('-rc',\n'--runners-cpus',\nhelp='Cpus available to the runners.',\n+ type=int,\nrequired=False)\nparser.add_argument('-cs',\n'--custom-seed-corpus-dir',\n@@ -683,30 +688,30 @@ def main():\nfuzzers = args.fuzzers or all_fuzzers\nconcurrent_builds = args.concurrent_builds\n- if concurrent_builds is not None:\n- if not concurrent_builds.isdigit():\n- parser.error(\n- 'The concurrent build argument must be a positive number')\n- concurrent_builds = int(concurrent_builds)\n+ if concurrent_builds is not None and concurrent_builds <= 0:\n+ parser.error('The concurrent build argument must be a positive number,'\n+ f' received {concurrent_builds}.')\n+\nrunners_cpus = args.runners_cpus\n- if runners_cpus is not None:\n- if not runners_cpus.isdigit():\n- parser.error('The runners cpus argument must be a positive number')\n- runners_cpus = int(runners_cpus)\n+ if runners_cpus is not None and runners_cpus <= 0:\n+ parser.error('The runners cpus argument must be a positive number,'\n+ f' received {runners_cpus}.')\n+\nmeasurers_cpus = args.measurers_cpus\n- if measurers_cpus is not None:\n- if not measurers_cpus.isdigit():\n- parser.error(\n- 'The measurers cpus argument must be a positive number')\n- if runners_cpus is None:\n- parser.error(\n- 'With the measurers cpus argument you need to specify the'\n- ' runners cpus argument too')\n- measurers_cpus = int(measurers_cpus)\n+ if measurers_cpus is not None and measurers_cpus <= 0:\n+ parser.error('The measurers cpus argument must be a positive number,'\n+ f' received {measurers_cpus}.')\n+\n+ if runners_cpus is None and measurers_cpus is not None:\n+ parser.error('With the measurers cpus argument (received '\n+ f'{measurers_cpus}) you need to specify the runners cpus '\n+ 'argument too.')\n+\nif (runners_cpus if runners_cpus else 0) + (measurers_cpus if measurers_cpus\nelse 0) > os.cpu_count():\n- parser.error('The sum of runners and measurers cpus is greater than the'\n- ' available cpu cores (%d)' % os.cpu_count())\n+ parser.error(f'The sum of runners ({runners_cpus}) and measurers cpus '\n+ f'({measurers_cpus}) is greater than the available cpu '\n+ f'cores (os.cpu_count()).')\nif args.custom_seed_corpus_dir:\nif args.no_seeds:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix parameters validation (#1539) Validating command line parameters (`concurrent_builds`, `runners_cpu`, `measurers_cpu`) with `argparser`'s built-in typecheck.
258,402
11.11.2022 14:00:15
-39,600
0d270030170e9a4984a18e09304643e72b4ba3c4
Add worker pool name to config A follow-up of Add `worker_pool_name` to config file.
[ { "change_type": "MODIFY", "old_path": "service/experiment-config.yaml", "new_path": "service/experiment-config.yaml", "diff": "@@ -10,6 +10,7 @@ cloud_compute_zone: us-central1-c\nexperiment_filestore: gs://fuzzbench-data\nreport_filestore: gs://www.fuzzbench.com/reports\ncloud_sql_instance_connection_name: \"fuzzbench:us-central1:postgres-experiment-db=tcp:5432\"\n+worker_pool_name: \"projects/fuzzbench/locations/us-central1/workerPools/buildpool\"\npreemptible_runners: true\n# This experiment should generate a report that is combined with other public\n" } ]
Python
Apache License 2.0
google/fuzzbench
Add worker pool name to config (#1548) A follow-up of #1535: Add `worker_pool_name` to config file.
258,402
11.11.2022 14:13:55
-39,600
489ca6f27ed112e83d40db4b9c0431f8ccbcf46a
Relaunch the most recent 3 experiments after adding workerpool to config It seems these 3 experiments were not launched properly due to a missing config in Relaunching them now as should have patched the config file and fixed the issue.
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-11-06-muttfuzz\n+ description: \"Try out muttfuzz and compare against afl\"\n+ fuzzers:\n+ - aflplusplus\n+ - aflplusplus_muttfuzz\n+\n+- experiment: 2022-11-06-um-prioritize\n+ description: \"Try out um prioritize again\"\n+ fuzzers:\n+ - aflplusplus\n+ - aflplusplus_um_prioritize\n+\n+- experiment: 2022-10-31-update-libfuzzer-2\n+ description: \"Compare and consider replacing Entropic with Centipede\"\n+ fuzzers:\n+ - libfuzzer\n+ - entropic\n+ - centipede\n+\n- experiment: 2022-11-06-muttfuzz\ndescription: \"Try out muttfuzz and compare against afl\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Relaunch the most recent 3 experiments after adding workerpool to config (#1549) It seems these 3 experiments were not launched properly due to a missing config in #1535. Relaunching them now as #1548 should have patched the config file and fixed the issue.
258,402
11.11.2022 15:44:51
-39,600
1149e7bf2c835d7a496f08b7b6984c92f106f9e5
Make 2 optional config parameters recognizable Fix
[ { "change_type": "MODIFY", "old_path": "experiment/run_experiment.py", "new_path": "experiment/run_experiment.py", "diff": "@@ -172,6 +172,8 @@ def read_and_validate_experiment_config(config_filename: str) -> Dict:\nRequirement(not local_experiment, str, False, ''),\n'experiment':\nRequirement(False, str, False, ''),\n+ 'cloud_sql_instance_connection_name':\n+ Requirement(False, str, True, ''),\n'snapshot_period':\nRequirement(False, int, False, ''),\n'local_experiment':\n@@ -180,6 +182,8 @@ def read_and_validate_experiment_config(config_filename: str) -> Dict:\nRequirement(False, bool, False, ''),\n'merge_with_nonprivate':\nRequirement(False, bool, False, ''),\n+ 'preemptible_runners':\n+ Requirement(False, bool, False, ''),\n}\nall_params_valid = _validate_config_parameters(config, config_requirements)\n" } ]
Python
Apache License 2.0
google/fuzzbench
Make 2 optional config parameters recognizable (#1551) Fix #1535.
258,402
11.11.2022 17:09:08
-39,600
dc682183f2e5f37bfd40003be97afff394d95591
Re-relaunch these two experiments relaunched 3 experiments but was unsuccessful because of a code bug: two valid parameters in the config file were not recognized. fixed that bug. I re-relaunched the `libFuzzer` experiment manually to confirm it works, and re-relaunch the other two here.
[ { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-11-11-muttfuzz\n+ description: \"Try out muttfuzz and compare against afl\"\n+ fuzzers:\n+ - aflplusplus\n+ - aflplusplus_muttfuzz\n+\n+- experiment: 2022-11-11-um-prioritize\n+ description: \"Try out um prioritize again\"\n+ fuzzers:\n+ - aflplusplus\n+ - aflplusplus_um_prioritize\n+\n- experiment: 2022-11-06-muttfuzz\ndescription: \"Try out muttfuzz and compare against afl\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Re-relaunch these two experiments (#1552) #1549 relaunched 3 experiments but was unsuccessful because of a code bug: two valid parameters in the config file were not recognized. #1551 fixed that bug. I re-relaunched the `libFuzzer` experiment manually to confirm it works, and re-relaunch the other two here.
258,388
11.11.2022 12:39:20
18,000
5e37b392529208dbcfcda8699ee091dbcaab1020
Fix error CC
[ { "change_type": "MODIFY", "old_path": "experiment/build/builder.py", "new_path": "experiment/build/builder.py", "diff": "@@ -140,7 +140,7 @@ def retry_build_loop(build_func: Callable, inputs: List[Tuple]) -> List:\n|NUM_BUILD_ATTEMPTS| times. Returns the list of inputs that |build_func| was\ncalled successfully on.\"\"\"\nsuccesses = []\n- num_concurrent_builds = os.getenv('CONCURRENT_BUILDS')\n+ num_concurrent_builds = int(os.getenv('CONCURRENT_BUILDS'))\nlogs.info('Concurrent builds: %d.', num_concurrent_builds)\nwith mp_pool.ThreadPool(num_concurrent_builds) as pool:\nfor _ in range(NUM_BUILD_ATTEMPTS):\n" }, { "change_type": "MODIFY", "old_path": "service/experiment-requests.yaml", "new_path": "service/experiment-requests.yaml", "diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-11-12-muttfuzz\n+ description: \"Try out muttfuzz and compare against afl\"\n+ fuzzers:\n+ - aflplusplus\n+ - aflplusplus_muttfuzz\n+\n+- experiment: 2022-11-12-um-prioritize\n+ description: \"Try out um prioritize again\"\n+ fuzzers:\n+ - aflplusplus\n+ - aflplusplus_um_prioritize\n+\n- experiment: 2022-11-11-muttfuzz\ndescription: \"Try out muttfuzz and compare against afl\"\nfuzzers:\n" } ]
Python
Apache License 2.0
google/fuzzbench
Fix error (#1553) CC @Alan32Liu @kjain14