explainx.ai350K+ learn from us
TrendingAI News TodayExplainx for Business
Pricing
explainx.ai

Upskill in AI — 16 free pathways, live workshops & bootcamps, and 50+ courses from practitioners. Plus the skills, tools, and MCP servers to practice on.

follow us

follow on google

Add explainx.ai as a preferred source

corporate training

support@explainx.ai

get started

Find your pathTake Free Evaluation

community

Join the community

learn

mind: share how you thinkpathways — start freeworkshopsbootcampscoursescompare Explainxcertificationsmock testsexplainx universitycorporate traininglearn skills & mcp

discover

skillsmcp serversexplainx mcpestacktoolsmdx readeragentsllmsdesignsdictionarypeopleagi trackerfelony benchranks

company

aboutvisionmissionteaminstructorsteach on explainxpartnershipscommunityhackathonscareers

content

daily AI newsstate of AI — live resultsblogreleasespromptsgeneratorsresource libraryfor LLMsexplainx.ai kids

solutions

all solutionsdeveloper upskillingmarketing upskillingproduct manager upskillingleadership upskilling

newsletter · weekly

Get AI news, tools, and insights in your inbox.

supportcontactprivacytermsdata rightshow we create contentsubmission guidelines

© 2026 AISOLO Technologies Pvt Ltd

explainx.ai

On this page

  • TL;DR
  • How the stack is built
  • The null-deref demo: what actually happens
  • What 97.54% pass@1 does and does not mean
  • Phase 5 in the same repo: eBPF without a hypervisor
  • Training and verification pipeline (from the README)
  • Livepatch, kdump, and why Ring -1 is different
  • Hardware and portability limits
  • How to try it (lab only)
  • What developers are saying
  • Security and reliability limits
  • Related reading
← Back to blog

explainx / blog

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

Local LLM, Open Source, Security, Linux Kernel, GitHub Trending

Part of Local AI

Alexey Fateev added a 75 KB AMD SVM hypervisor to llm.asm that freezes Linux on a crash, runs MiniCPM5-2B, and patches guest code. What the README proves, what stays a demo, and how to try it.

Nov 29, 2026·8 min read·Yash Thakker
add explainx.ai
go deep
llm.asm Ring -1 Kernel Surgeon: 2B Model Patches Linux Crashes Live

**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

table · 2 cols
QuestionAnswer
Binary size?~75,424 B surgeon.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 under QEMU/KVM with nested AMD SVM
Demo crash?Null-pointer write *(u32 *)0 = 0xDEADBEEF via test module
Reported fix?Replace 11 faulting bytes with 11× NOP (0x90) in ~11.1 s on 24 cores
Eval?119/122 pass@1 (97.54%) vs 16.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
Daily briefFrom Yash · 350K+ students taught

Catch up on AI

One AI story explained in plain English, plus one thing to try. Every day, free. Unsubscribe anytime.

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 with nested 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.asmLinux 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 command panics immediately on a deliberate null dereference.
  2. Linux under Surgeon hits the same module, but Ring -1 intercepts the fault.
  3. MiniCPM5-2B runs across 24 AVX2 cores for about 11.1 seconds.
  4. The hypervisor writes 11 NOP bytes over the faulting instruction via NPT.
  5. Linux resumes, prints SURVIVED NULL-DEREF!, and uptime does not reset in the demo.

Important caveats the README itself supports:

  • NOP-ing an instruction does 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 random NVMe 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 of synthetic crash scenarios plus distillation scripts in dataset/.
  • SFT then GRPO on MiniCPM5-2B in training/, with TensorBoard logging.
  • Three-tier verifier: QEMU/KVM replay plus Capstone disassembly checks in verifier/ so proposed patches cannot jump into guest data or expand beyond static rules.
  • Dashboard: FastAPI telemetry for training and verifier passes in dashboard/.

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:

table · 3 cols
MechanismWhat it doesHow Surgeon differs
kdumpReboot into a capture kernelSaves state, does not resume the sick kernel
kexecFast reboot to a new kernelStill a boot, not in-place edit
Kernel livepatchApplies vetted replacementsHuman-curated, upstream process, symbol-based
eBPF LSM (phase 5)Hook syscalls in-treePolicy, not rewrite 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:

bash
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

table · 2 cols
RiskWhy it matters
Silent data corruptionSkipping an instruction can leave wrong kernel state.
Patch latencyMulti-second freezes break HA assumptions.
AMD-only SVMNo Intel VT-x path in the README snapshot.
Supply chainA poisoned Q4_K_M file sits in the TCB below Linux.
False confidenceNOP patches look like recovery in a tweet demo, not in postmortems.

Sandboxed execution layers for isolating experimental kernel hypervisor demosSandboxed 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.

Related reading

  • llm.asm Qwen3-0.6B in 14 KB assembly
  • Linux kernel AI attribution policy
  • Cognition Devin Apps hosted tools
  • Knuth pauses on AI-generated kernel reports
  • GGUF malware on Hugging Face
  • Agent harness engineering guide

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.

Spotted something out of date? Let us know.
Daily briefFrom Yash · 350K+ students taught

Catch up on AI

One AI story explained in plain English, plus one thing to try. Every day, free. Unsubscribe anytime.

  • ✓ Free
  • ✓ One email a day, no spam
  • ✓ Unsubscribe anytime
Yash Thakker

Written by

Yash Thakker

Yash is an AI expert with over 300K learners. Join his workshops →

View Yash Thakker in People in AI →

Related posts

Nov 26, 2026

llm.asm: Qwen3-0.6B Inference in a 14 KB Pure Assembly Binary

A new GitHub repo, llm.asm, ships three LLM projects written only in x86-64 NASM assembly: a 14.7 KB Qwen3-0.6B inference engine, a 24 KB bootable LLM operating system, and a 33 KB GPT trainer. The author reports faster CPU decode than llama.cpp. Here is what is claimed, what is checked, and whether you should care.

Nov 25, 2026

Linus Torvalds Blasts 41k-Line AI-Assisted EXT4 Pull for Linux 7.4-rc5

A massive EXT4 pull request for Linux 7.4-rc5 mixed AI-generated bug fixes, expanded KUnit coverage, and real performance patches. Linus Torvalds merged it with sharp mailing-list warnings about shipping tens of thousands of lines during release candidate week.

Nov 23, 2026

PeakCut: Self-Hosted AI Clipper for Live Streams and Long Videos (1.8k GitHub Stars)

PeakCut by haziqahmedqasmi is a trending MIT-licensed stack that turns long uploads and live streams into vertical shorts with word-level captions. It runs on FastAPI with local sherpa-onnx transcription, accepts a dozen AI providers, and can record streams into a rolling buffer. This guide follows the official README and DEPLOY.md as of November 23, 2026.