A quick note: I work at OpenAI, but this isn’t official Shirudo documentation and definitely wasn’t written in an official capacity. I’m just trying it out for myself and writing down what I learned along the way to help it sink in. If I’ve got anything wrong, please give me a shout so I can fix it.

If you’re not familiar with eBPF, here’s the oversimplified version: Linux can load and run small BPF programs at specific points inside its kernel without a reboot. Here we’re interested in security hooks that work like checkpoints. When a process tries an operation, a BPF program attached there can inspect it and tell Linux to refuse it.

Shirudo is a BPF security platform built around that Linux feature. Its admin tools turn a BPF program into a signed file called an upatch, containing the program and its loader. On the target machine, a kernel with Shirudo’s signed-loader support checks the loader’s signature before it installs the BPF program. Each successful upatch load or unload changes a measurement in the target’s TPM. Once it’s set up, Linux enforces the rule. Shirudo controls the loading path and gives the admin a way to check what’s loaded.

I wanted to try this from WSL2 (but honestly did not even know if it would work).

Shirudo’s example shield comes with a Python script that tries the splice() call it’s meant to block. I ran the script three times in a separate test VM:

before loading the shield:  SPLICE_OK
with the shield loaded:    SPLICE_BLOCKED
after removing the shield: SPLICE_OK

SPLICE_OK means this call was allowed. It doesn’t mean the kernel was vulnerable: the test VM already had the normal fix for the related CVE-2026-31431. I wanted to see whether the signed shield would change that result, and whether I could check what had loaded.

OpenAI and Cisco’s announcement describes a guardian agent that can help investigate a problem and propose a shield. The agent doesn’t sit in the target VM. Shirudo’s docs recommend a person check agent-written rules; a trusted key must sign the upatch before it can load. OpenAI demonstrated a Codex-generated Java4Shell shield.

Here we’ll load one of Shirudo’s example rules. It refuses a particular splice() from a pipe into an AF_ALG socket, Linux’s interface to its crypto algorithms. The script tries an ordinary send and then that splice.

For this lab, Ubuntu 26.04 under WSL2 is the operator: it builds the upatch, starts a separate QEMU test VM, and checks the VM’s TPM-signed report. That VM is the target, with its own Shirudo-capable kernel and software TPM. The rule runs in the VM, not in the WSL kernel. Codex helped with setup and checking the results here.

Choose how to try it

If you want a look around before doing a local build, Isovalent has a Shirudo browser lab. It walks through signing a .bee package, publishing it through OCI, installing it in a prepared VM and checking TPM evidence. Here we’ll use WSL2 to load a local .upatch that blocks a call, then remove it.

If you’d rather have Codex set up the WSL side, give it this post and ask:

Set up the Shirudo WSL2 lab in this post for me. Check /dev/kvm first
and use the pinned Shirudo version and test kernel. Run the root
enforcement check and the probe before, during and after the shield.
Show me the TPM check, the command output and which machine ran each step.

To do it yourself, follow the commands below. The first build takes a while; once the VM is up, loading the shield and trying the probe is quick.

Why use Shirudo instead of just eBPF?

You can block this splice() with eBPF alone. Linux supplies the security hook, runs the attached rule, and rejects the call if the rule says no. That’s enough for a quick test in a VM.

Shirudo adds control over who can load or remove that rule. On a normal host where root can manage BPF, root can remove your program or load a different one. On a target set up for Shirudo, shirudo init attaches guard programs during boot. They make userspace BPF loads go through a signed loader, and stop ordinary root commands from detaching protected rules or opening their protected BPF state. The private signing key stays with the operator. In our lab, root will try to open a protected BPF pin (a path to BPF state) and get denied. Shirudo’s security model describes these checks.

Shirudo also records each successful upatch load or unload in the target’s TPM, which is emulated in our VM. The operator can request a fresh report signed by the TPM and compare it with the expected state. This check matters because root can still use a previously signed upatch or unload directive, and a compromised target may lie in its normal status output. Shirudo’s threat model covers both limits.

