bpftime:面向Uprobe、系统调用及内核-用户交互的用户空间eBPF运行时
bpftime: userspace eBPF Runtime for Uprobe, Syscall and Kernel-User Interactions
AI总结:
针对内核态eBPF uprobe因上下文切换存在性能瓶颈的问题,提出用户空间eBPF运行时bpftime,通过二进制重写实现uprobe和系统调用挂钩,性能提升10倍,兼容现有工具链,拓展了eBPF的易用性与安全性。
摘要:
在以内核为中心的操作中,eBPF的uprobe组件常遭遇性能瓶颈,这主要归因于上下文切换带来的开销。将eBPF操作转移到用户空间可规避这些阻碍,从而优化性能。这同时也提升了可配置性,且无需内核eBPF所需的root访问权限或特权,进而缩小了内核攻击面。\n本文提出了bpftime,一种新型用户空间eBPF运行时,它利用二进制重写技术实现uprobe和系统调用挂钩(syscall hook)能力。借助bpftime,用户空间uprobe无需两次上下文切换,与内核态的同类实现相比性能提升10倍。此外,该运行时支持以编程方式安全高效地挂钩进程内的系统调用。bpftime可无缝附加到任何正在运行的进程,无需重启或手动重新编译。\n我们的实现还扩展了共享内存中的进程间eBPF Maps,可满足汇总聚合或控制平面通信的需求。它保持了与clang、libbpf等现有eBPF工具链的兼容性,不仅无需任何修改即可简化用户空间eBPF的开发,还能通过BTF支持CO-RE。通过bpftime,我们不仅提升了uprobe性能,还拓展了用户空间eBPF运行时的多功能性和易用性,为更高效、安全的内核操作铺平了道路。
英文摘要:
In kernel-centric operations, the uprobe component of eBPF frequently encounters performance bottlenecks, largely attributed to the overheads borne by context switches. Transitioning eBPF operations to user space bypasses these hindrances, thereby optimizing performance. This also enhances configurability and obviates the necessity for root access or privileges for kernel eBPF, subsequently minimizing the kernel attack surface. This paper introduces bpftime, a novel user-space eBPF runtime, which leverages binary rewriting to implement uprobe and syscall hook capabilities. Through bpftime, userspace uprobes achieve a 10x speed enhancement compared to their kernel counterparts without requiring dual context switches. Additionally, this runtime facilitates the programmatic hooking of syscalls within a process, both safely and efficiently. Bpftime can be seamlessly attached to any running process, limiting the need for either a restart or manual recompilation. Our implementation also extends to interprocess eBPF Maps within shared memory, catering to summary aggregation or control plane communication requirements. Compatibility with existing eBPF toolchains such as clang and libbpf is maintained, not only simplifying the development of user-space eBPF without necessitating any modifications but also supporting CO-RE through BTF. Through bpftime, we not only enhance uprobe performance but also extend the versatility and user-friendliness of eBPF runtime in user space, paving the way for more efficient and secure kernel operations.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。