
Before a single packet is forwarded, the kernel reads the entire program and proves it cannot crash. That proof has a budget, and the budget is where CNI regressions are born.
What an eBPF program is
eBPF is a small virtual machine inside the Linux kernel. A program is a sequence of instructions over a handful of registers, with no ability to dereference arbitrary pointers. It is loaded through the bpf(2) syscall, verified, JIT-compiled, and attached to a hook: a network device's ingress or egress, a socket, a tracepoint, a cgroup.
A CNI uses two hooks heavily:
- tc (traffic control), attached to a
clsactqdisc on the host-side veth or on the node interface. This is where Cilium'sfrom-container/to-containerprograms and Calico'scalico_tc_mainrun. - XDP (eXpress Data Path), attached at the driver's receive hook before the kernel allocates a socket buffer. Cilium uses it for NodePort and DSR acceleration; Calico uses it for its XDP prefilter.
Attachment is not permanent by itself. Programs and links are pinned under /sys/fs/bpf, so an agent restart can reattach without dropping the datapath — and so a program can outlive the agent that created it.
The verifier
The verifier performs abstract interpretation over every reachable path. It tracks each register's type (scalar, pointer, map value, packet pointer), the bounds of every scalar, and whether a value is "precise" — meaning the verifier must keep it exact rather than merging it with alternatives. When two paths meet, it merges their states. When it cannot merge, it explores them separately.
The cost is bounded by BPF_COMPLEXITY_LIMIT_INSNS: 1,000,000 processed instructions. Exceeding it fails the load with -E2BIG, and the log reads like this:
BPF program is too large. Processed 1000001 insn
processed 1000001 insn (verification time ... usec)
The processed budget is what CNIs hit first: a program with loops and many downstream policy branches can be walked combinatorially.
Why a debug build is bigger
Calico's IPv6 extension-header parser walks a loop eight times. Inside that loop, a CALI_DEBUG() call compiles to a bpf_trace_printk helper call. Each helper call is a checkpoint: the verifier must spill and preserve the loop-carried scalars precisely across it, so states that would otherwise merge stay separate, and the large downstream policy path is re-walked once per surviving state.
The upstream commit that fixed this class describes it exactly: the loop is "unrolled 8x and feeds the whole of calico_tc_main", and the debug calls sit "at that state-multiplying chokepoint". Removing them dropped calico_tc_main from 426,491 to 139,718 processed instructions — 67% — with no change to non-debug builds.
That is the shape of the 5.15 problem: not a missing feature, not a syntax error, but a program that fits inside the budget on one kernel's verifier and does not on another's.
Maps, identity and the CNI call
State lives in BPF maps: an IP cache keyed by address, a policy map keyed by endpoint and identity, conntrack, NAT, and the load-balancer tables. Cilium derives a 16-bit security identity from pod labels, so a policy lookup is an identity comparison rather than an address comparison.
The CNI binary is a thin client. On ADD, cilium-cni connects to the agent's Unix socket and requests an endpoint. On DEL, it asks the agent to tear the endpoint down. If the socket is not there, the pod sandbox fails with a message that names Cilium even when Cilium is no longer installed — the exact failure in kubernetes issue #87884.
Seeing the state
Two commands tell you whether the datapath is real:
bpftool net # xdp and tc programs per interface
cilium bpf policy get 1234 # policy map entries for endpoint 1234
bpftool net showing no xdp: section on an interface that should have one is the #17540 signature. An empty policy map for an endpoint that should be denied is the silent-policy signature. Neither is visible in kubectl get pods.

Next: Part 6 — the failures that look like something else: an XDP program that vanishes, a CNI binary that outlives its cluster, and a verifier error that arrives as "node not ready".

Comments (0)