Why Tinfoil Replaced 1 Million Lines of C Firmware with 300 Lines of Assembly: Inside 400-Billion-Token Vulnerability Audits and Software Reductionism
Rather than burning billions of tokens patching legacy OVMF virtual machine firmware, confidential cloud startup Tinfoil shifted complexity to compile-time IGVM structures to shrink runtime TCB by 99.97%.
Published: October 29, 2026 | Read time: ~10 min | Watch Video (Japanese)
Executive Summary: Auditing Legacy Complexity vs. Eliminating It
In late 2026, a frontier AI research lab published results from a massive automated security audit. To harden the infrastructure hosting its proprietary models, the lab deployed fleets of autonomous AI agents against Open Virtual Machine Firmware (OVMF), the standard open-source UEFI implementation used to boot virtual machines across cloud datacenters.
The audit consumed 400 billion tokens—an expenditure equivalent to $8 million to $20 million in commercial API compute. The agents succeeded in discovering and patching several zero-day vulnerabilities in OVMF’s approximately 1 million lines of C code, including subtle bugs that had eluded human maintainers for two decades.

While celebrated as a triumph of automated vulnerability discovery, engineers at Tinfoil—a confidential computing startup founded by Joe Lothan, Jules Drean, and Mia Korennykh—posed a fundamentally different question in their technical paper Less Is More: From 1M Lines of Firmware to 300 of Assembly:
“Why does a cloud virtual machine designed solely to execute a predetermined Linux workload require 1 million lines of C firmware in the first place?”

Rather than spending millions of dollars in compute to patch legacy code, Tinfoil bypassed OVMF entirely. By leveraging the Independent Guest Virtual Machine (IGVM) format and building an ahead-of-time image compiler (cvmc), Tinfoil pre-computes ACPI tables, page structures, and kernel memory mappings at build time.
At runtime, all firmware logic is replaced by a zero-dependency ~300-line (4 KiB) x86 assembly reset shim performing exactly two boundary checks. This architecture reduces the runtime Trusted Computing Base (TCB) exposed to untrusted hypervisors by 99.97%, establishing a new standard for software reductionism in confidential cloud infrastructure.
| Dimension | Legacy Standard (TianoCore EDK II / OVMF) | Memory-Safe Minimal (Google Project Oak Stage0) | Software Reductionism (Tinfoil IGVM + Shim) |
|---|---|---|---|
| Codebase Scale | ~1,000,000 lines of C | Thousands of lines of Rust | ~300 lines of x86 assembly (4 KiB) |
| Runtime Inputs | 8 unverified host parsing paths | Runtime fw_cfg and ACPI/PCI scans |
2 static boundary checks (CPUs & memory map) |
| ACPI & Memory Setup | Dynamic host linking and AML parsing | Dynamic build in memory-safe code | Pre-computed at compile time via cvmc |
| Threat Model Posture | Assumes trusted hypervisor / host | Assumes untrusted host; relies on Rust | Untrusted host; runtime attack surface eliminated |
| Ideal Deployment | General-purpose cloud (Windows/Linux) | Dynamic enclave VMs needing kernel swaps | Uniform confidential AI workloads (QEMU q35) |
1. The Threat Model Inversion in Confidential Computing
To understand why 1 million lines of firmware represent a critical vulnerability, one must examine the fundamental shift in cloud security boundaries.