Shirudo is the build, signing, loading and checking system around your BPF C rule. It has no rule language or long-running agent on the target. You still have to write and test the rule. A signature shows which trusted key signed the upatch; it cannot tell you whether the rule is a good idea. Our QEMU VM is a disposable target. A real one needs a Shirudo-capable kernel, TPM and suitable boot setup.

What Shirudo adds to eBPF: the WSL operator signs an upatch, the target checks its loader, an attached BPF LSM rule makes Linux deny a splice, root is denied access to a protected BPF pin, and the operator checks TPM evidence. What Shirudo adds to eBPF: the WSL operator signs an upatch, the target checks its loader, an attached BPF LSM rule makes Linux deny a splice, root is denied access to a protected BPF pin, and the operator checks TPM evidence.
The signing key stays in WSL; the BPF rule runs in the test VM. Open the sketch for a full-size view.Official shirudo and eBee marks appear for identification. This independent post is not affiliated with or sponsored by the eBPF Foundation. eBPF Foundation and its logo are trademarks of the eBPF Foundation.

Get a WSL2 lab ready

You’ll need a WSL2 host that gives Ubuntu read and write access to /dev/kvm, plus enough resources for a 4 CPU, 4 GiB VM. Microsoft documents WSL2 nested virtualization for Windows 11, but WSL2 by itself does not guarantee KVM access. The guest’s test kernel provides Shirudo’s signed-loader support; the WSL kernel only has to host the VM.

If you already have WSL2, you can add a separate Ubuntu 26.04 distro. In PowerShell, Microsoft’s WSL commands are:

wsl --list --online
wsl --install -d Ubuntu-26.04

A first WSL installation may require a Windows restart. Afterwards, check that the new distro is version 2 and open it:

wsl --list --verbose
wsl -d Ubuntu-26.04

Inside Ubuntu, check KVM access, the init system and the locked-memory limit before installing packages:

test -r /dev/kvm && test -w /dev/kvm && echo 'KVM ready'
ps -p 1 -o comm=
ulimit -l

The first command should print KVM ready. If /dev/kvm does not exist, check WSL’s nested virtualization setting. If it exists but the command prints nothing, inspect ls -l /dev/kvm and id -nG. After a WSL restart, my device appeared as root:sgx while my user belonged to kvm; sudo chgrp kvm /dev/kvm fixed access for that boot. Repeat the test before continuing. My distro showed systemd as PID 1, though the VM scripts also have a non-systemd path.

Live WSL2 terminal showing a Microsoft WSL2 kernel, writable /dev/kvm and a 65536 locked-memory limit
WSL2 preflight from this run. KVM was accessible; I raised the locked-memory limit shown here before starting the VM.

Shirudo’s quickstart needs Clang/LLVM 23, OpenSSL 3.5 or later, QEMU, swtpm, dracut and build libraries. Its test VM uses 4 CPUs and 4 GiB of memory. On a standard Ubuntu 26.04 WSL install, get the Ubuntu packages listed there before building:

sudo apt-get update
sudo apt-get install -y --no-install-recommends \
  build-essential ca-certificates curl git pkg-config python3 jq openssl \
  libcurl4-openssl-dev libelf-dev libluajit-5.1-dev libtss2-dev \
  zlib1g-dev libzstd-dev qemu-system-x86 qemu-utils swtpm swtpm-tools \
  tpm2-tools libtss2-tcti-swtpm0t64 cloud-image-utils libguestfs-tools \
  dracut-core cryptsetup-bin e2fsprogs openssh-client iproute2 \
  isc-dhcp-client kmod file

If ulimit -l is not unlimited, use sudo prlimit --pid $$ --memlock=unlimited:unlimited from the live-patching guide, then check ulimit -l again. Keep the checkout in Ubuntu’s Linux filesystem so the VM’s Unix sockets stay there too.

Clone the Shirudo revision used here, then download its prebuilt test VM kernel:

cd ~
git clone https://github.com/shirudo-dev/shirudo.git
cd shirudo
git switch --detach 56880c40c8c9
testing/vm/kernel-artifact.sh fetch

Shirudo is pre-release, so the pin keeps these commands tied to the version tested here.

Build the host tools directly in Ubuntu for this run; the VM command below uses BUILD_CONTAINER=0. Point the toolchain helper’s BPF check at the downloaded test kernel, then load the environment it writes before building:

