cd /news/artificial-intelligence/llm-asm-ring-1-kernel-surgeon-2b-mod… · home › topics › artificial-intelligence › article
[ARTICLE · art-178001] src=explainx.ai ↗ pub= topic=artificial-intelligence verified=true sentiment=· neutral

llm.asm Ring -1 Kernel Surgeon: 2B Model Patches Linux Crashes Live

Alexey Fateev released phase 4 of llm.asm, a freestanding AMD SVM hypervisor called "Ring -1 Kernel Surgeon" that runs a MiniCPM5-2B Q4_K_M checkpoint to catch Linux kernel faults before panic() and overwrite the faulting instruction bytes in guest physical memory. In the QEMU/KVM demo, the hypervisor replaced 11 faulting bytes with 11 NOP (0x90) instructions in about 11.1 seconds on 24 cores, letting Linux 5.15 resume with the message "SURVIVED NULL-DEREF!" and without an uptime reset, per the project README. The README reports 119/122 pass@1 (97.54%) versus 16.39% for the base model and zero "dangerous continue" cases on a held-out set, while cautioning that the MIT-licensed ~75,424-byte hypervisor is a research demo using injected faults, not a supported production hardening tool.

recommendation

Keep LLM-driven kernel remediation outside the kernel tree and gate any patch through a static x86-64 validator before writing bytes, as Ring -1 Kernel Surgeon does; treat NOP patches and multi-second freezes as demo-only, not production fixes.

more in playbook: Running AI in production
by read8 min views2 publishedNov 29, 2026
llm.asm Ring -1 Kernel Surgeon: 2B Model Patches Linux Crashes Live
Image: Explainx (auto-discovered)

**Alexey Fateev shipped phase 4 of llm.asm: a freestanding AMD SVM hypervisor that sits in Ring -1 under Linux, catches a kernel fault before panic(), runs a MiniCPM5-2B checkpoint, and can overwrite the faulting instruction bytes in guest physical memory — then resume the guest without a reboot. The README calls the subproject 04-ring1-kernel-surgeon; the author brands it Ring -1 Kernel Surgeon in a November 27, 2026 post.

This is a QEMU/KVM research demo with a /proc/surgeon_crash test module — not a supported way to harden your fleet. It matters because it shows where small open models plus virtualization could intersect with kernel safety, the same week llm.asm''s bare-metal Qwen3 OS hit mainstream press.

TL;DR #

Question Answer
Binary size? ~75,424 Bsurgeon.elf hypervisor (README);** not** including**~2 GiB** model weights
Model? MiniCPM5-2B Q4_K_M ,GRPO fine-tuned per README
Guest OS? Linux 5.15 underQEMU/KVM withnested AMD SVM
Demo crash? Null-pointer write *(u32 *)0 = 0xDEADBEEF via test module
Reported fix? Replace 11 faulting bytes with11× NOP (0x90) in ~11.1 s on24 cores
Eval? 119/122 pass@1 (97.54% ) vs16.39% base;0 “dangerous continue” on held-out set per README
License? MIT (repo root)
Use in prod? No — seconds of downtime, NOP patches, synthetic faults only

How the stack is built #

The architecture file in 04-ring1-kernel-surgeon/ARCHITECTURE.md, summarized by the repo README, describes a Type-1 hypervisor with no host OS:

  • NASM assembly plus freestanding zero-libc C for the Ring -1 layer.
  • AMD SVM withnested page tables (NPT) so the hypervisor can edit guest.text safely.
  • 24 LAPIC SMP cores exposed to the inference path in the demo configuration.
  • efifb HUD for status on the host console during runs.

Linux remains unmodified at Ring 0. When a fault fires, the hypervisor freezes the guest before Linux prints a full oops/panic path, gathers instruction bytes and registers, calls the model, runs a static x86-64 patch validator, writes approved bytes into guest RAM, and issues VMRUN.

That pattern is closer to “surgical halt and edit” than to kdump or livepatch modules in upstream Linux — and it keeps the LLM outside the kernel tree, which matters for supply-chain stories like the Linux “assisted-by” AI tag debate.

Linux terminal motif for Ring -1 kernel patch research under llm.asm

Agents that act on your behalf need rules. See how explainx helps secure your agents →

The null-deref demo: what actually happens #

The README and author thread describe a side-by-side test:

  1. Vanilla Linux running the crash commandpanics immediately on a deliberate null dereference.
  2. Linux under Surgeon hits the same module, but Ring -1intercepts the fault.
  3. MiniCPM5-2B runs across24 AVX2 cores for about11.1 seconds .
  4. The hypervisor writes 11 NOP bytes over the faulting instruction viaNPT .
  5. Linux resumes, prints SURVIVED NULL-DEREF! , anduptime does not reset in the demo.

Important caveats the README itself supports:

  • NOP-ing an instructiondoes not repair program logic — it avoids the trap.
  • 11 seconds of guest freeze is unacceptable for most online services.
  • Tests use injected faults , not a randomNVMe driver bug in the field.

For agents that might someday propose kernel edits, the lesson is verification before apply — the repo ships a three-tier QEMU/KVM + Capstone verifier and GRPO training that rewards refusing unsafe patches. That rhymes with Anvio’s argument that LLMs should not get direct git push, but here the enforcement is virtualization + static validation, not policy text.

What 97.54% pass@1 does and does not mean #

The README''s 122 held-out scenarios include:

  • Cases that need a byte patch .
  • Cases that should delegate to Linux''s own handlers.
  • Cases that must halt rather than continue — e.g.unsafe spinlock states.

