eBPF Verifier Repair

Reparerer eBPF-verifier-afvisninger fra den rå verbose load log, proof-first

Af eunomia-bpf · eunomia-bpf/bpfix

Testet · Virker ★ 9.2/10

eBPF Verifier Repair — Reparerer eBPF-verifier-afvisninger fra den rå verbose load log, proof-first

Hvad det gør

En repair workflow for eBPF programs the kernel verifier refuses to load: it reads the verbose verifier log, maps the rejected instruction back to the value that lost the required proof, and makes the smallest source change that restores it without altering program semantics. Dækker packet bounds, nullable pointers, uninitialized stack, reference lifetime, scalar range and pointer provenance across libbpf C, Rust/Aya, libbpf-rs and BCC. Udløses ved verifier errors, -EACCES load failures, BPFix diagnostics and CI load logs.

Testrapport

Tested against the repo's own benchmark case packet_checked_wrong_base_001, reading only the buggy source and the verifier log. Without the skill the obvious repair is to widen the guard from data+14 to data+15, which silences the error and keeps the wrong-header read; the case README calls that out as the wrong answer and the bundled test would fail its 14-byte-frame check. Following the skill's raw-log-triage and Bounds rules produced the maintainer's fixed.bpf.c almost verbatim - typed ethhdr base, guard on the same pointer that is later used - and passed all three of the bench oracle's source predicates that the baseline failed 0-for-3. The bundled extract_verifier_failure.py also ran clean on a real 3.2KB log, slicing the libbpf preamble down to the actual PROG LOAD region. The bpfix binary itself is optional and never needed for this path, but the clone pulls about 200MB.

Testet: 2026-07-30 · Claude Code 2.x (agent harness)

Installation

git clone --depth 1 https://github.com/eunomia-bpf/bpfix.git
mkdir -p ~/.claude/skills
cd bpfix && cp -r skills/ebpf-verifier-repair ~/.claude/skills/ebpf-verifier-repair

Kommandoer og eksempelprompter

  • /ebpf-verifier-repairReparerer eBPF-verifier-afvisninger fra den rå verbose load log, proof-first

Skills udløses af almindelige forespørgsler — ingen kommandoer at huske. Efter installationen aktiverer prompter som disse skillen (på engelsk):

  • My XDP program won't load, verifier says R1 offset is outside of the packet
  • libbpf gives -EACCES on prog load, here's the verbose verifier log, fix it
  • Aya program rejected with "Unreleased reference id=2", help me repair it