Spinbox / field notes

Spinbox· 5 min read

Changing a light bulb

A signed Shirudo upatch blocks an exploit without restarting Tomcat. Getting Shirudo to run in a spin-machine guest took a new kernel, a lockdown change and a TPM.

A terminal: the upatch registry's test of CVE-2025-24813 in a spin-machine guest. Before: reached. Loaded: blocked. After: reached. PASS. Under it: Reached, blocked, reached again. One signed program in between.

The payload exits 0. That means Tomcat 9.0.98 took a partial PUT and wrote a file where CVE-2025-24813 says it never should. Then one command loads a signed program into the running kernel, the same request comes back with an HTTP 500, the payload exits 10, and nothing is written. Unload the program and it’s 0 again. Tomcat was never touched.

cve-2025-24813
before  reached      the partial PUT wrote .upatch-probe-2095c91fa8b1.session in the work directory (HTTP 409); removed it
loaded  blocked      the partial PUT failed with HTTP 500 and wrote no file
after   reached      the partial PUT wrote .upatch-probe-3762e5bca4f0.session in the work directory (HTTP 409); removed it
PASS: reached before, blocked while loaded, reached again after
The upatch registry's test of its CVE-2025-24813 package, run with the Shirudo binary included in spin-machine v20261126.04.

That’s Shirudo, the open-source Linux runtime OpenAI and Cisco put out on 24 November. It loads signed BPF programs, which it calls upatches, into a running kernel, and each one closes the path an exploit takes until the real fix ships. No reboot, no new build of the software. This is the same machine release you can boot by hand, with a Shirudo initrd and a TPM.

A rule for the room

In the first post I compared a workspace with the Construct in The Matrix, the white room where you load whatever you need. Shirudo adds a rule to the room. Once its init completes, loading a BPF program takes a signature the kernel trusts, and unloading an upatch takes a signed directive. Root included.

Hal and the light bulb

