Lune

SIGCOMM2021Top-tier venue

Synthesizing safe and efficient kernel extensions for packet processing

Qiongwen Xu, Michael D. Wong, Tanvi Wagle, Srinivas Narayana, Anirudh Sivaraman

Abstract

Extended Berkeley Packet Filter (BPF) has emerged as a powerful method to extend packet-processing functionality in the Linux operating system. BPF allows users to write code in high-level languages (like C or Rust) and execute them at specific hooks in the kernel, such as the network device driver. To ensure safe execution of a user-developed BPF program in kernel context, Linux uses an in-kernel static checker. The checker allows a program to execute only if it can prove that the program is crash-free, always accesses memory within safe bounds, and avoids leaking kernel data.

BPF programming is not easy. One, even modest-sized BPF programs are deemed too large to analyze and rejected by the kernel checker. Two, the kernel checker may incorrectly determine that a BPF program exhibits unsafe behaviors. Three, even small performance optimizations to BPF code (e.g., 5% gains) must be meticulously hand-crafted by expert developers. Traditional optimizing compilers for BPF are often inadequate since the kernel checker's safety constraints are incompatible with rule-based optimizations.

We present K2, a program-synthesis-based compiler that automatically optimizes BPF bytecode with formal correctness and safety guarantees. K2 produces code with 6-26% reduced size, 1.36%-55.03% lower average packet-processing latency, and 0-4.75% higher throughput (packets per second per core) relative to the best clang-compiled program, across benchmarks drawn from Cilium, Facebook, and the Linux kernel. K2 incorporates several domainspecific techniques to make synthesis practical by accelerating equivalence-checking of BPF programs by 6 orders of magnitude.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

13 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Formal Methods for Network Performance Analysis cites Switch Code Generation Using Program Synthesis
  • Verified programs can party: optimizing kernel extensions via post-verification merging cites Synthesizing JIT Compilers for In-Kernel DSLs
  • Verified programs can party: optimizing kernel extensions via post-verification merging cites Specification and verification in the field: Applying formal methods to BPF just-in-time compilers in the Linux kernel
  • Verifying the Verifier: eBPF Range Analysis Verification cites Synthesizing JIT Compilers for In-Kernel DSLs
  • Verifying the Verifier: eBPF Range Analysis Verification cites Dataflow-based pruning for speeding up superoptimization
  • Verifying the Verifier: eBPF Range Analysis Verification cites Specification and verification in the field: Applying formal methods to BPF just-in-time compilers in the Linux kernel
  • Specification and verification in the field: Applying formal methods to BPF just-in-time compilers in the Linux kernel cites Synthesizing JIT Compilers for In-Kernel DSLs
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers13

  1. Verifying the Verifier: eBPF Range Analysis VerificationHarishankar Vishwanathan, Matan Shachnai, Srinivas Narayana, Santosh NagarakatteCAV 2023 · 37 citations
  2. Formal Methods for Network Performance AnalysisMina Tahmasbi Arashloo, Ryan Beckett, Rachit AgarwalNSDI 2023 · 27 citations
  3. LiteFlow: towards high-performance adaptive neural networks for kernel datapathJunxue Zhang, Chaoliang Zeng, Hong Zhang, Shuihai Hu et al.SIGCOMM 2022 · 23 citations
  4. Verified programs can party: optimizing kernel extensions via post-verification mergingHsuan-Chi Kuo, Kai-Hsun Chen, Yicheng Lu, Dan Williams et al.EuroSys 2022 · 17 citations
  5. Meissa: scalable network testing for programmable data planesNaiqian Zheng, Mengqi Liu, Ennan Zhai, Hongqiang Harry Liu et al.SIGCOMM 2022 · 17 citations

Builds on5

  1. Specification and verification in the field: Applying formal methods to BPF just-in-time compilers in the Linux kernelLuke Nelson, Jacob Van Geffen, Emina Torlak, Xi WangOSDI 2020 · 72 citations
  2. Switch Code Generation Using Program SynthesisXiangyu Gao, Taegyun Kim, Michael D. Wong, Divya Raghunathan et al.SIGCOMM 2020 · 51 citations
  3. Reconciling enumerative and deductive program synthesisKangjing Huang, Xiaokang Qiu, Peiyuan Shen, Yanjun WangPLDI 2020 · 46 citations
  4. Synthesizing JIT Compilers for In-Kernel DSLsJacob Van Geffen, Luke Nelson, Isil Dillig, Xi Wang et al.CAV 2020 · 27 citations
  5. Dataflow-based pruning for speeding up superoptimizationManasij Mukherjee, Pranav Kant, Zhengyang Liu, John RegehrOOPSLA 2020 · 21 citations

Related papers

  1. EPSO: A Caching-Based Efficient Superoptimizer for BPF BytecodeQian Zhu, Yuxuan Liu, Ziyuan Zhu, Shangqing Liu et al.ASE 2025
  2. Merlin: Multi-tier Optimization of eBPF Code for Performance and CompactnessJinsong Mao, Hailun Ding, Juan Zhai, Shiqing MaASPLOS 2024 · 15 citations
  3. VEP: A Two-stage Verification Toolchain for Full eBPF ProgrammabilityXiwei Wu, Yueyang Feng, Tianyi Huang, Xiaoyang Lu et al.NSDI 2025 · 8 citations
  4. LDBF: Deep Exploration of eBPF Runtime via LLM-Driven Program Generation and Adaptive Context OrchestrationYinhao Hu, Kaiyan Mei, Zeyu Sun, Quan Sun et al.CCS 2026
  5. Rex: Closing the language-verifier gap with safe and usable kernel extensionsJinghao Jia, Ruowen Qin, Milo Craun, Egor Lukiyanov et al.USENIX ATC 2025 · 11 citations
Dusk over the sea between two cliffs drawn in fine vertical lines