← All papers
First page of Keel: A Verified In-Kernel Proof Checker for Proof Carrying BPF

Keel: A Verified In-Kernel Proof Checker for Proof Carrying BPF

Yalu Cai, Tung-Che Chang, Santosh Nagarakatte

cs.PL Nov 8, 2026 · v1
Specifies and proves sound an eBPF proof-certificate checker in Lean 4, with a deeply embedded C fragment (EmbC) proven to refine it.
Recent systems such as the eBPF Certificate Framework (BCF) and Proof-Carrying BPF address the imprecision in the Linux eBPF verifier with proof-carrying code. When the verifier's abstract domains cannot prove a safety condition, an in-kernel proof checker checks an untrusted user-space refutation proof. A single bug in this checker can compromise the security of the entire kernel. While formalizing BCF's in-kernel checker, we discovered 13 bugs such as unsound rewrite rules, silently unchecked proof steps, and memory safety errors. We demonstrate that forged certificates can trick the kernel to accept arbitrary unsafe eBPF programs. To address this problem, we propose Keel, a formally verified in-kernel proof checker for the Linux eBPF verifier. First, we specify the checker as a pure functional program in Lean and prove its soundness against bit-vector semantics. We decouple the steps of the proof certificate checker from the mathematical rewrite rules, which enables us to extend the rewrite rules without the need to change the checker. Second, we implement the checker in EmbC, a deeply embedded C fragment, and prove that our C implementation refines the functional specification without undefined behavior or memory leaks. Third, using an amortized potential argument, we prove linear time and memory bounds for the C checker. Keel is correct-by-construction while also being faster than the BCF checker inside the kernel, 1.3X in total and 2.0X on the slowest 1.4% of certificates.

The BCF and Proof-Carrying BPF frameworks use an in-kernel proof checker to validate untrusted refutation certificates for the Linux eBPF verifier, so a bug in that checker compromises the whole kernel. While formalizing BCF's checker, the authors found 13 bugs, including unsound rewrite rules, unchecked proof steps and memory safety errors, and showed that forged certificates can get unsafe eBPF programs accepted.

Keel is a pure functional certificate checker written in Lean 4 and proved sound against bit-vector semantics. Its rewrite rules sit in a declarative table, so adding a rule only requires proving that rule valid. The checker is reimplemented in EmbC, a deeply embedded C fragment in Lean that is validated against CompCert Clight, and proved to refine the specification without undefined behavior or memory leaks. An amortized potential argument over work and memory budgets proves linear time and memory bounds.

The development produces a verified C checker of 6,616 lines that accepts BCF's certificates in Linux 6.19. It is 1.3x faster than BCF's checker overall and 2.0x faster on the slowest 1.4% of certificates. Differential testing used 64 million fuzzed certificates.