There’s a scene in Malcolm in the Middle where Hal goes to change a light bulb. The shelf with the bulbs is loose, the screwdriver is in a drawer that squeaks, and a few repairs later he’s under the car. Here’s what I had to change in the machine to run Shirudo:

  • A kernel from before a release. Shirudo needs a bpf-next kernel with a signed-loader ABI and six hooks that no released kernel has. The machine moved to 7.4-rc4 and carries Shirudo’s six patches (machine#733), the rest of its configuration: TPM drivers, dm-verity with signed root hashes, ML-DSA (#735), and what its boot flow needed beyond its own table, like zstd initrds and no writes to a mounted disk (#744).
  • A different lockdown. Every machine ran with the kernel’s lockdown at confidentiality, the strictest level. Shirudo’s init fails there. In this release, --lockdown shirudo selects integrity (#739). The same choice leaves the .bpf and .dm-verity keyrings open on the command line so init can enroll its key and seal them, and it’s one flag, so nobody asks for half of it (#743).
  • A TPM. Shirudo’s docs say it plainly: “There is no mode without a TPM.” The QEMU I built by subtraction got a device back, and the release ships swtpm beside it, one per machine that asks (#747, #748). The firmware now measures the kernel, the initrd and the command line into it, so Shirudo’s register is bound to the boot that happened (#778).
  • Signed modules. Shirudo’s pre-flight checks module signatures. Ours now loads only modules signed with spin-stack’s key (#750).

None of it was hard. The lockdown is the part I’d rather tell. I picked a level twice from reading Shirudo’s source, and Shirudo’s own docs say lockdown was never tested. So I ran its test harness on our kernel at each level. At confidentiality, shirudo init stops at bpf_probe_read#4. At integrity it completes. And init --check-only, the pre-flight, says 12 of 12 passed in both cases. I don’t gate anything on it now.

How the lockdown level got picked: two choices made from reading Shirudo's source, then one run of its own harness on our kernel, which is what got merged.
How the lockdown level got picked: two choices made from reading Shirudo's source, then one run of its own harness on our kernel, which is what got merged.
The kernel's lockdown levels, by what root can still do to a running kernel, and where Shirudo's init lands on them.
The kernel's lockdown levels, by what root can still do to a running kernel, and where Shirudo's init lands on them.

The first TPM benchmark added about 36 ms to a cold first login (machine#745). Most of the time went into self-tests in the TPM stack, and trimming those brought the cost down in a follow-up benchmark (#775). The next target is a machine that boots with a TPM and Shirudo’s lockdown by default, with a cold boot to first SSH login under 250 ms at p95 (machine#809).

What the room looks like

The demo downloads and verifies the machine tarball and the matching Shirudo operator tarball. The guest runs the release’s build of Shirudo, from spin-machine’s fork at commit 6eccbfe. A throwaway guest runs the operator tools to make a key, sign the images and upatches, and build the initrd. Then the machine boots with --lockdown shirudo and a TPM. Init enrolls this run’s certificate, seals the keyrings and measures itself into the TPM:

$ cat /sys/kernel/security/lockdown
none [integrity] confidentiality
$ journalctl -b -u shirudo-initrd.service
shirudo[237]: bpf keyring serial=547585010: 1 certificate enrolled and sealed
shirudo[237]: bpf2 and seal attached: lsm/bpf gate live, writable state sealed
shirudo[237]: init: complete (LSM active, writable state sealed)
$ shirudo status
Status:                ok
LsmAttached        OK      lsm/bpf link present and pinned
KeyringSealed      OK      bpf serial 547585010, dm-verity serial 705686503, pins match
ChainIntact        OK      live register equals the eventlog replay
UpatchesMeasured   OK      every pinned or archived upatch is in this boot's records
TpmMeasured        OK      NV index 0x01818E00 readable
ConfigActive       OK      config 4c352d753d83.. is active
XdpCovered         OK      every device an XDP upatch selects runs it
The guest's journal and shirudo status, after init ran in the initrd and again from the root file system.

The Tomcat package comes from upatch.dev, used as published. It’s a community registry sponsored by Copperhelm, not part of Shirudo, and it ships no key, so the demo builds the package with the registry’s own tools and signs it with the run’s key. Its payload is what you saw at the top.

The other half of Shirudo is watching. Its kernel-obs package records which programs ran, which names resolved, where connections went and who read credential files. The guest runs id, reads /etc/shadow, resolves upatch.dev, connects to Tomcat and to upatch.dev, and reads it all back itself, with no collector:

$ shirudo upatch map kernel-obs file --json
{"count":"1","euid":0,"fs_magic":"61267","mode":"r","path":"/etc/shadow","pid":994,"rule":1}
$ shirudo upatch map kernel-obs dns --json
{"address":"216.150.16.65","answer_count":"1","family":2,"names":[{"last_seen_unix_nano":"1795738327958952132","name":"upatch.dev","seen_count":"1"}]}
kernel-obs's tables, read in the guest with shirudo upatch map.

Where spin doesn’t fit yet

Shirudo refuses every unsigned BPF load after its init, and spin is one of the callers. A spin workspace loads two programs of its own. A guard keeps an agent away from vsock, perf events, io_uring and typing into your terminal. A seal marks an agent’s packets so the host sends them with the agent’s credentials and never with yours. Run spin’s own code under Shirudo and it stops at the first map: map create: permission denied.

The decision, taken on 26 November: spin’s BPF becomes Shirudo upatches. A prototype of the guard, signed by a key the machine trusts, loaded, refused what it should, and stayed put when root tried to detach it. An agent is now a uid in a reserved range. The signed guard can check that range directly. The seal is the part that doesn’t map: it rewrites a byte on the way out, Shirudo has no attach point for that, and the plan is a firewall rule with an upatch that drops an agent’s packet without the mark (shirudo#51 has our case). Whether Docker still runs inside a Shirudo workspace, nobody knows yet.

From the demo to a workspace

The demo uses one key for the upatches and both images, and runs the operator tools in a throwaway guest. A deployment would use separate keys and a dedicated signing machine. Running the same demo from a .spin.yaml, with its log in the dashboard, still needs Shirudo’s init in spin’s initrd and the guard as an upatch.

The recorded run from an empty directory, using shirudo-demo v20261127.01. The download uses gh because the repo was private at the time. The run took 90 seconds.

The shirudo-demo README has the download and run commands. It needs an x86_64 Linux host with access to KVM, plus git, cosign and curl or gh. The host needs neither Go nor Docker.

Found something wrong, or out of date? Tell me, with this post already named, and I'll fix it here. New posts come by RSS.