sudo env BPF_VMLINUX_BTF="$PWD/artifacts/bpf-next-kernel-debs/vmlinux.btf" \
  sh .github/scripts/vm-toolchain.sh
. build/vm-toolchain.env
clang --version | head -1
openssl version
make
make shirudo-build
export PATH="$PWD:$PWD/tools/shirudo-build:$PATH"

The helper installs Clang 23 into Ubuntu and builds OpenSSL 3.5.9 and libtpms under the checkout, so it can take a while. The VM build makes a signed example upatch. Before entering the target, inspect it from the WSL operator shell; upatch info should show Type: LOAD, Payload type: bpf, and a signature section. Then open the target shell:

VM=shirudo-wsl-1
make -C testing vm VM_NAME="$VM" BUILD_CONTAINER=0
FIXTURES=build/test-vm/host-bundle-bpf-next-verity/fixtures
./shirudo upatch info "$FIXTURES/cve-2026-31431-alg-splice-block.upatch"
make -C testing vm-ssh VM_NAME="$VM"

Shirudo’s quickstart also describes a Docker or Podman build. Keep this Ubuntu shell open: later operator commands use VM and the toolchain environment. Run the target commands below from the root shell that vm-ssh opens. The VM bundle made a throwaway signing key and kept its private half outside the checkout shared with the guest. We’ll build and sign our own tiny rule later.

If shirudo-gen-initrd stops because systemd-pcrphase-initrd.service is missing, check the Ubuntu host version. I hit that problem on Ubuntu 24.04 with systemd 255 and dracut 060. Ubuntu 26.04 with systemd 259 and dracut 110 got past it.

Check enforcement

Before trying the example shield, look at what Shirudo itself protects. In the target root shell, ask the trusted runtime for status. Then try to open one of its pinned BPF objects as an ordinary root process, and try running a copy of its CLI outside the trusted runtime image:

shirudo-runtime status
cat /run/shirudo/bpffs/tamper
/usr/local/bin/shirudo status
shirudo-runtime status

The first status should say Status: ok and list conditions such as LsmAttached, KeyringSealed and ChainIntact as OK. Both untrusted commands should say Permission denied even though this shell is root. Here’s the useful part of my captured run, written out because the terminal image is hard to read at phone size:

trusted status:       Status: ok, ObjGet 2
root opens BPF pin:   Permission denied
untrusted Shirudo:    Permission denied
trusted status again: Status: ok, ObjGet 4

ObjGet counted two more refused attempts. Its starting value can differ, so compare the reports rather than expecting these exact numbers. This checks one protected pin and one untrusted command; the official quickstart runs the same test.

Live WSL2 terminal showing trusted Shirudo status OK, two root commands denied access to protected Shirudo state, and the ObjGet tamper count rising from 2 to 4
Both root commands were denied, and ObjGet moved from 2 to 4. The $ prompts were added for the screenshot; the output is from the VM.

The root shell wasn’t enough to open that pin. Shirudo’s guards are meant to protect its links and maps more broadly. Next, let’s see whether the example rule actually refuses a call.

Load the shield and run the probe

You are still in the target VM’s root shell. Its copy of the checkout is at /workspace/shirudo, including the signed test upatch we just inspected from WSL. The probe sends data normally to an AF_ALG socket, then tries to splice data from a pipe into that socket.

The probe needs its AEAD algorithm available in the disposable VM. Set crypto.af_alg_restrict=0 there as root. The probe also tries to set it, but this explicit step lets the optional unprivileged repeat below use the algorithm. It does not change the WSL host setting. The VM’s 7.4 kernel restricts AF_ALG algorithms by default.

Run the probe without the shield:

cd /workspace/shirudo
PROBE=upatches/kernel-cve/sources/cve-2026-31431-crypto-algif-aead-copy-fail/reproducer/cve-2026-31431-splice-probe.py
FIXTURES=build/test-vm/host-bundle-bpf-next-verity/fixtures

sysctl -w crypto.af_alg_restrict=0
python3 "$PROBE"

Continue only if the status above reported ok and Loaded upatches (0), and the probe prints SPLICE_OK. The probe can print other outcomes without failing its process, so check its text. Now load the upatch and run exactly the same probe again:

