eBPF Verifier Repair

Reparerar eBPF-verifieringsavslag från den råa utförliga laddningsloggen, bevis-först

av eunomia-bpf · eunomia-bpf/bpfix

Testad · Fungerar ★ 9.2/10

eBPF Verifier Repair — Reparerar eBPF-verifieringsavslag från den råa utförliga laddningsloggen, bevis-först

Vad den gör

Ett reparationsarbetsflöde för 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. Covers packet bounds, nullable pointers, uninitialized stack, reference lifetime, scalar range och pointer provenance across libbpf C, Rust/Aya, libbpf-rs och BCC. Utlöses vid verifier errors, -EACCES load failures, BPFix diagnostics och 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.

Testad: 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

Kommandon och exempelprompter

  • /ebpf-verifier-repairReparerar eBPF-verifieringsavslag från den råa utförliga laddningsloggen, bevis-först

Skills triggas av vanliga förfrågningar — inga kommandon att memorera. Efter installationen aktiverar prompter som dessa skillen (på engelska):

  • 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