____ _______ __ _____ _ _ | _ \| ____\ \/ / | ____|_ _| |_ ___ _ __ ___(_) ___ _ __ ___ | |_) | _| \ / | _| \ \/ / __/ _ \ '_ \/ __| |/ _ \| '_ \/ __| | _ <| |___ / \ | |___ > <| || __/ | | \__ \ | (_) | | | \__ \ |_| \_\_____/_/\_\ |_____/_/\_\\__\___|_| |_|___/_|\___/|_| |_|___/ Rex Kernel Extensions Table of Contents What is Rex Rex is a safe and usable kernel extension framework that allows loading and executing Rust kernel extension programs in the place of eBPF. Unlike eBPF-based frameworks such as Aya, Rex programs do not go through the in-kernel verifier, instead, the programs are implemented in the safe subset of Rust, on which the Rust compiler performs the needed safety checks and generates native code directly. This approach avoids the overly restricted verification requirements (e.g., program complexity constraints) and the resulting arcane verification errors, while at the same time potentially provides a better optimization opportunity in the native compiler backend (i.e., LLVM) than the eBPF backend + in-kernel JIT approach. Rex currently supports the following features: 5 eBPF program types: kprobe , perf_event , tracepoint , xdp , and tc . , , , , and . invocation of eBPF helper functions that are commonly used by these programs interaction with eBPF maps RAII-style management of kernel resources obtainable by programs cleanup and in-kernel exception handling of Rust runtime panics with call stack traces kernel stack (only when CFG cannot be computed statically) and termination safety from a thin in-kernel runtime bindings and abstractions of kernel data types commonly needed by eBPF programs Example program The following example implements a kprobe program that attaches to a selected system call and injects an error (specified by errno ) to the system call on a process (specified by its pid ). The full example, including the loader program, can be found under samples/error_injector. #! [ no_std ] #! [ no_main ] use rex :: kprobe :: kprobe ; use re...
First seen: 2025-12-28 06:56
Last seen: 2025-12-28 22:58