Kops: Safely Extending the eBPF Compilation Pipeline with Native Operations

Kops is a secure extension interface that accelerates eBPF programs by allowing userspace compilers and kernel modules to introduce new native operations—verified via vanilla eBPF proof sequences—thereby achieving significant performance gains without expanding the kernel's trusted computing base.

Original authors: Yusheng Zheng, Zhengjie Ji, Weichen Tao, Hao Sun, Wei Zhang, Dan Williams, Andi Quinn

Published 2026-06-24
📖 4 min read☕ Coffee break read

Original authors: Yusheng Zheng, Zhengjie Ji, Weichen Tao, Hao Sun, Wei Zhang, Dan Williams, Andi Quinn

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine the operating system (the "brain" of your computer) has a very strict security guard. This guard, called the eBPF Verifier, checks every little program (like a traffic cop or a security scanner) before letting it run inside the kernel. The guard is incredibly careful: it only allows programs written in a very simple, safe language.

Once the guard says, "Okay, this is safe," a translator (the JIT Compiler) turns that simple language into the computer's native language so it can run fast.

The Problem: The "One-Word-at-a-Time" Translator

The paper explains that the current translator is designed to be super simple and trustworthy. It translates the safe program one instruction at a time, in a single pass. It doesn't look ahead or try to be clever.

Think of it like a translator who is forbidden from using idioms or shortcuts. If you want to say "rotate a number," the safe language doesn't have a single word for that. So, the translator has to write out a long, clunky sentence using ten different words to explain the same thing.

  • Result: The computer has to read and execute a long, messy sentence instead of a single, powerful command. This makes eBPF programs run up to twice as slow as they could if they were written in the native language directly.

The Solution: Kops (The "Magic Passport")

The authors created a system called Kops. Think of Kops as a special "Magic Passport" system that lets the computer use powerful, native shortcuts without breaking the security guard's rules.

Here is how it works, using a simple analogy:

  1. The Two-Part Passport: Every new "shortcut" (like a hardware rotation or a conditional selection) comes with two parts:

    • The Proof (The Safe Version): A long, boring, step-by-step explanation written in the safe language. The security guard checks this to make sure it's safe.
    • The Native Emit (The Magic Version): A single, powerful instruction that the computer's hardware actually executes.
  2. The Process:

    • Before the program runs, a "Recognizer" (a smart tool outside the kernel) looks for patterns. If it sees a long, clunky sentence that matches a known shortcut, it swaps it out for the "Magic Passport."
    • The Security Guard still sees the long, boring "Proof" version. It checks that, says "Safe," and gives the green light.
    • The Translator then sees the "Magic Passport." Instead of translating the long sentence, it simply swaps it for the single, powerful native instruction.
  3. The Safety Guarantee: The security guard never sees the "Magic" version. It only trusts the "Proof." The only new thing the system has to trust is the specific code that turns the "Proof" into the "Magic" instruction. The authors proved mathematically (using a tool called Lean 4) that the "Magic" instruction does exactly the same thing as the long "Proof" sentence.

What Did They Build? (EInsn)

Using Kops, they built a set of seven specific shortcuts called EInsn. These are things computers are really good at doing in one step (like rotating bits or picking between two values) but which the safe language usually forces to be done in many steps.

The Results

  • Speed: By using these shortcuts, they made eBPF programs run 24% faster on some computers and 22% faster on others. In real-world applications (like network traffic management), they saw up to a 12% speed boost.
  • Safety: They didn't have to change the security guard's rules or make the translator more complex. The "trusted" part of the system stayed tiny and safe.
  • Flexibility: If a computer doesn't support a specific shortcut, the system just falls back to the long, safe version. It doesn't break.

The Big Picture

Imagine you are driving a car (the computer). The current rules say you must drive at 20 mph because the speedometer is broken and can only read in 5-mph increments. You can't go faster, even if the road is clear.

Kops is like a special license that says: "We know you are driving safely (the Proof), so we will let you use the car's actual speedometer (the Native Emit) to go faster, but only on specific, pre-approved roads."

They proved that this new way of driving is just as safe as the old way, but it gets you to your destination much quicker.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →