Should You Deploy Shirudo for Agentic Runtime Defense? Wait for Pre-Compiled Templates

Back to blog
Mehran Mozaffari·

The Verdict: Autonomous Kernel Patching Solves Containment Downtime, But Raw Code Generation Fails the Safety Bar

Every incident response engineer knows the painful tradeoff of live containment: dropping a pod or killing a process halts the exploit, but it also drops legitimate customer transactions. Shirudo targets this exact gap. By coupling autonomous AI response routines with dynamic in-kernel eBPF instrumentation, it promises zero-downtime virtual patching that buys human engineering teams critical hours to ship tested code fixes. Mechanically, intercepting an exploit at the system call layer is vastly superior to the blunt hammer of out-of-band process termination.

However, allowing an autonomous agent loop to synthesize unconstrained C code directly into production kernels crosses a severe reliability boundary. The Linux kernel verifier is unforgiving, and dynamic compilation on live nodes invites unpredictable failures.

What Shirudo Actually Does: Bridging LLM Reasoning to Kernel-Level System Call Interception

Shirudo connects the diagnostic reasoning of an autonomous security agent to the enforcement boundaries of the Linux kernel. When an upstream detection engine identifies an exploit primitive—such as corrupted arguments passed into an execve call or anomalous write paths within openat—Shirudo translates that context into kernel-level filtering logic.

Instead of restarting the parent container, the user-space controller handles compilation via libbpf and modern BPF Type Format (BTF) mechanisms, leveraging Compile Once – Run Everywhere (CO-RE) primitives to reconcile structure layouts with the active host. The resulting bytecode passes into the kernel through the standard bpf() system call. Here, the in-kernel verifier rigorously audits instruction paths, memory dereferences, and loop bounds before permitting the program to hook into execution points.

Enforcement centers on surgical hook targets. Attaching to BPF_PROG_TYPE_LSM allows the runtime to inspect process credentials, namespace boundaries, and system call arguments, returning an immediate -EPERM or -EACCES directly to the offending caller. Network-layer vectors can similarly be neutralized at Traffic Control (TC) or eXpress Data Path (XDP) attach points before malicious payloads hit socket buffers.

Because the mitigation executes entirely inside the kernel sandbox, the offending system call is aborted while the enclosing worker process continues running. The attacker’s execution chain breaks, but downstream connections, established thread states, and healthy transactions remain active. When the development team finally deploys a vetted application fix, an approval dispatches to Shirudo to detach the program, returning the host to its baseline state without a reboot.

Scorecard: Evaluating Shirudo Across Core Production Runtime Requirements

Evaluating Shirudo requires balancing its non-disruptive containment capabilities against the strict physical limits of kernel-space software execution. While the runtime eliminates the blunt availability impact typical of legacy response daemons, it introduces complex failure modes around verifier rejection, host dependencies, and elevated privilege boundaries.

Operational Dimension Rating Technical Rationale & Failure Boundaries
Exploit Containment Speed High Interposes at the LSM and TC boundaries within milliseconds of bytecode attachment, neutralizing active zero-day vectors synchronously.
Workload Availability High Nullifies malicious system calls via -EPERM without terminating pods, dropping TCP connections, or initiating process restarts.
Verifier Determinism Low High rejection risk if the agent writes raw C; complex pointer traversals and string parsing easily exceed stack limits (512 bytes) or loop complexity caps (1M instructions).
Operational Blast Radius Medium Faulty LSM logic returning unexpected errors can induce application deadlocks; unpinned programs may leak into bpffs if the user-space daemon crashes.
Kernel Portability Low Demands modern kernels (5.10+) with CONFIG_BPF_LSM=y enabled at boot and active BTF support; fails across legacy, backported, or heavily stripped cloud distributions.
Attack Surface Expansion High Running an autonomous controller requires CAP_BPF or CAP_SYS_ADMIN, creating an enticing target if prompt injection tricks the agent into dropping defensive shields.

The core tension lies between runtime determinism and agent autonomy. The Linux verifier does not negotiate: complex parsing logic synthesized on the fly will regularly fail instruction complexity analysis or stack allocation limits. Furthermore, because eBPF LSM programs persist in kernel memory if pinned, a crash in the Shirudo user-space controller leaves active blocks in place without an automated remediation path. Adopting Shirudo safely in production requires wrapping the agent in guardrails—treating it as an operator that activates parameterized, pre-tested templates rather than an unconstrained kernel C developer.

Where Agentic eBPF Outperforms Static EDR Kills and Declarative Policies

