Set timeout for reproducer (#789)

* Set timeout for reproducer

* Add testing updated version of oss-fuzz-aixcc

---------

Co-authored-by: Boyan MILANOV <boyanmilanov@coder-boyanmilanov-aixcc-boyan.c.production-1-405717.internal>
Co-authored-by: Evan Downing <2077950+evandowning@users.noreply.github.com>
This commit is contained in:
Boyan MILANOV
2025-06-09 18:08:45 +02:00
committed by GitHub
parent 8cc31217e6
commit 360c5d1de2
5 changed files with 46 additions and 0 deletions
@@ -17,6 +17,7 @@ from buttercup.common.task_meta import TaskMeta
from buttercup.common.utils import copyanything, get_diffs
from typing import Iterator
import buttercup.common.node_local as node_local
from packaging.version import Version
logger = logging.getLogger(__name__)
@@ -376,6 +377,28 @@ class ChallengeTask:
def _run_helper_cmd(self, cmd: list[str], env_helper: Dict[str, str] | None = None) -> CommandResult:
return self._run_cmd(cmd, cwd=self.task_dir / self.get_oss_fuzz_subpath(), env_helper=env_helper)
def _get_base_runner_version(self) -> Version | None:
"""The base-runner image tag is hardcoded in infra/helper.py."""
grep_cmd = ["grep", "BASE_IMAGE_TAG =", str(self._helper_path)]
try:
result = self._run_helper_cmd(grep_cmd)
except Exception as e:
logger.exception(f"[task {self.task_dir}] Error grep'ing for base-runner version: {str(e)}")
return None
if not result.success:
return None
m = re.search(r"BASE_IMAGE_TAG = '([^']+)'", result.output.decode("utf-8"))
if not m:
return None
try:
base_runner_str = m.group(1).strip(":v")
return Version(base_runner_str)
except Exception as e:
logger.exception(f"[task {self.task_dir}] Error parsing base-runner version: {str(e)}")
return None
def container_image(self) -> str:
return f"{self.OSS_FUZZ_CONTAINER_ORG}/{self.project_name}"
@@ -611,6 +634,15 @@ class ChallengeTask:
kwargs["propagate_exit_code"] = True
kwargs["err_result"] = FAILURE_ERR_RESULT
# Get base-runner version
base_runner_version = self._get_base_runner_version()
# NOTE: This feature was added in v1.2.0 of infra/helper.py
if base_runner_version and base_runner_version >= Version("1.2.0"):
# Set timeout (in seconds) in the case it hangs
# We use 120 seconds, which is larger than the suggested 65 seconds in the FAQ
kwargs["timeout"] = 120
cmd = self._get_helper_cmd(
"reproduce",
self.project_name,
@@ -33,6 +33,7 @@ spec:
env:
- name: BUTTERCUP_FUZZER_SAMPLE_SIZE
value: "{{ .Values.global.coverageBot.sampleSize }}"
{{- include "buttercup.commonEnv" . | nindent 8 }}
{{- include "buttercup.env.nodeData" . | nindent 8 }}
{{- include "buttercup.env.dockerSocket" . | nindent 8 }}
{{- include "buttercup.env.telemetry" . | nindent 8 }}
@@ -31,6 +31,7 @@ spec:
timeoutSeconds: {{ .Values.healthCheck.timeoutSeconds | default 10 }}
failureThreshold: {{ .Values.healthCheck.failureThreshold | default 2 }}
env:
{{- include "buttercup.commonEnv" . | nindent 8 }}
{{- include "buttercup.env.nodeData" . | nindent 8 }}
{{- include "buttercup.fuzzerBotEnv" . | nindent 8 }}
{{- include "buttercup.env.telemetry" . | nindent 8 }}
@@ -38,6 +38,7 @@ spec:
{{- include "buttercup.nodeLocalVolumeMount" . | nindent 8 }}
{{- include "buttercup.dockerSocketVolumeMount" . | nindent 8 }}
env:
{{- include "buttercup.commonEnv" . | nindent 8 }}
{{- include "buttercup.env.dockerSocket" . | nindent 8 }}
{{- include "buttercup.env.nodeData" . | nindent 8 }}
{{- include "buttercup.env.telemetry" . | nindent 8 }}
+11
View File
@@ -25,6 +25,15 @@ declare -A libxml2_full=(
["duration"]=$full_set_duration
)
declare -A libxml2_full_updated=(
["challenge_repo_url"]="git@github.com:aixcc-finals/afc-libxml2.git"
["challenge_repo_head_ref"]="challenges/lx-full-01"
["fuzz_tooling_url"]="git@github.com:aixcc-finals/oss-fuzz-aixcc.git"
["fuzz_tooling_ref"]="aixcc-afc"
["fuzz_tooling_project_name"]="libxml2"
["duration"]=$full_set_duration
)
declare -A sqlite_full=(
["challenge_repo_url"]="git@github.com:aixcc-finals/afc-sqlite3.git"
["challenge_repo_head_ref"]="challenges/sq-full-01"
@@ -247,6 +256,8 @@ usage() {
echo " libxml2_full | libxml2_delta_1 | libxml2_delta_2"
echo " sqlite_full | sqlite_delta_1"
echo " zookeeper_full | zookeeper_delta_1"
echo ""
echo " libxml2_full_updated -> using the most recent version of helper.py"
}
main() {