1-1. Trusted Host vs. Adversarial Hypervisor
In traditional cloud virtualization, the physical host, hypervisor (KVM/QEMU), and cloud provider administrators are defined as the Trusted Computing Base (TCB). Guest operating systems assume that configuration tables, ACPI descriptions, and hardware interrupts delivered by the hypervisor are authentic.
In Confidential Computing (powered by hardware extensions like AMD SEV-SNP and Intel TDX), this trust model is inverted:
- The Hypervisor Is an Adversary: The host OS and hypervisor are treated as untrusted, potentially compromised entities.
- Hardware Isolation: The CPU cryptographically encrypts guest physical memory using hardware-managed keys, shielding data from hypervisor memory dumps.
- Cryptographic Attestation: The CPU’s secure processor measures a cryptographic hash (Launch Digest in SEV-SNP; MRTD in TDX) of the initial guest memory state, allowing remote clients to verify system integrity before releasing secrets.
1-2. The 8 Untrusted Parsing Paths of OVMF
Because legacy OVMF was built to accommodate any possible hardware configuration, it executes eight complex parsing subsystems at boot time, reading data directly from the untrusted hypervisor:
fw_cfgInterface: Ingests configuration files, kernel binaries, and setup data over I/O ports or DMA.- ACPI Linker/Loader: Parses host-provided tables, dynamically patching pointers across memory.
- AML Bytecode Execution: Evaluates ACPI Machine Language bytecode supplied by the host.
- SMBIOS Parsing: Ingests system management hardware descriptors.
- Virtual NVRAM: Formats and parses persistent variable stores.
- Intel TDX HOB Parsing: Unpacks Hand-Off Blocks provided by host VMMs.
- Virtio Drivers: Executes full storage and network protocol stacks.
- PCI Scanning & Option ROMs: Discovers virtual devices and executes third-party ROM binaries.
Under AMD SEV-SNP and Intel TDX, every one of these eight subsystems acts as an entry point for an adversarial hypervisor to feed malformed structures into the confidential guest before the kernel boots.
1-3. The EDK II PXE RCE (GHSA-99cj-7hg9-mp4m)
The fragility of this complexity was highlighted on October 22, 2026, when TianoCore issued security advisory GHSA-99cj-7hg9-mp4m.
A critical pre-boot Remote Code Execution (RCE) vulnerability was discovered in EDK II’s PXE network boot driver (NetworkPkg/UefiPxeBcDxe). In handling ICMP error packets across IPv4 and IPv6 (PxeBcIcmpErrorDpcHandle and PxeBcIcmp6ErrorDpcHandle), the driver copied incoming network packet payloads into a fixed 504-byte buffer (Mode.IcmpError) without verifying bounds. An attacker sending a packet exceeding 504 bytes could trigger a buffer overflow, corrupting memory before the operating system loaded.
PXE network booting is essential for bare-metal datacenters, and maintainers patched the flaw immediately. However, in an isolated confidential cloud VM dedicated exclusively to AI model execution, hosting a complete, memory-unsafe PXE network stack inside the secure enclave represents unnecessary exposure.
1-4. Linus’s Law Inverted and Anti-Tokenmaxxing
Eric S. Raymond famously coined Linus’s Law: “Given enough eyeballs, all bugs are shallow.” For decades, engineering leaders assumed that widely adopted, multi-decade open-source software was inherently robust.
AI-driven fuzzing upends this assumption. When autonomous agents can inspect millions of lines of code, software robustness is no longer correlated with popularity. Instead, security depends on audit density—the ratio of analytical scrutiny to state space complexity. A 1-million-line codebase presents a virtually infinite state space where auditing 400 billion tokens cannot prove the absence of a 21st zero-day. In contrast, a 300-line program presents a bounded state space verifiable in hours.
This mirrors the internal “anti-tokenmaxxing” policy enacted at Amazon in late October 2026. Recognizing that teams were incentivized to generate massive volumes of AI code and burn billions of tokens without improving system stability, Amazon pivoted performance evaluations toward verifiable production outcomes and architectural simplification. True engineering rigor lies in eliminating unnecessary code, not generating surplus lines.
2. Technical Teardown: Replacing 1M Lines of C with a 300-Line Assembly Shim

Tinfoil re-evaluated the architectural requirements of their infrastructure: their cloud runs exclusively on a standardized virtual hardware profile—the QEMU q35 machine type. The Linux kernel, initrd, and kernel command line are known at build time. Consequently, zero dynamic hardware discovery is required at boot.