shirudo-runtime upatch load "$FIXTURES/cve-2026-31431-alg-splice-block.upatch"
python3 "$PROBE"

The load accepted the signed upatch, pinned one BPF LSM program and measured it. The second probe printed SPLICE_BLOCKED without a reboot:

Live WSLg terminal capture showing SPLICE_OK before the signed upatch load, the Shirudo load and measurement, then SPLICE_BLOCKED
The same probe returned SPLICE_OK before the signed load and SPLICE_BLOCKED afterwards.

The exact register value depends on this test bundle and may differ on your build. The SPLICE_BLOCKED text comes from the probe’s PermissionError handler around os.splice(); the earlier copying sendmsg() succeeded.

Check which shield loaded

The probe showed that the operation was refused. shirudo-runtime status is the target reporting on itself; now the WSL operator will check TPM-signed evidence against the upatch we expected to load.

Shirudo uses a TPM measurement register that can be extended: on each upatch load or unload, the TPM hashes its old value with a fingerprint of the event. Shirudo keeps the readable details in a separate log. We’ll predict the value after this load, ask for a fresh TPM-signed report and compare the two. Shirudo’s attestation guide explains why the expected value matters.

If you are still in the target shell, leave it with exit. Back in the WSL checkout, generate a nonce (a new random challenge that prevents reuse of an old report) and ask the target for evidence. The test VM shares /mnt/shirudo-out back to build/test-vm/vms/$VM/result on the operator side:

NONCE=$(openssl rand -hex 32)
make -C testing vm-ssh VM_NAME="$VM" \
  VM_SSH_COMMAND="shirudo-runtime attest --nonce=$NONCE --output=/mnt/shirudo-out/ev.json"

Get the payload digest from the signed upatch instead of copying a value from this post. PAYLOAD holds that digest. AK is the TPM attestation key name recorded by the VM builder, and CHAIN is the register value expected after the load. The bundle put the enrolled public certificates in fixtures/, so you do not need its temporary private signing key:

FIXTURES=build/test-vm/host-bundle-bpf-next-verity/fixtures
UPATCH="$FIXTURES/cve-2026-31431-alg-splice-block.upatch"
PAYLOAD=$(./shirudo upatch info --json "$UPATCH" | jq -r '.payload_sha256')
AK=$(jq -r '.nodes[0].ak_name' "build/test-vm/vms/$VM/enroll.json")
CHAIN=$(./shirudo attest predict --json \
  --cert="$FIXTURES/cert.der" \
  --cert="$FIXTURES/own.der" \
  --event="load:cve-2026-31431-alg-splice-block=$PAYLOAD" \
  | jq -r '.register_after_events')
printf 'Expected chain: %s\n' "$CHAIN"

Compare the predicted value with the register printed by upatch load. Then verify the signed response against it:

EVIDENCE="build/test-vm/vms/$VM/result/ev.json"
./shirudo attest verify --evidence="$EVIDENCE" \
  --nonce="$NONCE" --ak-name="$AK" \
  --expect-chain="$CHAIN" --require-initrd

In my run, the nonce and pinned key matched, the event log replayed to the TPM-certified register value, and that value matched the load predicted from the upatch. The verifier’s verdict was ok.

To check that the expected value really matters, use the same evidence but change the expected chain to 64 f characters:

WRONG=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
./shirudo attest verify --evidence="$EVIDENCE" \
  --nonce="$NONCE" --ak-name="$AK" \
  --expect-chain="$WRONG" --require-initrd

The line FAIL state: register equals the expected value means the register did not match the deliberately wrong value. The final verdict: fail and exit status 1 are what you want here; that is what the recorded run showed.

Live WSLg terminal capture showing a predicted TPM register, successful verification with a pinned key and expected state, and failure when the expected state is deliberately wrong
The expected state passed; a deliberately wrong value failed.

The failure shows why I checked the expected state as well as the TPM signature. I didn’t pin the boot PCR values or the configuration root here, so this is a check of the upatch state in my test VM, not a full production attestation. Shirudo’s attestation guidance covers those extra checks.

Optional: try it as an unprivileged caller

