Module verifier

Module verifier 

Source
Expand description

BPF verifier log parsing, cycle detection, and output formatting.

Provides:

Structs§

DiffRow
A single row in the A/B diff output.
ProgStats
Per-program verifier statistics collected from a VM run.
VerifierCellOwnershipEntry
One selected scheduler declaration and the sole test executable allowed to list, launch, and record its verifier cells.
VerifierCellOwnershipManifest
One parent-elected verifier-cell owner per selected scheduler identity.
VerifierCellRecord
One cargo ktstr verifier cell’s outcome. The cell process writes it (via write_cell_record) into the directory named by crate::KTSTR_VERIFIER_RESULT_DIR_ENV; after nextest returns the dispatcher reads them back (via read_cell_records) and renders one PASS/FAIL/SKIP grid per scheduler (rows = topology, cols = kernel). A cell is one (scheduler, kernel, topology): the verifier sweeps each declared scheduler across topologies, so topology IS a result axis — a scheduler can pass on one topology and fail on another.
VerifierStats
Parsed verifier stats from the kernel log line: processed N insns (limit M) max_states_per_insn X total_states Y peak_states Z mark_read W
VerifierVmResult
Result of collecting verifier output from a VM run.

Enums§

AttachOutcome
Whether the scheduler positively confirmed it turned on during a verifier VM run.
RunOutcome
The terminal disposition of a cargo ktstr verifier run, decided by classify_run_outcome after nextest returns and the report grids have been printed.

Constants§

VERIFIER_CELL_OWNERSHIP_MANIFEST_VERSION
Current schema version for VerifierCellOwnershipManifest.

Functions§

build_b_map
Build the B-side lookup map from collected stats.
build_diff_rows
Build diff rows from A stats and B lookup map.
build_nextest_args
Build the cargo nextest run argument vector for the verifier sweep.
classify_run_outcome
Decide the cargo ktstr verifier run outcome from nextest’s exit success, whether any per-cell records were produced, whether any of those records is a FAILED cell (already shown as a ✗ in the printed grid), and the optional --scheduler filter.
collapse_cycles
Collapse repeating cycles in a verifier log.
collapse_verifier_region
Return s with the libbpf verifier-log region (between the -- BEGIN/END PROG LOAD LOG -- markers) replaced by collapse_cycles of that region — collapsed IN PLACE, with every byte OUTSIDE the region (the surrounding scheduler output, the BEGIN and END marker lines, any mid-line-END partial prefix) preserved exactly. Input WITHOUT the marker pair is returned unchanged.
collect_verifier_output
Boot a VM and collect verifier statistics via host-side memory introspection. Per-program verified_insns comes from bpf_prog_aux->verified_insns read through the guest’s physical memory. On load failure, libbpf prints the verifier log to stderr; the returned scheduler_log field contains the scheduler’s captured output from the VM.
detect_cycle
Detect a single repeating cycle in a slice of lines.
extract_verifier_log
Extract the verifier instruction trace from a scheduler log blob.
format_verifier_diff
Format an A/B diff table comparing two sets of verifier stats.
format_verifier_output
Format verifier results as text: brief lines per program and collapsed logs.
format_verifier_stderr
Format the scheduler’s captured STDERR for emission to the test’s stderr, or the empty string when there is no stderr to show.
normalize_verifier_line
Normalize a BPF verifier log line by stripping variable register-state annotations so that lines from different loop iterations compare equal.
parse_verifier_stats
Parse verifier stats from the log output.
read_cell_records
Read every *.json cell record under dir (non-recursive). A missing dir or an unparseable record is skipped (best-effort). Returns records in filesystem-iteration order; render_result_table sorts for a deterministic render.
render_instruction_count_tables
Render one verified_insns table per declared scheduler. Within each scheduler’s section: rows = BPF program, columns = kernel version, and each cell is that program’s verified_insns for the (scheduler, kernel) summarized ACROSS the topologies that ran it — a single number when topology-invariant, lo..hi when it varies (- when that program reported no stats on that kernel).
render_result_table
Render the per-cell records into one PASS/FAIL/SKIP grid PER declared scheduler (BTreeSet-sorted). Each scheduler’s section is a tally line followed by a bordered grid whose rows are the topology presets that ran the scheduler (BTreeSet) and whose columns are the kernels that ran it (BTreeSet); the header row’s first column is topology. Each grid cell is the (topology, kernel) result FOR THAT SCHEDULER, rendered nextest-style: