GitHub - eunomia-bpf/ebpfos: Compile Linux into eBPF and make it a dynamically composable operating system

GitHub

7 min read Original article ↗

Turning all of Linux into dynamically composable eBPF components: the running kernel replaces any function for one service at a time.

License: GPL-2.0-only Release

How eBPFOS works

Linux runs every service on a machine over one kernel image. A kernel change reaches every process, so a change that speeds up one workload and slows another is taken or refused for the whole machine, and code differs per process only at extension points prepared in advance. eBPFOS compiles Linux's own C source into eBPF components that the kernel's verifier checks, and lets the running kernel publish a new version of any component for one machine, process tree, cgroup or object while everything else keeps its version.

What eBPFOS supports

  • All of Linux as eBPF. Every C function of Linux 7.1.8 compiles to an eBPF program; all but one run as eBPF on every configuration, and 66–70% pass the in-kernel verifier.
  • Any function, replaced live. 91.5–91.8% of the functions are each replaced and restored in the running kernel, with no hook prepared in advance.
  • Whole subsystems. A file system or a driver from another upstream release replaces the running one under load; upstream fixes publish one after another.
  • Scoped versions. A version is selected for the whole machine, a process tree, a cgroup, one object, or per request inside one application; versions run side by side over shared kernel objects.
  • Verified and trusted tiers. Each component records whether the in-kernel verifier accepted it; a container can run on a view of verified code only.
  • Rollback. Detaching a publication restores the earlier selection while applications keep running.
  • Proved guarantees. A Lean model of the running system proves four guarantees for these updates (164 files, about 30K lines, 1,704 theorems and lemmas, free of sorry).
  • One command. ebpfos fetch, component build, list, publish, rollback and vm cover the release bundle, components and guests; ebpfos mcp offers the first five to agents as tools.
Kernel configuration C functions Run as eBPF Verified Replaced and restored live
01-minimal 22,217 22,216 15,540 (69.9%) 20,117
02-network 26,867 26,866 18,794 (70.0%) 24,327
03-filesystems 30,738 30,737 20,539 (66.8%) 28,132 (91.5%)
04-isolation 31,692 31,691 20,980 (66.2%) 29,094 (91.8%)

How it works

  1. Compile. The component compiler turns each C function of the configured kernel, as written, into an eBPF program and groups programs with their private members into components.
  2. Verify and link. The in-kernel eBPF verifier and JIT run on every program at build time, and the results are linked into the boot image; the booted kernel runs the compiled code with zero checks on its ordinary paths.
  3. Publish per scope. A new version of a component loads beside the running one and is selected for one scope; each operation runs under exactly one version, and other scopes keep theirs.
  4. Roll back. Detaching the publication restores the earlier selection.

The design is in docs/design.md and the proofs in formal/.

Use cases

Recorded runs on 4-vCPU KVM guests; every number links to its record, and the full list with every cost is in docs/evaluation/paper-numbers.md.

A kernel fast path for one service, every program verified, beside an nginx neighbour under load:

Service Throughput against Native
BIND, DNS over TCP 14.0×
Unbound, DNS over TCP 11.6×
Apache, static HTTP 11.0× (13.45× alone)
Memcached GET 2.9×
Redis GET 2.5×, p99 2.6–2.9 ms → 0.58–0.85 ms

Changes that only a replaceable kernel can make:

Use case Recorded result
A whole upstream file system Upstream-sourced ext4, 692 components, replaces 800 entries and 36 operations tables of the running ext4 with zero errors; HTTP +1.3%, PostgreSQL −5.8%, Redis −3.4% to −4.0%, so each service picks its file system
A whole upstream driver virtio-net of v7.2-rc1 (101 programs) over the running v7.1.8 driver; HTTP throughput +4.4%, p99 −4.6%
A stream of upstream fixes 12 versions published one after another under PostgreSQL load, 200,179 transactions, zero failures; median publication 87 ms
A verified view for a container 1,368 of 2,218 definitions on its paths verify; nginx 69.9% and PostgreSQL 93.3% of Native inside the view (gVisor nginx: 7.3%); a fixed clone_mnt passes an upstream test 6/6 inside, 1/6 outside
Kernel configuration per process Selected process maps page zero in 7 of 7 boots, its peer in 0 of 7
Kernel code per request 994,872 byte-checked responses inside one nginx; selected requests +296.6% throughput
An agent changing its own kernel Changed BPF map ID allocator in its own scope: LLVM build −40.9 s, kernel build −1.57 s, npm test +19.2 s

