arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2507.09883cs.PL
收藏

BeePL:编译保证正确的内核扩展

BeePL: Correct-by-compilation kernel extensions

Swarn Priya, Frédéric Besson, Connor Sughrue, Tim Steenvoorden, Jamie Fulford, Freek Verbeek, Binoy Ravindran

AI总结:

提出BeePL,一种用于eBPF的领域特定语言,通过形式化验证的类型系统静态强制执行关键安全属性,并扩展CompCert实现编译保证正确的内核扩展,解决了现有eBPF验证器过于保守或不健全的问题。

摘要:

eBPF是一项允许开发者安全扩展内核功能而无需修改内核源代码或开发可加载内核模块的技术。由于内核管理着关键系统操作并执行用户空间与特权数据之间的隔离边界,任何修改其行为的机制都必须满足最高的安全性和正确性标准。为此,eBPF工具链包含一个验证器,在将程序加载到内核之前,静态检查内存访问有效性、有界循环和类型正确性等安全属性。然而,现有的验证器在某些情况下过于保守——拒绝了合法程序,而在其他情况下则不健全,允许违反内核接口预期语义的不安全行为。为了应对这些挑战,我们引入了BeePL,一种用于eBPF的领域特定语言,具有形式化验证的类型系统。BeePL类型系统与语言设计一起,静态强制执行类型正确的内存访问、安全的指针使用、无界循环的缺失以及结构化控制流等关键安全属性。这些保证由形式化类型健全性证明支持,确保类型良好的程序满足eBPF执行环境所需的安全不变量。BeePL还证明了类型良好的源程序满足与内存安全、终止和控制流相关的关键eBPF特定属性,从而在编译前实现高级推理。对于无法完全静态强制执行的属性——如动态边界和未定义行为——BeePL在编译期间插入保持语义的运行时检查。我们开发了一种经过验证的编译策略,扩展CompCert以从BeePL程序生成BPF字节码,为安全内核扩展的端到端可验证工具链奠定了有原则的基础。

英文摘要:

eBPF is a technology that allows developers to safely extend kernel functionality without modifying kernel source code or developing loadable kernel modules. Since the kernel governs critical system operations and enforces isolation boundaries between user space and privileged data, any mechanism that modifies its behavior must meet the highest standards of safety and correctness. To this end, the eBPF toolchain includes a verifier, which statically checks safety properties such as memory access validity, bounded loops, and type correctness before loading the program into the kernel. However, the existing verifier is both overly conservative in some cases-rejecting valid programs-and unsound in others, permitting unsafe behavior that violates the intended semantics of the kernel interface. To address these challenges, we introduce BeePL, a domain-specific language for eBPF with a formally verified type system. The BeePL type system, along with the language design, statically enforces key safety properties such as type-correct memory access, safe pointer usage, absence of unbounded loops, and structured control flow. These guarantees are backed by formal type soundness proofs, ensuring that well-typed programs satisfy the safety invariants required by the eBPF execution environment. BeePL also proves that well-typed source programs meet critical eBPF-specific properties related to memory safety, termination, and control flow, enabling high-level reasoning prior to compilation. For properties not fully enforceable statically-such as dynamic bounds and undefined behavior-BeePL inserts semantics-preserving runtime checks during compilation. We develop a verified compilation strategy that extends CompCert to generate BPF bytecode from BeePL programs, establishing a principled foundation for an end-to-end verifiable toolchain for safe kernel extensions.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