Repository navigation
Report libFuzzer statistics in the libFuzzer tests check - #117142
Conversation
The check reports only `OK`/`FAIL` and a duration per fuzzer, and it uploads
the fuzzer output only when the run failed. There is therefore no way to tell
a target that is exploring new code from one that executes nothing: in this
harness `OK` merely means "the process was still alive when the runner killed
it at the timeout".
That is not hypothetical. `tcp_protocol_fuzzer` reports `OK` every night while
never adding a single unit to its corpus, and `execute_query_fuzzer` and
`clickhouse_fuzzer` spend 56-58 minutes of their one-hour budget replaying
their own inputs before the first mutation - both facts had to be reverse
engineered from corpus file timestamps in the artifact bucket, because none of
it reaches the report.
`runner.py` now scrapes the libFuzzer progress lines into a `stats.txt` next to
the existing `status.txt`, and records the corpus size before and after the
run. The check renders them, so each fuzzer now reports, for example:
executed 15238 inputs, exec/s: 4, cov: 145140, ft: 512210, corp: 4470/23Mb, rss: 2100Mb
input directories: corpus/execute_query_fuzzer (4436 files), execute_query_fuzzer.in (10418 files)
replaying the initial corpus took 14854 of 15238 executed inputs (97%), leaving 384 mutations
34 new corpus units (4436 -> 4470)
Corpus minimization reports its reduction the same way, which until now was
only visible by reading the job log.
The fuzzer output and stdout are also attached on success, not just on
failure. To keep that affordable for long runs, a successful run's output is
truncated to its first 1 MiB and last 7 MiB; output from a run that produced
findings is left intact so that `process_error` still sees whole stack traces.
|
Workflow [PR], commit [94bd796] Summary: ✅ AI ReviewSummaryThis PR makes the Findings
Final VerdictChanges look good overall, but the new stats reader should stop treating malformed |
# Conflicts: # ci/jobs/libfuzzer_test_check.py
…r.py` in the job digest A successful corpus minimization run attached its full `out_mini.txt`, which can hold an hour of libFuzzer progress lines; truncate it with the same policy as the fuzzing output. Also add `tests/fuzz/runner.py` to the cache digest of the `libFuzzer tests` and `libFuzzer corpus minimization` jobs, since the harness logic now lives there and a runner-only change must not reuse a stale cache record.
| if not stats_path.exists(): | ||
| return {} | ||
| with open(stats_path, "r", encoding="utf-8") as file: | ||
| return json.load(file) |
There was a problem hiding this comment.
stats.txt / stats_mini.txt are auxiliary files produced inside the Docker runner, but read_stats now treats any malformed JSON as fatal. A concrete failure mode is write_stats opening the file and then failing mid-dump (for example ENOSPC while the job is already under artifact pressure): the status/output files are still present, yet json.load raises here and process_results aborts the whole libFuzzer tests check.
Since the missing-file case already degrades to {}, the malformed-file case needs the same treatment plus a warning in the report/log. Otherwise this reporting-only feature adds a new way for a finished fuzzing run to surface as job ERROR instead of showing the existing status and logs.
The check reports only
OK/FAILand a duration per fuzzer, and it uploads the fuzzer output only when the run failed. There is therefore no way to tell a target that is exploring new code from one that executes nothing: in this harnessOKmerely means "the process was still alive when the runner killed it at the timeout".That is not hypothetical.
tcp_protocol_fuzzerreportsOKevery night while never adding a single unit to its corpus, andexecute_query_fuzzerandclickhouse_fuzzerspend 56-58 minutes of their one-hour budget replaying their own inputs before the first mutation - both facts had to be reverse engineered from corpus file timestamps in the artifact bucket, because none of it reaches the report.runner.pynow scrapes the libFuzzer progress lines into astats.txtnext to the existingstatus.txt, and records the corpus size before and after the run. The check renders them, so each fuzzer now reports, for example:Corpus minimization reports its reduction the same way, which until now was only visible by reading the job log.
The fuzzer output and stdout are also attached on success, not just on failure. To keep that affordable for long runs, a successful run's output is truncated to its first 1 MiB and last 7 MiB; output from a run that produced findings is left intact so that
process_errorstill sees whole stack traces.Related: #117140
Related: #117141
Changelog category (leave one):
Workflow [PR]
Sync PR [sync-upstream/pr/117142]
Version info
26.9.1.593(included in26.9and later)