diff --git a/common/src/buttercup/common/challenge_task.py b/common/src/buttercup/common/challenge_task.py index 5606851a..7a4ae5d1 100644 --- a/common/src/buttercup/common/challenge_task.py +++ b/common/src/buttercup/common/challenge_task.py @@ -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, diff --git a/deployment/k8s/charts/coverage-bot/templates/deployment.yaml b/deployment/k8s/charts/coverage-bot/templates/deployment.yaml index f3c5ff2a..2c84aaee 100644 --- a/deployment/k8s/charts/coverage-bot/templates/deployment.yaml +++ b/deployment/k8s/charts/coverage-bot/templates/deployment.yaml @@ -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 }} diff --git a/deployment/k8s/charts/fuzzer-bot/templates/deployment.yaml b/deployment/k8s/charts/fuzzer-bot/templates/deployment.yaml index d1f09c2c..6b1f331e 100644 --- a/deployment/k8s/charts/fuzzer-bot/templates/deployment.yaml +++ b/deployment/k8s/charts/fuzzer-bot/templates/deployment.yaml @@ -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 }} diff --git a/deployment/k8s/charts/tracer-bot/templates/deployment.yaml b/deployment/k8s/charts/tracer-bot/templates/deployment.yaml index 41efa117..eef25605 100644 --- a/deployment/k8s/charts/tracer-bot/templates/deployment.yaml +++ b/deployment/k8s/charts/tracer-bot/templates/deployment.yaml @@ -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 }} diff --git a/orchestrator/scripts/round_2_sim.sh b/orchestrator/scripts/round_2_sim.sh index 1a629a81..d9f519f0 100755 --- a/orchestrator/scripts/round_2_sim.sh +++ b/orchestrator/scripts/round_2_sim.sh @@ -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() {