Hasty Briefsbeta

Bilingual

Show HN: DOOM in the kernel, or fibers in eBPF

21 days ago
  • eBPF allows user-supplied programs to run in the Linux kernel with strict safety checks via a verifier, but complex programs like DOOM face constraints such as small stack, limited call depth, and no recursion or unbounded loops.
  • BPF Capsule is a compiler and runtime that transforms large C programs (e.g., DOOM, Lua, SQLite, CPython) into a shape accepted by the stock Linux eBPF verifier and JIT, without kernel patches.
  • The project uses techniques like pointer laundering, region-based control flow (dividing code into bounded pieces called regions), fibers with a software stack, and a shared 4-GiB virtual window for memory, enabling complex programs to run in-kernel.
  • Performance overhead varies: integer-heavy programs like DOOM and SQLite are 3–7× slower than native, while interpreters like CPython and float-heavy code like llama2.c can be 15–60× slower due to region boundaries and lack of FPU.
  • The integration is designed for stress testing rather than practical use—DOOM runs with user-provided WAD files and keyboard input, producing framebuffers that userspace can read directly from shared memory.