2-1. Compile-Time Memory Formulation via cvmc
Using Microsoft’s IGVM specification, Tinfoil created cvmc, a build-time compiler that pre-computes the guest physical memory layout down to the exact byte:
- Linux Kernel & Rootfs: The kernel binary (
vmlinux/bzImage),initrd, and boot parameters are placed at fixed Guest Physical Addresses (GPAs) and included in the hardware Launch Digest. - Pre-Compiled Static ACPI Tables: Instead of parsing host tables,
cvmcsynthesizes minimal, static ACPI tables (RSDP,XSDT,FADT,MADT,MCFG) tailored specifically for theq35architecture at compile time, eliminating AML runtime interpreters entirely. - Zero Page (
boot_params) & Initial Page Tables: The compiler builds the 4 KiB Linuxboot_paramsstructure and 64-bit PML4 identity page tables ahead of time. - Reset Shim Allocation: Exactly one 4 KiB memory page at GPA
0xFFFFF000is reserved for the assembly reset shim.

2-2. Runtime Execution of the 300-Line Assembly Shim
When the virtual machine boots, the CPU initializes at GPA 0xFFFFFFF0 in 16-bit real mode. The reset shim executes four linear operations:
- Immediate Mode Transition: Loads the pre-compiled page tables and transitions directly from 16-bit real mode to 64-bit long mode.
- Boundary Check 1 (CPU Cores
1..=255): Reads the host-provided CPU count (APIC ID), verifies it falls within1and255, and flips a single enable bit (from0to1) in the pre-compiledMADTtable. No dynamic descriptors are parsed. - Boundary Check 2 (Memory Shapes up to 2,046 GiB): Compares the host-reported memory size against
qemu_shapes, a static lookup table embedded in the assembly encoding valid memory geometries (supporting up to 2,046 GiB across four discrete ranges), writing verified bounds into theE820memory map. - Lazy Memory Acceptance: Hardware confidential computing requires guest memory pages to be validated (
PVALIDATEon SEV-SNP;TDG.MEM.PAGE.ACCEPTon TDX). Validating hundreds of gigabytes at startup introduces multi-minute boot delays. The shim validates only initial low memory (256MB to 2GB), logs remaining ranges into Linux’s standard unaccepted memory table (LINUX_EFI_UNACCEPTED_MEM_TABLE_GUID), and jumps directly to the 64-bit Linux kernel entry point.
By segregating the system into a build-time compiler (cvmc, verified via Nix reproducible builds) and a runtime shim (~300 lines of assembly), Tinfoil shrank the attack surface exposed to untrusted hypervisors to 4 KiB.
3. Industry Perspectives: OpenSSF, EDK II, and Google Project Oak
Understanding this architectural shift requires examining the broader ecosystem context.

3-1. Insights from OpenSSF Podcast #5
In Episode 5 of the OpenSSF “What’s in the SOSS?” podcast, host Omkhar Arasaratnam interviewed Matt Knight, Head of Security at a leading frontier AI research lab. Discussing why AI is being directed toward open-source auditing, Knight emphasized structural constraints:
“Every security team is bounded by Capabilities, Speed, and Scale. The software landscape we must defend is too vast for human analysts alone. We must apply automated intelligence to defend critical infrastructure.”
Knight highlighted major investments in memory safety and GPU Confidential Computing. His testimony reflects the mission of securing existing shared infrastructure: hyperscale cloud providers running millions of general-purpose instances across heterogeneous hardware cannot simply abandon EDK II. Auditing OVMF protects the existing global computing commons.
3-2. Google Project Oak: The Memory-Safe Alternative