Running Linux as linked eBPF costs 1.014× (Redis GET) to 1.142× (nginx) of the native build over ten alternating pairs (record).

Quick start

You need an x86-64 Linux host, Python 3.12 or newer, LLVM 18 (clang-18, opt-18), QEMU and /dev/kvm; the release bundle supplies the prebuilt kernels and guest userspace.

git clone --depth 1 --filter=blob:none --sparse https://github.com/eunomia-bpf/ebpfos.git
cd ebpfos
git sparse-checkout set configs runtime tools examples
python3 -m venv .venv && . .venv/bin/activate
python3 -m pip install -e .

export BUNDLE="$HOME/.local/share/ebpfos/bundle"
ebpfos --bundle "$BUNDLE" fetch            # release v0.1.0 bundle, 1.6 GB
cd examples/hello
ebpfos --bundle "$BUNDLE" component build syscall.c:__x64_sys_getpgid --catalog catalog.json --out syscall.component
ebpfos --bundle "$BUNDLE" vm --image aot --command 'python3 run.py'

The hello example changes getpgid(0) to 63001 for a worker in one cgroup: the worker sees 0 → 63001 → 0 across publication and rollback, and a peer outside the cgroup keeps 0 on the same kernel. The release page also carries the kernel images alone (ebpfos-image-x86_64.tar.gz), which boot directly in QEMU.

Examples

examples/ holds runnable components with their recorded guest results: hello (a system call for one cgroup), mmap-min-addr (kernel configuration per process), redis-get (requests answered by a kernel component), bbr-local-port (congestion control by port), pg-wakeup (a scheduler decision for one service: 34,113.83 → 40,502.67 TPS), apache-fastpath (verified HTTP fast path: 13.45×) and unbound-fastpath (verified DNS fast path: 3× lower mean latency in the single-guest example; 11.6× throughput in the co-located cohort). The executable checks are in runtime/tests/test_examples.py.

Build from source

git sparse-checkout set .devcontainer configs formal runtime scripts tests tools verifier kernel docs examples
git submodule update --init --depth 1 kernel
docker build -t ebpfos-dev -f .devcontainer/Dockerfile .
docker run --rm -it --device=/dev/kvm --mount type=bind,src="$PWD",dst=/src --workdir /src ebpfos-dev bash

Kernel and compiler builds follow the developer build guide; code locations and tests are in the developer documentation. The repository holds runtime/ (the ebpfos command, loader and scopes), tools/ (component compiler, image build, evaluation, release), verifier/, formal/ (Lean proofs), configs/, kernel/ (pinned Linux 7.1.8 with the eBPFOS integration), examples/, experiments/ (recorded studies and data) and docs/.

Status

eBPFOS is a research prototype for x86-64 on a pinned Linux 7.1.8. Verified components carry the in-kernel verifier's guarantees under their load contracts; trusted components run with those checks recorded as skipped. A scope selects code while kernel state stays shared and is read through declared data; rollback restores the code selection, and application writes stay as they are. A component is built against the catalog and type information of the kernel it runs on.

Documentation and community

Getting started · Concepts · Writing a component · Scopes and rollback · Developer guide · Evaluation and data · Release notes · Paper

Questions and problem reports go to GitHub issues; changes follow CONTRIBUTING.md, and results are recorded as described in docs/dev/recording-results.md. Security issues go to the private contact in SECURITY.md.

Citation

@software{ebpfos,
  author = {{eBPFOS contributors}},
  title  = {{eBPFOS}: Turning All of {Linux} into Dynamically Composable {eBPF} Components},
  year   = {2026},
  url    = {https://github.com/eunomia-bpf/ebpfos}
}

License

eBPFOS is released under GPL-2.0-only, except where a file's SPDX identifier states another license (LICENSES); the Linux submodule and other dependencies keep their own terms.