Pass means the model chose the documented correct action, not that Linux always behaved as if the original bug never existed. The README reports 0% dangerous continues on that set — strong for a bench, not a proof of security in the open internet.

Compare the base MiniCPM5-2B at 16.39% on the same suite: fine-tuning moved the needle, but three failures on 122 synthetic cases still imply catastrophic risk if one wrong patch ships on real hardware.

Builders evaluating MiniCPM elsewhere should read our BotPsy on-device agent benchmarks — a different task, but the same small-model economics.

Phase 5 in the same repo: eBPF without a hypervisor #

The README also documents 05-ebpf-jev: a 21 KB INT8 recurrent model inside Linux 6.12 eBPF LSM hooks with microsecond-scale latency. It shows the author exploring both “model below the kernel” and “model inside the kernel.”

For production guardrails today, eBPF LSM and livepatch with human review remain the realistic paths; this hypervisor is a teaching extreme. Pair it with our Vercel KVM escape discussion when you reason about Ring -1 trust.

Training and verification pipeline (from the README) #

Phase 4 is not only the 75 KB hypervisor binary. The subdirectory documents a full ML ops loop for a dangerous action space:

  • Dataset : hundreds ofsynthetic crash scenarios plusdistillation scripts indataset/ .
  • SFT then GRPO onMiniCPM5-2B intraining/ , withTensorBoard logging.
  • Three-tier verifier : QEMU/KVM replay plusCapstone disassembly checks inverifier/ so proposed patches cannot jump intoguest data orexpand beyond static rules.
  • Dashboard : FastAPI telemetry for training and verifier passes indashboard/ .

The 97.54% figure is verifier-gated pass@1 on held-out scenarios — closer to reinforcement learning with a hard safety filter than to "the model fixed Linux." That is why refusal cases count as wins: the intended behavior on spinlock crashes is do not patch.

Readers comparing agent benchmarks should note no mainstream SWE-bench score here. The task is machine-code editing under virtualization, adjacent to ExploitBench-style security evals but smaller and author-controlled.

Livepatch, kdump, and why Ring -1 is different #

Linux already ships mechanisms for kernel recovery:

Mechanism What it does How Surgeon differs
kdump Reboot into a capture kernel Saves state , does notresume the sick kernel
kexec Fast reboot to a new kernel Still a boot , notin-place edit
Kernel livepatch Applies vetted replacements Human-curated ,upstream process,symbol-based
eBPF LSM (phase 5) Hook syscalls in-tree Policy , notrewrite of faulting .text

Surgeon's demo optimizes for uptime theater in a VM: freeze, NOP, resume. Production SRE teams usually prefer fail fast, drain, and roll — especially after nginx2root-class remote execution bugs where silent continuation is worse than restart.

If agents someday propose kernel diffs, the useful borrow from this repo is verifier-before-apply, not LLM-below-the-kernel deployment.

Hardware and portability limits #

The README targets AMD SVM with nested virtualization in QEMU. Intel VT-x shops cannot assume the same intercept path works unchanged. Bare-metal marketing in social posts still means controlled metal inside KVM for the documented demos — read "bare-metal" as freestanding hypervisor, not "we patched your laptop kernel."

MiniCPM5-2B Q4_K_M also locks you to a specific open-weight lineage — see ColGrep's local search agent for a different 2B use case with measured token savings, not kernel bytes.

How to try it (lab only) #

From the repo root:

git clone https://github.com/alesha-pro/llm.asm.git
cd llm.asm/04-ring1-kernel-surgeon
make hv
python3 verifier/kvm_verifier.py --selftest

Follow 04-ring1-kernel-surgeon/README.md for nested SVM, initramfs, and VNC demo scripts. Requirements include AMD SVM, QEMU/KVM, and downloads for MiniCPM5 weights — not a five-minute laptop demo.

If you only need fast CPU LLM inference, stay with phase 1 or llama.cpp. If you want mainstream coverage of the 24 KB OS, see the Update on our llm.asm Qwen3 post.

What developers are saying #

Hacker News had only two comments on the Tom's Hardware bare-metal thread when this post was reviewed. dartharva recalled that early MS-DOS shipped in roughly 12 KB, framing tiny boot code as historically normal. vrighter noted that workloads larger than the OS were once typical. That thread did not debate Ring -1 patching. On Tom's Hardware's comment section, one reader argued OS overhead alone cannot explain a 54% decode gap without controlled conditions — the same skepticism to bring to any bare-metal vs Linux table.

Security and reliability limits #

Risk Why it matters
Silent data corruption Skipping an instruction can leave wrong kernel state .
Patch latency Multi-second freezes break HA assumptions.
AMD-only SVM No Intel VT-x path in the README snapshot.
Supply chain A poisoned Q4_K_M file sits in the TCB below Linux.
False confidence NOP patches look like recovery in atweet demo , not inpostmortems .

Sandboxed execution layers for isolating experimental kernel hypervisor demos

For real incidents — nginx HTTP/2 RCE, agent-written packages, kernel CVEs — follow vendor advisories and patch cycles, as in our NGINX2Root post. This project does not replace that work.

If you run agents with shell access near sensitive hosts, use organizational controls; for agent-risk posts we link AgentBeam in the what to do section — here the practical step is keep Surgeon in disposable QEMU, not on the hypervisor that holds customer data.

Binary sizes, pass rates, and timings come from the llm.asm README and the author''s November 27, 2026 post as of publication date; re-run the bundled verifier scripts before citing them in production docs.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @alexey fateev 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/llm-asm-ring-1-kerne…] indexed:0 read:8min 2026-11-29 · —