Verified programs can party: optimizing kernel extensions via post-verification merging
Verified programs can party: optimizing kernel extensions via post-verification merging
复制标题
DOI:
10.1145/3492321.3519562
复制
发表时间:
2022-03
期刊:
影响因子:
--
通讯作者:
H. Kuo;Kaiyu Chen;Yicheng Lu;Daniel W. Williams;Sibin Mohan;Tianyi Xu
中科院分区:
文献类型:
--
作者:
H. Kuo;Kaiyu Chen;Yicheng Lu;Daniel W. Williams;Sibin Mohan;Tianyi Xu
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.