Traditional threat response architectures suffer from a blunt instrument problem. When detection daemons like Falco observe suspicious behavior in production—such as an unexpected subshell invocation from an image processing worker—their containment remediation relies on out-of-band kills. Issuing a SIGKILL or resetting a Kubernetes pod halts the exploit, but it simultaneously severs active TCP streams, dumps long-lived database connections, and drops legitimate, in-flight customer transactions. For revenue-critical services where 99.99% availability is a hard contractual mandate, blunt container termination can induce downtime just as damaging as the breach itself.

Declarative eBPF engines like Tetragon and KubeArmor solve the disruption problem by applying in-kernel LSM controls, but they depend on pre-authored, static policies managed through structured infrastructure pipelines. When an unmapped zero-day exploit emerges at two in the morning, relying on human operators to author, validate, and merge a declarative policy leaves a multi-hour exposure window.

Shirudo addresses this operational gap by granting an autonomous agent the speed of dynamic intervention paired with surgical in-kernel containment. Instead of killing the process group, Shirudo evaluates active exploit patterns and attaches eBPF filters directly to system call and network boundaries.

quadrantChart
    title Runtime Defense Tradeoffs Flexibility vs Disruption
    x-axis Static Rulesets --> Dynamic Code Generation
    y-axis Disruptive Process Kills --> Surgical In-Kernel Virtual Patching
    quadrant-1 Surgical Dynamic Containment
    quadrant-2 Surgical Declarative Enforcement
    quadrant-3 Disruptive Static Remediation
    quadrant-4 Disruptive Ad-Hoc Scripts
    Tetragon: [0.25, 0.78]
    KubeArmor: [0.20, 0.72]
    Falco: [0.30, 0.25]
    Ad-hoc scripts: [0.82, 0.20]
    Shirudo: [0.85, 0.82]

By interposing at hooks like BPF_PROG_TYPE_LSM, the runtime evaluates execution context—process ancestry, argument strings, socket endpoints—and rejects only the malicious primitive by returning an immediate error code like -EPERM. The parent application continues running, benign API requests proceed unaffected, and defenders gain the necessary runway to ship an upstream fix.

The Cost of Autonomy: Verifier Rejection, TOCTOU Vulnerabilities, and Orphaned State

The claim that the Linux kernel verifier makes autonomous C generation completely safe in production is dangerous optimism. The verifier guarantees memory safety and program termination; it does not guarantee runtime availability, semantic correctness, or exploit resilience.

When an autonomous agent attempts to synthesize C code on the fly to inspect complex payloads, it routinely clashes with hard kernel limits. Allocating string buffers on the eBPF stack immediately triggers failures against the strict 512-byte stack ceiling. Furthermore, parsing variable-length data—like tokenizing arbitrary shell strings or inspecting nested HTTP payloads—requires bounded loops or unrolled pointer traversals. The verifier tracks every potential execution path; an LLM-synthesized parsing loop easily triggers state explosion, exceeding the one-million instruction complexity limit and producing an unhandled -EACCES error during bpf(BPF_PROG_LOAD).

Operational lifecycle risks are equally severe. If Shirudo attaches dynamic probes to cgroup LSM hooks or pins programs inside bpffs, those programs live in kernel memory independent of user-space processes. If the user-space controller crashes or loses upstream connectivity, the kernel continues enforcing the dynamic bytecode. Without clean garbage collection, an agent-generated rule containing subtle logic bugs becomes an unmanaged rootkit that silently blocks legitimate production syscalls until an engineer manually unlinks the probe.

What Would Make Me Run Agentic eBPF in Production: Pre-Compiled Templates and Concrete Verification

I would never allow an unvalidated agent to compile raw, dynamic C directly onto production host kernels. Moving agentic eBPF from an operational hazard to a resilient enterprise control requires two non-negotiable architectural constraints: static bytecode templates and mandatory time-to-live expirations.

Instead of dynamic source compilation, the runtime must deploy an audited catalog of pre-compiled eBPF LSM programs ahead of time. The AI agent's action space should be strictly restricted to emitting structured JSON parameters—such as target binary hashes, forbidden argument fragments, or restricted network ranges. These parameters populate pre-allocated eBPF maps via standard user-space APIs. This completely bypasses host compilation toolchain dependencies, eliminates dynamic verifier failures, and secures the boundary against prompt-driven C code injection. Additionally, every active map entry must enforce a strict kernel-enforced TTL that automatically unblocks execution unless explicitly refreshed by a healthy controller.

Before granting runtime authority to any defensive controller, verify your host environment directly using standard tooling:

First, confirm that your running kernel has eBPF LSM active in its security module list:

cat /sys/kernel/security/lsm

The returned list must contain bpf. Next, verify that kernel BTF is available for BPF Type Format operations by inspecting /sys/kernel/btf/vmlinux. Finally, audit currently loaded security programs using bpftool:

bpftool prog show type lsm

Resources

(no official sources were available to link)

Updated 2026-11-22 by Mehran Mozaffari.

Related posts