Verified programs can party: optimizing kernel extensions via post-verification merging

H. Kuo, Kaiyu Chen, Yicheng Lu, Daniel W. Williams, Sibin Mohan, Tianyi Xu
{"title":"Verified programs can party: optimizing kernel extensions via post-verification merging","authors":"H. Kuo, Kaiyu Chen, Yicheng Lu, Daniel W. Williams, Sibin Mohan, Tianyi Xu","doi":"10.1145/3492321.3519562","DOIUrl":null,"url":null,"abstract":"Operating system (OS) extensions are more popular than ever. For example, Linux BPF is marketed as a \"superpower\" that allows user programs to be downloaded into the kernel, verified to be safe and executed at kernel hook points. So, BPF extensions have high performance and are often placed at performance-critical paths for tracing and filtering. However, although BPF extension programs execute in a shared kernel environment and are already individually verified, they are often executed independently in chains. We observe that the chain pattern has large performance overhead, due to indirect jumps penalized by security mitigations (e.g., Spectre), loops, and memory accesses. In this paper, we argue for a separation of concerns. We propose to decouple the execution of BPF extensions from their verification requirements---BPF extension programs can be collectively optimized, after each BPF extension program is individually verified and loaded into the shared kernel. We present KFuse, a framework that dynamically and automatically merges chains of BPF programs by transforming indirect jumps into direct jumps, unrolling loops, and saving memory accesses, without loss of security or flexibility. KFuse can merge BPF programs that are (1) installed by multiple principals, (2) maintained to be modular and separate, (3) installed at different points of time, and (4) split into smaller, verifiable programs via BPF tail calls. KFuse demonstrates 85% performance improvement of BPF chain execution and 7% of application performance improvement over existing BPF use cases (systemd's Seccomp BPF filters). It achieves more significant benefits for longer chains.","PeriodicalId":196414,"journal":{"name":"Proceedings of the Seventeenth European Conference on Computer Systems","volume":"175 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2022-03-28","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"6","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the Seventeenth European Conference on Computer Systems","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3492321.3519562","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 6

Abstract

Operating system (OS) extensions are more popular than ever. For example, Linux BPF is marketed as a "superpower" that allows user programs to be downloaded into the kernel, verified to be safe and executed at kernel hook points. So, BPF extensions have high performance and are often placed at performance-critical paths for tracing and filtering. However, although BPF extension programs execute in a shared kernel environment and are already individually verified, they are often executed independently in chains. We observe that the chain pattern has large performance overhead, due to indirect jumps penalized by security mitigations (e.g., Spectre), loops, and memory accesses. In this paper, we argue for a separation of concerns. We propose to decouple the execution of BPF extensions from their verification requirements---BPF extension programs can be collectively optimized, after each BPF extension program is individually verified and loaded into the shared kernel. We present KFuse, a framework that dynamically and automatically merges chains of BPF programs by transforming indirect jumps into direct jumps, unrolling loops, and saving memory accesses, without loss of security or flexibility. KFuse can merge BPF programs that are (1) installed by multiple principals, (2) maintained to be modular and separate, (3) installed at different points of time, and (4) split into smaller, verifiable programs via BPF tail calls. KFuse demonstrates 85% performance improvement of BPF chain execution and 7% of application performance improvement over existing BPF use cases (systemd's Seccomp BPF filters). It achieves more significant benefits for longer chains.
经过验证的程序可以通过验证后合并来优化内核扩展
操作系统(OS)扩展比以往任何时候都更加流行。例如,Linux BPF被宣传为一种“超级功能”,它允许将用户程序下载到内核中,验证其安全性并在内核钩子点执行。因此,BPF扩展具有高性能,并且通常放置在用于跟踪和过滤的性能关键路径上。然而,尽管BPF扩展程序在共享内核环境中执行并且已经单独验证,但它们通常在链中独立执行。我们观察到,由于安全缓解(例如Spectre)、循环和内存访问造成的间接跳转,链模式具有很大的性能开销。在本文中,我们主张分离关注点。我们建议将BPF扩展的执行与其验证需求解耦——在每个BPF扩展程序被单独验证并加载到共享内核之后,BPF扩展程序可以被集体优化。我们提出了KFuse,一个动态和自动合并BPF程序链的框架,通过将间接跳转转换为直接跳转,展开循环和节省内存访问,而不会失去安全性和灵活性。KFuse可以合并以下BPF程序:(1)由多个主体安装,(2)保持模块化和独立,(3)安装在不同的时间点,以及(4)通过BPF尾部调用拆分为更小的,可验证的程序。KFuse显示,与现有的BPF用例(systemd的Seccomp BPF过滤器)相比,BPF链执行的性能提高了85%,应用程序性能提高了7%。对于更长的链,它可以获得更大的好处。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信