Google’s Project Oak developed Stage0, a minimal BIOS implemented in memory-safe Rust (github.com/project-oak/oak/tree/main/stage0). Stage0 eliminates C memory vulnerabilities while reducing code volume to a few thousand lines.
The divergence between Stage0 and Tinfoil reflects a design trade-off along the flexibility spectrum:
- Stage0: Retains runtime flexibility by dynamically ingesting kernels over
fw_cfgand scanning PCI buses in Rust, supporting environments where kernels update without rebuilding platform images. - Tinfoil: Maximizes TCB minimization by pre-compiling all memory structures into IGVM files for uniform
q35hardware, enabling a pure 300-line assembly shim.
4. Architectural Principles: The Tenets of Software Reductionism

Tinfoil’s achievement illustrates three core design principles for modern systems architecture:
- Delete Dead Code Paths Before Auditing: Deploying automated AI auditors to inspect unused features (such as PXE stacks in confidential AI nodes) wastes resources. The most effective security mitigation is pruning obsolete code at the source.
- Shift Runtime Parsing to Compile-Time Compilation: Fragile runtime parsers interpreting dynamic host inputs should be replaced by ahead-of-time compilers generating immutable, cryptographically attested data structures.
- Reject “Just-in-Case” Generality: Systems burdened by legacy compatibility layers expose vast attack surfaces. Purpose-built infrastructure operating on standardized hardware profiles achieves superior security through radical simplification.
5. Practical Implementation Checklist for Systems Engineering

Infrastructure and security engineering teams can operationalize software reductionism through a three-step methodology:
| Engineering Focus | Concrete Audit Action | Production Standard |
|---|---|---|
| 1. Runtime Parser Elimination | Identify legacy parsers and daemon processes running in production VM and container images. | Remove unused packages; migrate production workloads to minimal or distroless base images devoid of package managers and shells. |
| 2. Immutable Build-Time Shift | Audit entrypoint scripts executing dynamic runtime fetches or configuration templating. | Shift template rendering and package resolution into CI/CD pipelines, producing immutable artifacts with cryptographic digests. |
| 3. Anti-Tokenmaxxing Governance | Eliminate metrics evaluating engineering output by raw code lines or token volume. | Reward code reduction, dependency pruning, and verifiable production reliability in engineering reviews. |
Frequently Asked Questions
Does discovering zero-days in OVMF indicate that EDK II is poorly designed?
No. EDK II implements over 3,000 pages of UEFI specifications, providing essential backwards compatibility across two decades of heterogeneous hardware. The vulnerabilities arise from a fundamental shift in the threat model: under confidential computing, the hypervisor changes from a trusted foundation to an active adversary.
Should all cloud virtual machines replace OVMF with Tinfoil’s assembly shim?
No. Tinfoil’s architecture is optimized specifically for single-purpose confidential workloads running on uniform QEMU q35 hardware. Environments requiring Windows guest support, dynamic device discovery, or legacy network booting require standard OVMF or Stage0.
Why did Tinfoil write the reset shim in x86 assembly rather than Rust?
Because all complex memory layouts are pre-computed at compile time, the runtime shim executes only mode switching, two boundary checks, and memory acceptance. Implementing this 4 KiB routine in assembly eliminates language runtime overhead and compiler abstraction risks, allowing complete line-by-line formal verification.
Primary Sources and References
- Tinfoil Engineering Blog: Less Is More: From 1M Lines of Firmware to 300 of Assembly — Joe Lothan, Jules Drean, Mia Korennykh (October 25, 2026)
- Tinfoil cvmimage Architecture Documentation (
docs/launch.md) - TianoCore EDK II Security Advisory: GHSA-99cj-7hg9-mp4m — Pre-boot RCE in EDK II PXE driver (October 22, 2026)
- OpenSSF Podcast #5: Exploring the Intersection of AI and Open Source Security — Matt Knight & Omkhar Arasaratnam
- Microsoft IGVM Specification: Independent Guest Virtual Machine file format
- Google Project Oak: Stage0 Minimal Rust BIOS for AMD SEV-SNP and Intel TDX
- The Linux Kernel Documentation: The Linux/x86 Boot Protocol and Zero Page (
boot_params)