The target commands above ran as root to load the upatch, but the blocked call does not need root. For an unprivileged repeat, keep the shield loaded and run the probe as nobody inside the VM. strace will show the actual splice() result. This is a local call to the VM’s crypto interface.

From the WSL checkout, download the small wrapper and run it. You can read the script before running it; its README explains the results. It uses vm-ssh to run the same probe as nobody inside the VM, and checks that the guest has runuser and strace:

curl -fsSLo attempt.sh https://www.chadduffey.com/assets/demos/shirudo/attempt.sh
bash attempt.sh "$VM"

If the check fails because the guest lacks strace, open the disposable VM with make -C testing vm-ssh VM_NAME="$VM", run apt-get update && apt-get install -y strace, then leave the VM and try the wrapper again.

With the shield loaded, strace showed -1 EACCES for each splice and the probe printed SPLICE_BLOCKED. A before-and-after check with the same unprivileged caller returned 32 bytes and SPLICE_OK when the shield was absent. The wrapper prints its red [ BLOCKED ] verdict only when the syscall and probe results agree.

Live WSLg terminal detail showing three local attempts as nobody; each splice returns EACCES and the probe prints SPLICE_BLOCKED
Three attempts from nobody, each returning EACCES while the shield was loaded. The red labels come from the wrapper; the full capture shows the raw strace lines.

Remove it and check again

Open the target shell again from WSL:

make -C testing vm-ssh VM_NAME="$VM"

On the target, use the signed unload directive generated by the bundle, then run the probe once more:

cd /workspace/shirudo
shirudo-runtime upatch unload build/test-vm/host-bundle-bpf-next-verity/fixtures/cve-2026-31431-alg-splice-block.unload.upatch
python3 upatches/kernel-cve/sources/cve-2026-31431-crypto-algif-aead-copy-fail/reproducer/cve-2026-31431-splice-probe.py
shirudo-runtime status
exit

Shirudo reported that it detached the BPF program and measured the unload. The probe returned to SPLICE_OK, and status listed zero loaded upatches. If you tried the optional coloured view, run it once more from WSL:

bash attempt.sh "$VM"

Those calls should return SPLICE_OK and green [ ALLOWED ] lines. If you’re done, stop the VM from WSL with make -C testing vm-stop VM_NAME="$VM"; it keeps its disk, TPM state and logs. If you want to write your own rule next, leave this VM running. The quickstart says a stopped VM cannot boot again under the same name; use a new name for another run.

What did the shield block?

AF_ALG is Linux’s socket interface to its crypto algorithms. The shield source attaches to the BPF LSM’s socket_sendmsg hook, where Linux checks a send. If the socket is AF_ALG and the send uses MSG_SPLICE_PAGES, the path taken by this splice() call, the rule returns -EACCES. It leaves other sends alone, though it would also block a legitimate AF_ALG splice.

The 7.4 test kernel used here accepts splice() but copies the data internally before giving it to the crypto code, as the Linux AF_ALG documentation describes.

Stripped down, the rule is:

AF_ALG socket + MSG_SPLICE_PAGES send → deny with EACCES
anything else                         → this rule does not deny

The discoverers’ analysis of CVE-2026-31431 explains why that route mattered in affected kernels: the vulnerable AEAD (authenticated encryption with associated data) receive path could write into file-backed pages supplied through a splice. The upstream fix separates the input and output buffers instead. I checked the source for the VM kernel I booted; it already had that separation.

The probe writes bytes into a pipe, then splices from it. It does not send file page-cache pages, perform the later receive, or check for corruption. It shows that the shield refused this splice on a running VM.

Write a rule of your own

To make your own BPF shield, write the program in C and choose where it attaches; Shirudo builds and signs the upatch that carries it. The official Your first upatch tutorial is a good first try. Its small fentry/do_nanosleep program counts sleep calls in a BPF map. It observes rather than blocks, so you can learn the build, load and unload cycle before writing a denial rule.

You can try that in the same VM after unloading the splice shield. A new upatch load will advance the TPM register again. If you opened a new Ubuntu shell, return to ~/shirudo, run . build/vm-toolchain.env, restore PATH as above, and raise the locked-memory limit again if needed. In the WSL shell, use the signing key that the first VM bundle kept outside the checkout shared with the guest:

