You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Snapshot and Builder Sidecar](#snapshot-and-builder-sidecar)
19
21
-[Output format standards](#output-format-standards)
20
22
-[Delta Scan Mode](#delta-scan-mode)
21
23
-[CRS Ensemble Support](#crs-ensemble-support)
@@ -489,6 +491,8 @@ required_llms:
489
491
490
492
#### Dockerfile Conventions
491
493
494
+
To accommodate the OSS-CRS workflow, we suggest following certain conventions when integrating a CRS.
495
+
492
496
**Builder Dockerfile** (`target_build_phase`): Uses the target project image as base via build arg. This allows CRS-specific instrumentation on top of the OSS-Fuzz project build.
493
497
494
498
```dockerfile
@@ -529,7 +533,8 @@ CRSs interact with the oss-crs infrastructure through **libCRS**, a Python libra
Where `TYPE` is one of: `pov`, `seed`, `bug-candidate`, `patch`, `diff`.
598
+
559
599
#### Environment Variables
560
600
561
601
CRSs receive the following environment variables from OSS-CRS:
@@ -580,6 +620,119 @@ CRSs may use the environment variables however they like, but we suggest handlin
580
620
- `OSS_CRS_LLM_API_URL`and `OSS_CRS_LLM_API_KEY` for making LLM requests
581
621
- `OSS_CRS_CPUSET`and `OSS_CRS_MEMORY_LIMIT` in case compute-heavy tasks need to scale along with the resource constraints applied by the operator
582
622
623
+
#### Custom Builders
624
+
625
+
A CRS may want to perform several custom target project compilation passes. For example, fuzzers need custom instrumentation of the source code, and static analysis tools also need to process the project's source code to produce analysis reports. OSS-CRS supports multiple custom builders to accommodate these demands.
626
+
627
+
CRS authors can choose between framework-provided builders and custom Dockerfiles for the `target_build_phase`. The `dockerfile` field accepts two formats:
628
+
629
+
- **Framework-provided:** `oss-crs-infra:<module>` references a builder shipped with oss-crs (e.g., `oss-crs-infra:default-builder`). These handle the standard OSS-Fuzz compile flow and snapshot creation automatically.
630
+
- **Custom Dockerfile:** A path to a CRS-provided Dockerfile (e.g., `oss-crs/dockerfiles/builder.Dockerfile`). Custom builders use `ARG target_base_image` / `FROM $target_base_image` to layer CRS-specific instrumentation on top of the OSS-Fuzz project build.
631
+
632
+
```yaml
633
+
target_build_phase:
634
+
# Framework-provided builder for snapshot creation
The same `oss-crs-infra:` prefix can be used in `crs_run_phase` modules to run framework-provided services (e.g., a builder sidecar server).
651
+
652
+
#### Snapshot and Builder Sidecar
653
+
654
+
CRSs may want to reuse their builder environment for on-demand rebuilds at the run phase. OSS-CRS provides mechanisms for snapshotting the builder environment and launching the CRS builders in the run phase. This comes with the benefits of more performative rebuilds and re-use of the builder environment without additional run phase setup.
655
+
656
+
A **snapshot** is a Docker image that captures a fully compiled and instrumented target project. Snapshots enable **incremental rebuilds**: instead of compiling from scratch for every patch attempt, a CRS applies a unified diff to the snapshot and only recompiles the changed files.
657
+
658
+
**Enabling snapshots** requires two fields in `crs.yaml`:
659
+
660
+
1. **`snapshot: true`** on a `target_build_phase` entry — tells `build-target` to compile the project, install libCRS and build scripts, then commit the container as a snapshot image.
661
+
662
+
2. **`run_snapshot: true`** on a `crs_run_phase` module — uses the snapshot image as the module's base image. This module runs a **builder sidecar**, an HTTP service that accepts patch, POV, and test requests.
663
+
664
+
```yaml
665
+
# crs.yaml — bug-fixing CRS with builder sidecar
666
+
target_build_phase:
667
+
- name: asan-snapshot
668
+
dockerfile: oss-crs-infra:default-builder
669
+
snapshot: true
670
+
additional_env:
671
+
SANITIZER: address
672
+
673
+
crs_run_phase:
674
+
patcher:
675
+
dockerfile: oss-crs/patcher.Dockerfile
676
+
builder-asan:
677
+
dockerfile: oss-crs-infra:default-builder
678
+
run_snapshot: true
679
+
```
680
+
681
+
In this configuration, oss-crs launches `builder-asan` from the snapshot image. The patcher module communicates with it via libCRS:
682
+
683
+
**Patch → Build → Validate workflow:**
684
+
685
+
```python
686
+
from libCRS import CRSUtils
687
+
from pathlib import Path
688
+
689
+
crs = CRSUtils()
690
+
691
+
# 1. Apply a patch and rebuild (POST to builder sidecar /build)
692
+
build_exit = crs.apply_patch_build(
693
+
patch_path=Path("/work/fix.patch"),
694
+
response_dir=Path("/work/build-result"),
695
+
builder="builder-asan",
696
+
)
697
+
# Response dir contains: build_exit_code, build.log, build_id
698
+
699
+
# 2. Run POV against the patched build (POST to /run-pov)
The builder sidecar handles the compilation, binary execution, and test running inside the snapshot environment. CRS authors only need to generate patches and interpret the results.
735
+
583
736
### Output format standards
584
737
585
738
For bug-finding CRSs, the output contains crashes, corpus, and crs-specific data:
0 commit comments