BPF verifier errors redesigned for source context and causal history
A 16-patch series reworks how the Linux kernel explains rejected eBPF programs, adding categorized safety reports instead of terse log lines alone.
Kumar Kartikeya Dwivedi has posted a fourth-round redesign of BPF verifier diagnostics aimed at making load failures easier to debug. When the kernel rejects an eBPF program today, developers often get a short, opaque message with little sense of how a register, reference, or context ended up invalid. The series keeps those legacy lines for compatibility and layers structured reports on top.
The new output annotates the failing source and instruction, records a bounded causal history along the active path, and classifies problems into categories such as register type safety, memory safety, resource lifetime, call contracts, execution context, program structure, policy, and verifier limits. History tracks register and stack-argument changes, reference acquire and release, and entry into lock, IRQ, RCU, and preempt regions so reports can start from the change that matters rather than dumping unrelated state.
For path-dependent failures the reports spell out reason, scoped history, and a concrete suggestion. Structural and policy checks get source context without inventing branch narratives. Collection stays tied to normal verifier logging, so stats-only loads avoid the extra bookkeeping. Several patches carry acks from Eduard Zingerman. If merged for bpf-next, the work should cut the time spent reverse-engineering why a program failed verification, especially for complex helpers, kfuncs, and critical-section rules.