| name | rebuild-harness |
| description | How to rebuild the harness with source modifications using libCRS apply-patch-build |
Rebuild Harness
Rebuild the harness after modifying source code (e.g., adding debug logs, instrumentation, or testing a hypothesis). Uses the builder sidecar to compile inside the target environment.
When to Use
- Adding
printf/fprintf(stderr, ...) to trace execution paths
- Adding assertions to test hypotheses about vulnerable code
- Modifying the harness to reach different code paths
- Instrumenting code to understand input parsing
Workflow
cd {source_dir}
git add -A
git diff --cached > /tmp/debug.diff
libCRS apply-patch-build /tmp/debug.diff /tmp/build_001
cat /tmp/build_001/retcode
cat /tmp/build_001/stderr.log
cat /tmp/build_001/stdout.log
cat /tmp/build_001/rebuild_id
libCRS run-pov /tmp/candidate.bin /tmp/run_debug \
--harness {harness} --rebuild-id $(cat /tmp/build_001/rebuild_id)
cat /tmp/run_debug/stdout.log
cat /tmp/run_debug/stderr.log
Example: Adding Debug Logging
cd {source_dir}
git add -A
git diff --cached > /tmp/debug_trace.diff
libCRS apply-patch-build /tmp/debug_trace.diff /tmp/build_debug
REBUILD_ID=$(cat /tmp/build_debug/rebuild_id)
libCRS run-pov /tmp/candidate.bin /tmp/run_debug \
--harness {harness} --rebuild-id $REBUILD_ID
cat /tmp/run_debug/stderr.log
Notes
- Rebuild IDs are content-addressed: same patch → same rebuild ID (cached).
- Failed builds are NOT cached — you can fix and retry.
- Always reset source after debugging:
git checkout -- .
- For final POV verification, omit
--rebuild-id (runs against the original vulnerable build), not your debug build.
- Builds can be slow (recompiles the full project). Review your diff before building.