KEYS=/tmp/shirudo-test-vm-private-$(id -u)/operator-keys/keys
test -s "$KEYS/signing_key.pem" && echo 'Signing key ready'

If you already stopped that VM, or the signing key under /tmp is gone, start a fresh one with a new name, bundle and key instead:

VM=shirudo-wsl-counter
BUNDLE="$PWD/build/test-vm/host-bundle-$VM"
PRIVATE="/tmp/$VM-private"
make -C testing vm VM_NAME="$VM" BUILD_CONTAINER=0 \
  TEST_VM_BUNDLE_DIR="$BUNDLE" TEST_VM_HOST_PRIVATE_DIR="$PRIVATE"
KEYS="$PRIVATE/operator-keys/keys"
test -s "$KEYS/signing_key.pem" && echo 'Signing key ready'

Use one of those routes, then make a directory for the source:

mkdir -p build/tutorial

Copy the short C example from the tutorial at our pinned revision into build/tutorial/sleep-count.bpf.c.

From the operator shell, build the upatch, inspect it and sign an unload directive tied to its payload digest:

shirudo build build/tutorial/sleep-count.bpf.c --keys-dir "$KEYS" \
  -o build/tutorial/sleep-count.upatch
shirudo upatch info build/tutorial/sleep-count.upatch

COUNT_PAYLOAD=$(shirudo upatch info --json build/tutorial/sleep-count.upatch | jq -r .payload_sha256)
shirudo build --unload sleep-count --payload-sha256 "$COUNT_PAYLOAD" \
  --keys-dir "$KEYS" -o build/tutorial/sleep-count.unload.upatch

Open the target shell with make -C testing vm-ssh VM_NAME="$VM". There, load it, read the map, run three sleeps, read the map again, and unload it:

shirudo-runtime upatch load /workspace/shirudo/build/tutorial/sleep-count.upatch
shirudo-runtime upatch map sleep-count calls
sleep 1; sleep 1; sleep 1
shirudo-runtime upatch map sleep-count calls
shirudo-runtime upatch unload /workspace/shirudo/build/tutorial/sleep-count.unload.upatch
shirudo-runtime upatch map
exit

The map should increase by at least three; other processes in the VM may add more. In my separate, fresh-VM run of this tutorial, it reached 17, and the signed unload left Pinned maps (0). Stop your VM from the operator shell with make -C testing vm-stop VM_NAME="$VM". This was an observation-rule test, not a malware block.

For a rule that blocks something, start with the operation you want to interrupt. Here it was an AF_ALG splice, and the rule checked socket_sendmsg for AF_ALG and MSG_SPLICE_PAGES. For another case, find a hook that can see the operation. A tracing hook can count matches, but a denial needs a hook that can reject the call, such as BPF LSM. Build and sign a test upatch, then try the suspicious action and similar legitimate ones in a disposable VM before shipping it. Shirudo’s kernel-fix-to-upatch tutorial works through another real kernel issue.

The repo also has upatch-writing instructions for coding agents. If you want Codex to help, give it a reproducer and a nearby benign case:

Use Shirudo's upatch-writing guide with [reproducer]. Start with a
rule that only counts the operation, then try it against [benign case]
in the test VM. Show me the BPF source, the results and the signed
unload before suggesting a blocking version.

For a team, the Shirudo FAQ suggests trying an observe-only version first to see what a blocking rule would hit. Sign a test build and try it on representative kernels and workloads. After review, publish the chosen artifact to an OCI registry and try it on canary targets. Check whether those canaries hit legitimate calls before rolling it out further.

What Shirudo added

I got the before-and-after I wanted: SPLICE_OK → SPLICE_BLOCKED → SPLICE_OK. While the shield was loaded, Linux ran the shield’s BPF LSM rule and returned EACCES for the splice. Without the shield, the same call succeeded. Shirudo accepted the signed load and unload, and the TPM report matched the upatch I expected. A deliberately wrong expected value failed.

The rule would also block legitimate AF_ALG splice sends. I didn’t try it against an application that uses them, so that’s the next thing I’d test in this fixed-kernel VM.