- A curated list of awesome projects related to eBPF: [https://github.com/zoidbergwill/awesome-ebpf](https://github.com/zoidbergwill/awesome-ebpf)
> Check out our open-source projects at [eunomia-bpf](https://github.com/eunomia-bpf) and eBPF tutorials at [bpf-developer-tutorial](https://github.com/eunomia-bpf/bpf-developer-tutorial). I'm also looking for a PhD position in the area of systems and networking in 2024/2025. My [Github](https://github.com/yunwei37) and [email](https://eunomia.dev/tutorials/18-further-reading/).
## XRP: In-Kernel Storage Functions with eBPF
With the emergence of microsecond-scale NVMe storage devices, the Linux kernel storage stack overhead has become significant, almost doubling access times. We present XRP, a framework that allows applications to execute user-defined storage functions, such as index lookups or aggregations, from an eBPF hook in the NVMe driver, safely bypassing most of the kernel’s storage stack. To preserve file system semantics, XRP propagates a small amount of kernel state to its NVMe driver hook where the user-registered eBPF functions are called. We show how two key-value stores, BPF-KV, a simple B+-tree key-value store, and WiredTiger, a popular log-structured merge tree storage engine, can leverage XRP to significantly improve throughput and latency.
マイクロ秒スケールの [[NVMe]] ストレージデバイスの登場により、Linux カーネルのストレージスタックのオーバーヘッドは大きくなり、アクセス時間はほぼ 2 倍になりました。我々は、アプリケーションが、カーネルのストレージスタックの大部分を安全にバイパスして、NVMe ドライバの eBPF フックからインデックス検索や集約などのユーザー定義のストレージ機能を実行できるフレームワーク、XRP を紹介します。ファイルシステムのセマンティクスを維持するため、XRP は、ユーザー登録済みの eBPF 関数が呼び出される NVMe ドライバフックに、少量のカーネル状態を伝播します。2 つのキーバリューストア、BPF-KV(シンプルな B+ ツリーキーバリューストア)と WiredTiger(人気のあるログ構造マージツリーストレージエンジン)が、XRP を活用してスループットとレイテンシを大幅に改善する方法を紹介します。
OSDI '22 Best Paper: [https://www.usenix.org/conference/osdi22/presentation/zhong](https://www.usenix.org/conference/osdi22/presentation/zhong)
## Specification and verification in the field: Applying formal methods to BPF just-in-time compilers in the Linux kernel
This paper describes our experience applying formal methods to a critical component in the Linux kernel, the just-in-time compilers ("JITs") for the Berkeley Packet Filter (BPF) virtual machine. We verify these JITs using Jitterbug, the first framework to provide a precise specification of JIT correctness that is capable of ruling out real-world bugs, and an automated proof strategy that scales to practical implementations. Using Jitterbug, we have designed, implemented, and verified a new BPF JIT for 32-bit RISC-V, found and fixed 16 previously unknown bugs in five other deployed JITs, and developed new JIT optimizations; all of these changes have been upstreamed to the Linux kernel. The results show that it is possible to build a verified component within a large, unverified system with careful design of specification and proof strategy.
本論文では、Linux カーネルの重要なコンポーネントである、Berkeley Packet Filter (BPF) 仮想マシン用のジャストインタイムコンパイラ (JIT) に形式手法を適用した経験について述べます。我々は、現実世界のバグを排除できる JIT の正確性を正確に仕様化する最初のフレームワークである Jitterbug と、実用的な実装に拡張可能な自動証明戦略を用いて、これらの JIT を検証しました。Jitterbug を使用して、32 ビット RISC-V 用の新しい BPF JIT を設計、実装、検証し、他の 5 つの JIT で 16 件の未知のバグを発見、修正し、新しい JIT 最適化を開発しました。これらの変更はすべて、Linux カーネルにアップストリームされています。この結果は、仕様と証明戦略を慎重に設計することで、検証されていない大規模なシステム内に検証済みのコンポーネントを構築することが可能であることを示しています。
OSDI 20: [https://www.usenix.org/conference/osdi20/presentation/nelson](https://www.usenix.org/conference/osdi20/presentation/nelson)
## λ-IO: A Unified IO Stack for Computational Storage
The emerging computational storage device offers an opportunity for in-storage computing. It alleviates the overhead of data movement between the host and the device, and thus accelerates data-intensive applications. In this paper, we present λ-IO, a unified IO stack managing both computation and storage resources across the host and the device. We propose a set of designs – interface, runtime, and scheduling – to tackle three critical issues. We implement λ-IO in full-stack software and hardware environment, and evaluate it with synthetic and real applications against Linux IO, showing up to 5.12× performance improvement.
新しいコンピューティング・ストレージ・デバイスは、ストレージ内コンピューティングの可能性を開きます。ホストとデバイス間のデータ移動のオーバーヘッドを軽減し、データ集約型アプリケーションの高速化を実現します。本論文では、ホストとデバイス間の計算リソースとストレージリソースを統合的に管理する、統一された IO スタック「λ-IO」を紹介します。3つの重要な課題に対処するため、インターフェース、ランタイム、スケジューリングという一連の設計を提案しています。λ-IOをフルスタックソフトウェアおよびハードウェア環境に実装し、Linux IOに対して合成アプリケーションおよび実アプリケーションで評価したところ、最大5.12倍のパフォーマンス向上を確認しました。
FAST23: [https://www.usenix.org/conference/fast23/presentation/yang-zhe](https://www.usenix.org/conference/fast23/presentation/yang-zhe)
## Extension Framework for File Systems in User space
User file systems offer numerous advantages over their in-kernel implementations, such as ease of development and better system reliability. However, they incur heavy performance penalty. We observe that existing user file system frameworks are highly general; they consist of a minimal interposition layer in the kernel that simply forwards all low-level requests to user space. While this design offers flexibility, it also severely degrades performance due to frequent kernel-user context switching.
This work introduces ExtFUSE, a framework for developing extensible user file systems that also allows applications to register "thin" specialized request handlers in the kernel to meet their specific operative needs, while retaining the complex functionality in user space. Our evaluation with two FUSE file systems shows that ExtFUSE can improve the performance of user file systems with less than a few hundred lines on average. ExtFUSE is available on GitHub.
ATC 19: [https://www.usenix.org/conference/atc19/presentation/bijlani](https://www.usenix.org/conference/atc19/presentation/bijlani)
ユーザーファイルシステムは、開発が容易でシステムの信頼性が高いなど、カーネル内部実装に比べて多くの利点があります。しかし、その一方で、パフォーマンスが大幅に低下するという欠点があります。既存のユーザーファイルシステムフレームワークは、カーネル内にすべての低レベル要求をユーザー空間に転送するだけの最小限の介在層で構成される、非常に汎用性の高いものです。この設計は柔軟性がありますが、カーネルとユーザーのコンテキストの切り替えが頻繁に行われるため、パフォーマンスが大幅に低下します。
本研究では、拡張可能なユーザーファイルシステムを開発するためのフレームワーク「ExtFUSE」を提案します。ExtFUSEは、アプリケーションが特定の運用要件を満たすためにカーネルに「薄い」専門的なリクエストハンドラーを登録できるようにしつつ、複雑な機能をユーザー空間に保持する仕組みを提供します。2つのFUSEファイルシステムでの評価結果から、ExtFUSEは平均で数百行未満のコード追加でユーザーファイルシステムのパフォーマンスを向上させることが確認されました。ExtFUSEはGitHubで公開されています。
## Electrode: Accelerating Distributed Protocols with eBPF
Implementing distributed protocols under a standard Linux kernel networking stack enjoys the benefits of load-aware CPU scaling, high compatibility, and robust security and isolation. However, it suffers from low performance because of excessive user-kernel crossings and kernel networking stack traversing. We present Electrode with a set of eBPF-based performance optimizations designed for distributed protocols. These optimizations get executed in the kernel before the networking stack but achieve similar functionalities as were implemented in user space (e.g., message broadcasting, collecting quorum of acknowledgments), thus avoiding the overheads incurred by user-kernel crossings and kernel networking stack traversing. We show that when applied to a classic Multi-Paxos state machine replication protocol, Electrode improves its throughput by up to 128.4% and latency by up to 41.7%.
NSDI 23: [https://www.usenix.org/conference/nsdi23/presentation/zhou](https://www.usenix.org/conference/nsdi23/presentation/zhou)
標準的な Linux カーネルネットワークスタックで分散プロトコルを実装すると、負荷認識 CPU スケーリング、高い互換性、堅牢なセキュリティおよび分離というメリットがあります。しかし、ユーザーとカーネル間のクロスオーバーやカーネルネットワークスタックのトラバーサルが過多になるため、パフォーマンスが低下するという欠点があります。我々は、分散プロトコル用に設計された一連の eBPF ベースのパフォーマンス最適化機能を備えた Electrode を紹介します。これらの最適化は、ネットワークスタックの前にカーネル内で実行されますが、ユーザースペースで実装された機能(例:メッセージブロードキャスト、承認のクォーラム収集)と類似の機能を実現し、ユーザカーネル間切り替えやカーネルネットワークスタックのトラバーサルによるオーバーヘッドを回避します。Electrode を、従来の Multi-Paxos ステートマシン複製プロトコルに適用した場合、スループットが最大 128.4%、レイテンシが最大 41.7% 向上することを示します。
## BMC: Accelerating Memcached using Safe In-kernel Caching and Pre-stack Processing
In-memory key-value stores are critical components that help scale large internet services by providing low-latency access to popular data. Memcached, one of the most popular key-value stores, suffers from performance limitations inherent to the Linux networking stack and fails to achieve high performance when using high-speed network interfaces. While the Linux network stack can be bypassed using DPDK based solutions, such approaches require a complete redesign of the software stack and induce high CPU utilization even when client load is low.
To overcome these limitations, we present BMC, an in-kernel cache for Memcached that serves requests before the execution of the standard network stack. Requests to the BMC cache are treated as part of the NIC interrupts, which allows performance to scale with the number of cores serving the NIC queues. To ensure safety, BMC is implemented using eBPF. Despite the safety constraints of eBPF, we show that it is possible to implement a complex cache service. Because BMC runs on commodity hardware and requires modification of neither the Linux kernel nor the Memcached application, it can be widely deployed on existing systems. BMC optimizes the processing time of Facebook-like small-size requests. On this target workload, our evaluations show that BMC improves throughput by up to 18x compared to the vanilla Memcached application and up to 6x compared to an optimized version of Memcached that uses the SO\_REUSEPORT socket flag. In addition, our results also show that BMC has negligible overhead and does not deteriorate throughput when treating non-target workloads.
NSDI 21: [https://www.usenix.org/conference/nsdi21/presentation/ghigoff](https://www.usenix.org/conference/nsdi21/presentation/ghigoff)
インメモリキーバリューストアは、人気のあるデータへの低遅延アクセスを提供することで、大規模なインターネットサービスをスケールさせるための重要なコンポーネントです。Memcachedは最も人気のあるキーバリューストアの一つですが、Linuxのネットワークスタックに内在する性能制限により、高速ネットワークインターフェースを使用する際には高い性能を達成できません。Linuxのネットワークスタックを[[DPDK]]ベースのソリューションでバイパスすることは可能ですが、このようなアプローチはソフトウェアスタックの完全な再設計を必要とし、クライアント負荷が低い場合でも高いCPU利用率を引き起こします。
これらの制限を克服するため、我々は、標準のネットワークスタックの実行前にリクエストを処理する、[[Memcached]] 用のカーネル内キャッシュである BMC を提案する。BMC キャッシュへのリクエストは NIC 割り込みの一部として扱われるため、NIC キューを処理するコアの数に応じてパフォーマンスをスケーリングすることができる。安全性を確保するため、BMC は eBPF を使用して実装されている。eBPF の安全上の制約にもかかわらず、複雑なキャッシュサービスを実装できることを示しています。BMC は、汎用ハードウェア上で動作し、Linux カーネルや Memcached アプリケーションの変更を必要としないため、既存のシステムに広く導入することができます。BMC は、Facebook のような小規模なリクエストの処理時間を最適化します。このターゲットワークロードにおいて、当社の評価結果では、BMCはvanilla Memcachedアプリケーションと比較して最大18倍、SO\_REUSEPORTソケットフラグを使用する最適化されたMemcachedバージョンと比較して最大6倍の通過量を向上させます。さらに、当社の結果は、BMCがターゲットワークロード以外の処理においても無視できるオーバーヘッドを有し、通過量を低下させないことを示しています。
## hXDP: Efficient Software Packet Processing on FPGA NICs
FPGA accelerators on the NIC enable the offloading of expensive packet processing tasks from the CPU. However, FPGAs have limited resources that may need to be shared among diverse applications, and programming them is difficult.
We present a solution to run Linux's eXpress Data Path programs written in eBPF on FPGAs, using only a fraction of the available hardware resources while matching the performance of high-end CPUs. The iterative execution model of eBPF is not a good fit for FPGA accelerators. Nonetheless, we show that many of the instructions of an eBPF program can be compressed, parallelized or completely removed, when targeting a purpose-built FPGA executor, thereby significantly improving performance. We leverage that to design hXDP, which includes (i) an optimizing-compiler that parallelizes and translates eBPF bytecode to an extended eBPF Instruction-set Architecture defined by us; a (ii) soft-processor to execute such instructions on FPGA; and (iii) an FPGA-based infrastructure to provide XDP's maps and helper functions as defined within the Linux kernel.
We implement hXDP on an FPGA NIC and evaluate it running real-world unmodified eBPF programs. Our implementation is clocked at 156.25MHz, uses about 15% of the FPGA resources, and can run dynamically loaded programs. Despite these modest requirements, it achieves the packet processing throughput of a high-end CPU core and provides a 10x lower packet forwarding latency.
OSDI 20: [https://www.usenix.org/conference/osdi20/presentation/brunella](https://www.usenix.org/conference/osdi20/presentation/brunella)
NIC の FPGA アクセラレータにより、CPU から高コストのパケット処理タスクをオフロードすることができます。しかし、FPGA はリソースが限られており、さまざまなアプリケーションで共有する必要があり、プログラミングも困難です。
我々は、利用可能なハードウェアリソースのごく一部のみを使用しながら、ハイエンド CPU と同等のパフォーマンスを実現し、eBPF で記述された Linux の eXpress Data Path プログラムを FPGA で実行するためのソリューションをご紹介します。eBPF の反復実行モデルは、FPGA アクセラレータにはあまり適していません。しかし、専用 FPGA エクゼキュータをターゲットにすると、eBPF プログラムの多くの命令を圧縮、並列化、または完全に削除することができ、パフォーマンスを大幅に向上できることを示します。これを活用して、hXDP を設計しました。hXDP には、(i) eBPF バイトコードを並列化し、我々が定義した拡張 eBPF 命令セットアーキテクチャに変換する最適化コンパイラ、(ii) FPGA 上でそのような命令を実行するソフトプロセッサ、および (iii) Linux カーネル内で定義されている XDP のマップおよびヘルパー関数を提供する FPGA ベースのインフラストラクチャが含まれています。
我々は、hXDP を FPGA NIC に実装し、実環境の eBPF プログラムをそのまま実行して評価しました。この実装は 156.25MHz で動作し、FPGA リソースの約 15% を使用し、動的にロードされたプログラムを実行することができます。これらの控えめな要件にもかかわらず、ハイエンド CPU コアと同等のパケット処理スループットを達成し、パケット転送遅延を 10 分の 1 に短縮しています。
## Network-Centric Distributed Tracing with DeepFlow: Troubleshooting Your Microservices in Zero Code [[2023__SIGCOMM__Network-Centric Distributed Tracing with DeepFlow - Troubleshooting Your Microservices in Zero Code|Shen+, SIGCOMM2023]]
Microservices are becoming more complicated, posing new challenges for traditional performance monitoring solutions. On the one hand, the rapid evolution of microservices places a significant burden on the utilization and maintenance of existing distributed tracing frameworks. On the other hand, complex infrastructure increases the probability of network performance problems and creates more blind spots on the network side. In this paper, we present DeepFlow, a network-centric distributed tracing framework for troubleshooting microservices. DeepFlow provides out-of-the-box tracing via a network-centric tracing plane and implicit context propagation. In addition, it eliminates blind spots in network infrastructure, captures network metrics in a low-cost way, and enhances correlation between different components and layers. We demonstrate analytically and empirically that DeepFlow is capable of locating microservice performance anomalies with negligible overhead. DeepFlow has already identified over 71 critical performance anomalies for more than 26 companies and has been utilized by hundreds of individual developers. Our production evaluations demonstrate that DeepFlow is able to save users hours of instrumentation efforts and reduce troubleshooting time from several hours to just a few minutes.
SIGCOMM 23: [https://dl.acm.org/doi/10.1145/3603269.3604823](https://dl.acm.org/doi/10.1145/3603269.3604823)
マイクロサービスはますます複雑化しており、従来のパフォーマンス監視ソリューションに新たな課題をもたらしています。一方では、マイクロサービスの急速な進化により、既存の分散トレーシングフレームワークの利用と保守に多大な負担がかかっています。他方では、インフラストラクチャの複雑化により、ネットワークパフォーマンスの問題が発生する可能性が高まり、ネットワーク側にブラインドスポットが増えています。本論文では、マイクロサービスのトラブルシューティングのためのネットワーク中心の分散トレーシングフレームワークである DeepFlow について紹介します。DeepFlow は、ネットワーク中心のトレースプレーンと暗黙的なコンテキスト伝播により、すぐに使えるトレース機能を提供します。さらに、ネットワークインフラストラクチャの盲点を排除し、低コストでネットワークメトリクスをキャプチャし、異なるコンポーネントやレイヤー間の相関関係を強化します。DeepFlow は、ごくわずかなオーバーヘッドでマイクロサービスのパフォーマンス異常を特定できることを、分析的および経験的に実証しています。DeepFlowは、26社を超える企業で71件を超える重要なパフォーマンス異常を特定し、数百人の開発者に利用されています。生産環境での評価では、DeepFlowがユーザーの数時間のインストルメンテーション作業を節約し、トラブルシューティング時間を数時間から数分に短縮できることが示されています。
## Fast In-kernel Traffic Sketching in eBPF
The extended Berkeley Packet Filter (eBPF) is an infrastructure that allows to dynamically load and run micro-programs directly in the Linux kernel without recompiling it.
In this work, we study how to develop high-performance network measurements in eBPF. We take sketches as case-study, given their ability to support a wide-range of tasks while providing low-memory footprint and accuracy guarantees. We implemented NitroSketch, the state-of-the-art sketch for user-space networking and show that best practices in user-space networking cannot be directly applied to eBPF, because of its different performance characteristics. By applying our lesson learned we improve its performance by 40% compared to a naive implementation.
SIGCOMM 23: [https://dl.acm.org/doi/abs/10.1145/3594255.3594256](https://dl.acm.org/doi/abs/10.1145/3594255.3594256)
拡張バークレーパケットフィルタ (eBPF) は、Linux カーネルを再コンパイルすることなく、マイクロプログラムを動的にロードして実行できるインフラストラクチャです。
この研究では、eBPF において高性能なネットワーク測定を開発する方法を研究しています。幅広いタスクをサポートし、低メモリフットプリントと精度保証を提供するスケッチをケーススタディとして採用しました。ユーザースペースネットワーク用の最先端のスケッチである NitroSketch を実装し、そのパフォーマンス特性が異なるため、ユーザースペースネットワークのベストプラクティスは eBPF に直接適用できないことを示しました。この教訓を応用することで、単純な実装に比べパフォーマンスを 40% 向上させました。
## SPRIGHT: extracting the server from serverless computing! high-performance eBPF-based event-driven, shared-memory processing
Serverless computing promises an efficient, low-cost compute capability in cloud environments. However, existing solutions, epitomized by open-source platforms such as Knative, include heavyweight components that undermine this goal of serverless computing. Additionally, such serverless platforms lack dataplane optimizations to achieve efficient, high-performance function chains that facilitate the popular microservices development paradigm. Their use of unnecessarily complex and duplicate capabilities for building function chains severely degrades performance. 'Cold-start' latency is another deterrent.
We describe SPRIGHT, a lightweight, high-performance, responsive serverless framework. SPRIGHT exploits shared memory processing and dramatically improves the scalability of the dataplane by avoiding unnecessary protocol processing and serialization-deserialization overheads. SPRIGHT extensively leverages event-driven processing with the extended Berkeley Packet Filter (eBPF). We creatively use eBPF's socket message mechanism to support shared memory processing, with overheads being strictly load-proportional. Compared to constantly-running, polling-based DPDK, SPRIGHT achieves the same dataplane performance with 10× less CPU usage under realistic workloads. Additionally, eBPF benefits SPRIGHT, by replacing heavyweight serverless components, allowing us to keep functions 'warm' with negligible penalty.
Our preliminary experimental results show that SPRIGHT achieves an order of magnitude improvement in throughput and latency compared to Knative, while substantially reducing CPU usage, and obviates the need for 'cold-start'.
[https://dl.acm.org/doi/10.1145/3544216.3544259](https://dl.acm.org/doi/10.1145/3544216.3544259)
サーバーレスコンピューティングは、クラウド環境において効率的で低コストな計算リソースを提供することを約束しています。しかし、[[Knative]]のようなオープンソースプラットフォームに代表される既存のソリューションには、サーバーレスコンピューティングの目的を損なう重いコンポーネントが含まれています。さらに、これらのサーバーレスプラットフォームは、マイクロサービス開発パラダイムを促進する効率的で高性能な関数チェーンを実現するためのデータプレーン最適化が欠如しています。関数チェーンを構築するために不要に複雑で重複した機能を使用することは、パフォーマンスを著しく低下させます。「コールドスタート」のレイテンシも、もう 1 つの障害となっています。
我々は、軽量、高性能、応答性に優れたサーバーレスフレームワークである SPRIGHT について紹介する。SPRIGHT は、共有メモリ処理を活用し、不要なプロトコル処理やシリアル化・デシリアル化のオーバーヘッドを回避することで、データプレーンのスケーラビリティを劇的に向上させている。SPRIGHT は、拡張 Berkeley Packet Filter (eBPF) によるイベント駆動型処理を幅広く活用している。我々は、eBPF のソケットメッセージメカニズムを創造的に活用して、オーバーヘッドを厳密に負荷比例で共有メモリ処理をサポートしています。常時実行のポーリングベースの DPDK と比較すると、SPRIGHT は現実的なワークロードで 10 分の 1 の CPU 使用率で同じデータプレーンパフォーマンスを実現しています。さらに、eBPF は、重量のあるサーバーレスコンポーネントを置き換えることで SPRIGHT にメリットをもたらし、わずかなペナルティで機能を「ウォーム」に保つことを可能にしています。
当社の予備的な実験結果では、SPRIGHTはKnativeと比較してスループットと遅延で1桁の改善を実現し、CPU使用量を大幅に削減するとともに、『コールドスタート』の必要性を排除しています。
## KEN: Kernel Extensions using Natural Language
The ability to modify and extend an operating system is an important feature for improving a system's security, reliability, and performance. The extended Berkeley Packet Filters (eBPF) ecosystem has emerged as the standard mechanism for extending the Linux kernel and has recently been ported to Windows. eBPF programs inject new logic into the kernel that the system will execute before or after existing logic. While the eBPF ecosystem provides a flexible mechanism for kernel extension, it is difficult for developers to write eBPF programs today. An eBPF developer must have deep knowledge of the internals of the operating system to determine where to place logic and cope with programming limitations on the control flow and data accesses of their eBPF program enforced by the eBPF verifier. This paper presents KEN, an alternative framework that alleviates the difficulty of writing an eBPF program by allowing Kernel Extensions to be written in Natural language. KEN uses recent advances in large language models (LLMs) to synthesize an eBPF program given a user's English language prompt. To ensure that LLM's output is semantically equivalent to the user's prompt, KEN employs a combination of LLM-empowered program comprehension, symbolic execution, and a series of feedback loops. KEN's key novelty is the combination of these techniques. In particular, the system uses symbolic execution in a novel structure that allows it to combine the results of program synthesis and program comprehension and build on the recent success that LLMs have shown for each of these tasks individually. To evaluate KEN, we developed a new corpus of natural language prompts for eBPF programs. We show that KEN produces correct eBPF programs on 80% which is an improvement of a factor of 2.67 compared to an LLM-empowered program synthesis baseline.
eBPF'24: [https://dl.acm.org/doi/10.1145/3672197.3673434](https://dl.acm.org/doi/10.1145/3672197.3673434) and arxiv [https://arxiv.org/abs/2312.05531](https://arxiv.org/abs/2312.05531)
オペレーティングシステムを修正・拡張する能力は、システムのセキュリティ、信頼性、およびパフォーマンスを向上させるための重要な機能です。拡張されたBerkeley Packet Filters(eBPF)エコシステムは、Linuxカーネルを拡張するための標準的なメカニズムとして確立され、最近Windowsにも移植されました。eBPFプログラムは、既存のロジックの前後でシステムが実行する新しいロジックをカーネルに注入します。eBPFエコシステムはカーネル拡張のための柔軟なメカニズムを提供しますが、現在のところ開発者がeBPFプログラムを書くことは困難です。eBPF開発者は、論理を配置する場所を決定し、eBPF検証器によって強制される制御フローとデータアクセスに関するプログラミング制限に対応するため、オペレーティングシステムの内部構造に関する深い知識が必要です。本論文では、自然言語でカーネル拡張を記述可能にすることで、eBPFプログラムの記述の難しさを軽減する代替フレームワーク「KEN」を提案します。KENは、ユーザーの英語プロンプトからeBPFプログラムを合成するために、大規模言語モデル([[LLM]])の最近の進歩を活用します。LLMの出力とユーザーの提示が意味的に同等であることを確保するため、KENはLLMを活用したプログラム理解、シンボリック実行、および一連のフィードバックループを組み合わせた手法を採用しています。KEN の最大の特徴は、これらの技術を組み合わせた点にあります。特に、このシステムは、プログラム合成とプログラム理解の結果を組み合わせることができる新しい構造でシンボリック実行を使用しており、LLM がそれぞれのタスクで個別に達成した最近の成果を基盤としています。KEN を評価するために、我々は eBPF プログラム用の自然言語プロンプトの新しいコーパスを開発しました。KEN は、LLM によるプログラム合成のベースラインと比較して 2.67 倍の改善となる 80% の正確さで eBPF プログラムを生成することを示しています。
## Programmable System Call Security with eBPF
System call filtering is a widely used security mechanism for protecting a shared OS kernel against untrusted user applications. However, existing system call filtering techniques either are too expensive due to the context switch overhead imposed by userspace agents, or lack sufficient programmability to express advanced policies. Seccomp, Linux's system call filtering module, is widely used by modern container technologies, mobile apps, and system management services. Despite the adoption of the classic BPF language (cBPF), security policies in Seccomp are mostly limited to static allow lists, primarily because cBPF does not support stateful policies. Consequently, many essential security features cannot be expressed precisely and/or require kernel modifications. In this paper, we present a programmable system call filtering mechanism, which enables more advanced security policies to be expressed by leveraging the extended BPF language (eBPF). More specifically, we create a new Seccomp eBPF program type, exposing, modifying or creating new eBPF helper functions to safely manage filter state, access kernel and user state, and utilize synchronization primitives. Importantly, our system integrates with existing kernel privilege and capability mechanisms, enabling unprivileged users to install advanced filters safely. Our evaluation shows that our eBPF-based filtering can enhance existing policies (e.g., reducing the attack surface of early execution phase by up to 55.4% for temporal specialization), mitigate real-world vulnerabilities, and accelerate filters.
[https://arxiv.org/abs/2302.10366](https://arxiv.org/abs/2302.10366)
システムコールフィルタリングは、共有OSカーネルを信頼できないユーザーアプリケーションから保護するための広く採用されているセキュリティメカニズムです。しかし、既存のシステムコールフィルタリング技術は、ユーザースペースエージェントによるコンテキストスイッチのオーバーヘッドによりコストが高すぎるか、高度なポリシーを表現するための十分なプログラム可能性を欠いています。Seccompは、Linuxのシステムコールフィルタリングモジュールであり、現代のコンテナ技術、モバイルアプリ、システム管理サービスで広く採用されています。Seccomp は、従来の BPF 言語 (cBPF) を採用しているにもかかわらず、主に cBPF がステートフルポリシーをサポートしていないため、セキュリティポリシーは静的な許可リストにほぼ限定されています。その結果、多くの重要なセキュリティ機能を正確に表現できない、あるいはカーネルの変更が必要になる場合があります。本論文では、拡張 BPF 言語 (eBPF) を活用して、より高度なセキュリティポリシーを表現できる、プログラム可能なシステムコールフィルタリングメカニズムを紹介します。具体的には、新しい Seccomp eBPF プログラムタイプを作成し、フィルタの状態を安全に管理し、カーネルおよびユーザの状態にアクセスし、同期プリミティブを利用するための eBPF ヘルパー関数を公開、変更、または新規作成します。重要なことは、このシステムが既存のカーネル特権および機能メカニズムと統合されているため、特権のないユーザも高度なフィルタを安全にインストールできることです。評価結果から、当社のeBPFベースのフィルタリングは既存のポリシーを強化(例:一時的な特殊化による早期実行フェーズの攻撃表面を最大55.4%削減)、現実世界の脆弱性を緩和し、フィルタの高速化を実現することが示されました。
## Cross Container Attacks: The Bewildered eBPF on Clouds
The extended Berkeley Packet Filter (eBPF) provides powerful and flexible kernel interfaces to extend the kernel functions for user space programs via running bytecode directly in the kernel space. It has been widely used by cloud services to enhance container security, network management, and system observability. However, we discover that the offensive eBPF that have been extensively discussed in Linux hosts can bring new attack surfaces to containers. With eBPF tracing features, attackers can break the container's isolation and attack the host, e.g., steal sensitive data, DoS, and even escape the container. In this paper, we study the eBPF-based cross container attacks and reveal their security impacts in real world services. With eBPF attacks, we successfully compromise five online Jupyter/Interactive Shell services and the Cloud Shell of Google Cloud Platform. Furthermore, we find that the Kubernetes services offered by three leading cloud vendors can be exploited to launch cross-node attacks after the attackers escape the container via eBPF. Specifically, in Alibaba's Kubernetes services, attackers can compromise the whole cluster by abusing their over-privileged cloud metrics or management Pods. Unfortunately, the eBPF attacks on containers are seldom known and can hardly be discovered by existing intrusion detection systems. Also, the existing eBPF permission model cannot confine the eBPF and ensure secure usage in shared-kernel container environments. To this end, we propose a new eBPF permission model to counter the eBPF attacks in containers.
[https://www.usenix.org/conference/usenixsecurity23/presentation/he](https://www.usenix.org/conference/usenixsecurity23/presentation/he)
拡張バークレーパケットフィルタ (eBPF) は、カーネル空間でバイトコードを直接実行することにより、ユーザ空間プログラムのためにカーネル機能を拡張する、強力かつ柔軟なカーネルインターフェースを提供します。これは、コンテナのセキュリティ、ネットワーク管理、およびシステムの可観測性を強化するために、クラウドサービスで広く使用されています。しかし、Linux ホストで広く議論されている攻撃的な eBPF は、コンテナに新たな攻撃面をもたらす可能性があることを我々は発見しました。eBPF のトレース機能により、攻撃者はコンテナの分離を突破してホストを攻撃し、機密データの盗用、DoS 攻撃、さらにはコンテナからの脱出さえも行うことができます。本論文では、eBPF ベースのコンテナ間攻撃を研究し、実環境サービスにおけるそのセキュリティへの影響について明らかにします。eBPF 攻撃により、5 つのオンライン Jupyter/Interactive Shell サービスおよび Google Cloud Platform の Cloud Shell を侵害することに成功しました。さらに、3 つの大手クラウドベンダーが提供する Kubernetes サービスは、攻撃者が eBPF によってコンテナから脱出した後、クロスノード攻撃を仕掛けるために悪用できることを発見しました。具体的には、Alibaba の Kubernetes サービスでは、攻撃者は、過大な権限を持つクラウドメトリクスや管理 Pod を悪用して、クラスタ全体を侵害することができます。残念ながら、コンテナに対する eBPF 攻撃はほとんど知られておらず、既存の侵入検知システムでは発見することがほとんど不可能です。また、既存の eBPF 許可モデルでは、eBPF を制限して、共有カーネルコンテナ環境での安全な使用を確保することができません。この目的のために、我々は、コンテナにおける eBPF 攻撃に対抗するための新しい eBPF 許可モデルを提案します。
## Comparing Security in eBPF and WebAssembly
This paper examines the security of eBPF and WebAssembly (Wasm), two technologies that have gained widespread adoption in recent years, despite being designed for very different use cases and environments. While eBPF is a technology primarily used within operating system kernels such as Linux, Wasm is a binary instruction format designed for a stack-based virtual machine with use cases extending beyond the web. Recognizing the growth and expanding ambitions of eBPF, Wasm may provide instructive insights, given its design around securely executing arbitrary untrusted programs in complex and hostile environments such as web browsers and clouds. We analyze the security goals, community evolution, memory models, and execution models of both technologies, and conduct a comparative security assessment, exploring memory safety, control flow integrity, API access, and side-channels. Our results show that eBPF has a history of focusing on performance first and security second, while Wasm puts more emphasis on security at the cost of some runtime overheads. Considering language-based restrictions for eBPF and a security model for API access are fruitful directions for future work.
[https://dl.acm.org/doi/abs/10.1145/3609021.3609306](https://dl.acm.org/doi/abs/10.1145/3609021.3609306)
More about can be found in the first workshop: [https://conferences.sigcomm.org/sigcomm/2023/workshop-ebpf.html](https://conferences.sigcomm.org/sigcomm/2023/workshop-ebpf.html)
本論文では、近年広く採用されている2つの技術であるeBPFとWebAssembly([[Wasm]])のセキュリティを比較検討する。これらの技術は、異なる用途と環境を想定して設計されたにもかかわらず、それぞれ独自の普及を遂げている。eBPFはLinuxなどのオペレーティングシステムカーネル内で主に使用される技術であるのに対し、Wasmはスタックベースの仮想マシン向けに設計されたバイナリ命令形式であり、ウェブを超えた多様な用途に展開されている。eBPF の成長と野心の拡大を認識すると、Wasm は、Web ブラウザやクラウドなどの複雑で敵対的な環境において、信頼できない任意のプログラムを安全に実行するように設計されているため、有益な洞察を提供してくれるかもしれません。我々は、両技術のセキュリティ目標、コミュニティの進化、メモリモデル、実行モデルを分析し、メモリの安全性、制御フローの整合性、API アクセス、サイドチャネルについて比較セキュリティ評価を実施しました。当社の結果は、eBPFがパフォーマンスを最優先しセキュリティを後回しにきた歴史があるのに対し、Wasmはセキュリティに重点を置く代わりに実行時オーバーヘッドを一部犠牲にしていることを示しています。eBPFの言語ベースの制限やAPIアクセス用のセキュリティモデルは、今後の研究の有望な方向性です。
## A flow-based IDS using Machine Learning in eBPF
eBPF is a new technology which allows dynamically loading pieces of code into the Linux kernel. It can greatly speed up networking since it enables the kernel to process certain packets without the involvement of a userspace program. So far eBPF has been used for simple packet filtering applications such as firewalls or Denial of Service protection. We show that it is possible to develop a flow based network intrusion detection system based on machine learning entirely in eBPF. Our solution uses a decision tree and decides for each packet whether it is malicious or not, considering the entire previous context of the network flow. We achieve a performance increase of over 20% compared to the same solution implemented as a userspace program.
[https://arxiv.org/abs/2102.09980](https://arxiv.org/abs/2102.09980)
eBPF は、Linux カーネルにコードを動的にロードできる新しい技術です。これにより、カーネルはユーザ空間プログラムを介さずに特定のパケットを処理できるため、ネットワークの速度を大幅に高速化できます。これまで eBPF は、ファイアウォールやサービス拒否攻撃対策などの単純なパケットフィルタリングアプリケーションに使用されてきました。我々は、機械学習に基づくフローベースのネットワーク侵入検知システムを、eBPF だけで開発できることを示しました。当社のソリューションは、決定木を使用し、ネットワークフローのこれまでの全体的なコンテキストを考慮して、各パケットが悪意のあるものかどうかを判断します。ユーザー空間プログラムとして実装された同等のソリューションに比べ、20% 以上のパフォーマンス向上を実現しています。
## Femto-containers: lightweight virtualization and fault isolation for small software functions on low-power IoT microcontrollers
Low-power operating system runtimes used on IoT microcontrollers typically provide rudimentary APIs, basic connectivity and, sometimes, a (secure) firmware update mechanism. In contrast, on less constrained hardware, networked software has entered the age of serverless, microservices and agility. With a view to bridge this gap, in the paper we design Femto-Containers, a new middleware runtime which can be embedded on heterogeneous low-power IoT devices. Femto-Containers enable the secure deployment, execution and isolation of small virtual software functions on low-power IoT devices, over the network. We implement Femto-Containers, and provide integration in RIOT, a popular open source IoT operating system. We then evaluate the performance of our implementation, which was formally verified for fault-isolation, guaranteeing that RIOT is shielded from logic loaded and executed in a Femto-Container. Our experiments on various popular micro-controller architectures (Arm Cortex-M, ESP32 and RISC-V) show that Femto-Containers offer an attractive trade-off in terms of memory footprint overhead, energy consumption, and security.
[https://dl.acm.org/doi/abs/10.1145/3528535.3565242](https://dl.acm.org/doi/abs/10.1145/3528535.3565242)
IoT マイクロコントローラで使用される低電力オペレーティングシステムランタイムは、通常、基本的な API、基本的な接続機能、場合によっては(セキュアな)ファームウェア更新メカニズムを提供します。一方、制約の少ないハードウェアでは、ネットワーク化されたソフトウェアは、サーバーレス、マイクロサービス、俊敏性の時代に入っています。このギャップを埋めることを目指して、我々は、異種の低電力 IoT デバイスに組み込むことができる新しいミドルウェアランタイム、Femto-Containers を設計しました。Femto-Containers は、ネットワークを介して、低電力 IoT デバイス上で小規模な仮想ソフトウェア機能を安全に展開、実行、分離することを可能にします。我々は Femto-Containers を実装し、人気のあるオープンソースの IoT オペレーティングシステムである RIOT に統合しました。次に、実装のパフォーマンスを評価し、RIOT が Femto-Container でロードおよび実行されたロジックから確実に保護されるよう、故障の分離について正式に検証しました。Arm Cortex-M、ESP32、[[RISC-V]]など、さまざまな人気のマイクロコントローラーアーキテクチャでの実験結果から、Femto-Containersはメモリフットプリントのオーバーヘッド、エネルギー消費、セキュリティの観点で魅力的なトレードオフを提供することが示されています。
> The original link of this article: [https://eunomia.dev/tutorials/18-further-reading](https://eunomia.dev/tutorials/18-further-reading)