TellWorldAI World Archive

Home›Practice›Practice

Practice

What Shirudo is and how it works: signed BPF live patches before the real fix

shirudo is a BPF security platform for Linux that delivers signed upatches without a reboot and measures each load into a TPM. This guide covers the problem it targets, its two roles and the full flow.

Who this is for and what you will get

Engineers weighing shirudo against other options, and operators who must explain it to colleagues, will find the design laid out here. By the end you can describe the gap it closes, what the operator and the target each hold, and the path a patch follows from build to unload.

What shirudo is

shirudo is a BPF-based security platform for Linux. Rather than rebooting, it pushes BPF programs, which it calls upatches, onto live machines. It also limits the bpf() system call so that only loaders carrying the operator's signature can load BPF code from user space[1]. Each change to the loaded set is folded into a TPM register, and the TPM can sign that record when asked[1].

The gap it closes

Until a machine reboots onto a kernel with the fix, the fix is not really deployed. On a fleet that reboots every few days or weeks, the time between public disclosure and that reboot is when someone who has read the patch can exploit the bug[1]. A BPF program hooked into an LSM point or the affected function can refuse the risky call inside the running kernel, and it can be added or removed without a restart[1]. That power cuts both ways, so shirudo requires that a target run only code the operator signed, even for root[1].

Two roles

The operator keeps the private ML-DSA-87 key and handles building, signing, publishing and verification. The commands that touch the key live in a helper called shirudo-build, which is never installed on a target[1]. A target keeps only public certificates. It checks signatures, enforces the policy and stores measurements in its TPM[1]. A target needs a bpf-next development kernel with the signed loader interface and the BPF LSM, plus a TPM 2.0. The operator needs a recent clang. Both roles support x86-64, arm64 and riscv64[1].

The life of a upatch

The flow has seven stages, from building and signing through to unloading[2].

Build and sign

A upatch begins as a short BPF C file that rejects the call a kernel fix closes. Field offsets are resolved through CO-RE, so the program adapts to the target kernel's layout when it loads[2]. Because libbpf rewrites the object during loading, the signature is applied to a generated loader rather than to the object file. shirudo-build compiles with clang, lets libbpf produce a loader of the SYSCALL type, stores the payload in that loader's data, and signs the instructions together with the data using ML-DSA-87[2].

Package and publish

From a Beefile, shirudo bpm build assembles upatches into a .bee package. shirudo bpm push sends the package to an OCI registry and, with the key, records it in a signed index. Operations can also go into a signed tree whose selectors decide which machines they reach[2]. The registry is treated as untrusted. It may hide or replay material, but it cannot forge an index, a tree or a upatch that passes the target's checks[2].

Pull

On the target, a systemd timer runs shirudo bpm repo update and then shirudo bpm upgrade, about a minute after each run. The index signature is checked against a repository certificate that sits in the signed config image. The upgrade step verifies digests against the index before it unpacks and loads anything[2]. A second timer syncs the signed tree every minute and applies only the operations whose selectors match the machine[2].

Load

Every route ends in one load path. The loader's data goes into a frozen array map that only that loader may read, and the map is bound to the SHA-256 of the loader's instructions[2]. The kernel checks a single signature over the instructions and the frozen map before its own verifier runs. Two LSM programs enforce this: one admits only signed SYSCALL-type programs, and the other admits only those verified against the .bpf keyring[2]. The loader then creates maps and programs inside the kernel, shirudo attaches each program at the site the signed metadata names, pins the links in its private bpffs, and archives the artifact for the next boot[2].

Measure

After archiving, shirudo extends the register with an event built from the payload digest and the name, and it writes a matching record to the eventlog. If archiving or extension fails, the load is rolled back. If the rollback fails too, the command says so and leaves the target for the operator to fix[2]. The register restarts from zero on every boot. Its final value depends only on the trusted certificates, the set restored at boot, the tree position and the events since, so an operator can reproduce it without the machine's history[2].

Attest

The operator picks a nonce, and shirudo attest --nonce=<hex> on the target returns a TPM quote, a register certification signed by the attestation key, and this boot's eventlog records[2]. On the operator's side, attest predict computes the expected register value, and attest verify checks the signatures, the nonce and the replayed log against it. Neither step opens a TPM[2].

Export and unload

Two timers stream telemetry. One runs shirudo upatch map --all to read loaded maps and export them. The other runs shirudo status --otel, which sends a status record along with the TPM quote as an OTLP log when an endpoint is configured[2]. The quote shows that the keepalive came from the target's key, but the independent check is still the TPM evidence from the attest stage[2]. Unloading runs a signed directive through the same signature check, and the directive's loader never executes. The payload digest must match the pin, or the unload is refused with payload_mismatch. The unload event is measured before the pins are removed, and the archived copy is deleted so that it does not come back at the next boot[2].

What it does not do

shirudo does not decide whether a upatch is a correct mitigation. A signature proves origin and integrity, and the BPF verifier guarantees memory safety but not the correctness of the fix[1]. It does not replace kernel updates either, because a upatch only covers the period until the machine runs a patched kernel[1]. It has no daemon, no listening socket, no push channel, no SSH integration and no fleet inventory. Each action on a target is a one-off command, started by hand or by a timer[1]. It keeps no logs of its own and relies on syslog(3) and the journal[1]. It cannot protect against a compromised kernel, verifier, TPM or hardware, and it does not harden the kernel itself[1]. Enforcement starts only once shirudo init attaches it. If init fails in the initrd, the machine still boots without protection, and only status and attestation will show that[1].

Common questions

  • Is this eBPF? The project's documents call the technology BPF, and this article follows that wording[1].
  • Does installing it block every vulnerability? No. It refuses risky calls during the window before the machine runs a fixed kernel[1].
  • Where do the logs go? shirudo writes through syslog(3), and journald or its backends keep them. shirudo keeps no logs of its own[1].

Next step

For a hands-on run, follow the quickstart. For deployment, the install and boot pages cover what a target needs[2].

Sources

  1. 1
    What is shirudoshirudo-dev on GitHub
  2. 2
    How it worksshirudo-dev on GitHub

Cite this page: What Shirudo is and how it works: signed BPF live patches before the real fix. TellWorld, https://www.tellworld.net/practice/practice-shirudo-how-it-works. Updated 2026-11-24

Related news

View all