{"slug": "llm-assisted-formal-translation-verification-for-compilers", "title": "LLM-Assisted Formal Translation Verification for Compilers", "summary": "Researchers built CheckRail, a translation verification tool that extracts Ignition bytecode and the corresponding Maglev graph from an unmodified V8 engine's debug output, translates both into a common verification intermediate representation, and uses symbolic execution and an SMT solver to detect semantic divergence including deoptimization paths. CheckRail identified the underlying semantic inconsistency behind a known Maglev vulnerability that the team exploited in one of four Chrome fullchain exploits this year, using a V8 revision predating the fix, without needing a memory-corruption trigger or DCHECK failure. The prototype supports only a defined subset of Ignition bytecode and Maglev IR, and the authors describe its verification model, implementation, case study and limitations.", "body_md": "## Abstract\n\nModern JavaScript engines execute functions across multiple tiers, beginning with interpretation and progressing through increasingly optimized compilation. Each transition introduces opportunities for semantic divergence, particularly when an optimizing compiler relies of speculative assumptions or reconstructs interpreter state during deoptimization.\n\nWe present our approach, a cross-tier translation verification tool for V8’s Ignition interpreter and Maglev optimizing compiler. For each compilation, it extracts ignition bytecode and the corresponding Maglev graph from the debug output of an unmodified V8 engine. Both representations are translated into a common verification intermediate representation (VIR), allowing an SMT solver to determine whether the optimized execution, including fallback to the interpreter at deoptimization exists, can differ from the original bytecode.\n\nIt makes assumptions explicit and classifies them according to the mechanisms that protect them. We evaluate the approach against a known Maglev vulnerability, the one we found when constructing one of the four Chrome fullchain exploits this year using a V8 revision that predates the fix. Our method identifies the underlying semantic inconsistency from the compiler’s output without requiring a memory-corruption trigger or DCHECK failure.\n\nThe current prototype verification tool supports a defined subset of Ignition bytecode and Maglev IR. We describe its verification model, implementation, case study and limitations.\n\n## Introduction\n\nJavascript engines rely on multiple execution tiers to balance startup performance with runtime optimization. In V8, JavaScript functions begin execution in the Ignition interpreter and may subsequently be compiled by Sparkplug, Maglev and Turbofan.\n\nAs execution progresses through these tiers, optimizing compilers use runtime feedback to specialize code based on observed behavior. These optimizations may depend on assumptions about object shapes, integer representations, captured variables and other properties of the execution environment.\n\nWhen an assumption no longer holds, the optimized code must deoptimize, reconstruct the appropriate interpreter state and resume execution at the correct bytecode offset.\n\nThis creates a fundamental correctness requirement: Optimized execution must preserve the observable behavior of the original program, including when execution transitions back to the interpreter.\n\nVerifying that requirement is challenging because the two execution tiers operate on different representations. Ignition uses register-based bytecode with an accumulator, while Maglev constructs a static single-assignment (SSA) graph containing specialized operations, runtime checks and deoptimization metadata.\n\nThe correctness of a compilation depends on more than the validity of individual optimizations. It also depends on whether the assumption supporting those optimizations remain valid, and whether deoptimization reconstructs the correct program state.\n\nSome assumptions are protected by runtime checks. Others rely on registered dependencies that invalidate optimized code when relevant heap properties change. And others depend on compiler invariants or language semantics.\n\nA complier may produce incorrect code when an assumption is treated as guaranteed, even though its required protection is absent.\n\nOur Approach: To investigate this problem, we developed CheckRail, a translation verification tool deigned to check the semantic relationship between Ignition bytecode and Maglev’s optimized representation.\n\nRather than proving the correctness of the entire compiler, it examines individual complications. It translates both representations into a common verification IR and uses symbolic execution and SMT-solving to search for inputs or environmental conditions under which their observable behavior differs.\n\nThis is critical: Our tool models deoptimization as part of execution, rather than treating it as trusted metadata. This allows the verification process to examine optimized execution paths as well as the correctness of transitions back to Ignite.\n\nIn the following sections, we describe the V8 execution model, Our tool’s verification architecture, the symbolic semantics used to compare programs, and a case study involving a previously identified Maglev bug.\n\n## Background\n\n**Ignition** is a register machine with an accumulator. A function’s bytecode reads and writes numbered registers, the accumulator, and the current *context*.\n\n**Contexts** are heap objects that hold captured variables in numbered slots and link to the enclosing scope’s context. A variable in its temporal dead zone holds a sentinel value, which is not a JavaScript value. Some slots are marked immutable;, they are initialized once.\n\n**Maglev** builds an SSA graph over a control flow graph directly from the bytecode, using the feedback the interpreter collected. A typical graph has a few kinds of nodes that matter here:\n\n- *checks* (`CheckSmi` ,`CheckMaps` ,`CheckValue` ) with an**eager deopt** frame: the interpreter registers to restore and the bytecode offset to resume at;\n- *calls* with a**lazy deopt** frame, used when the code is invalidated while the callee runs;\n- loads and stores that bypass generic semantics (a raw field load after a map check; a context-slot load treated as constant).\n\n**Code dependencies.** When Maglev relies on a heap fact that can change (the representation of a field, the state of a context cell), it registers a dependency. Changing the fact marks the code for deoptimization.\n\n## Overview\n\nOur tool checks one compilation at a time. Given a script, it runs the unmodified engine with its existing tracing flags and, for every function that Maglev compiles, obtains two programs: the function’s Ignition bytecode and the Maglev graph built from it. It translates both into a common verification IR, which we call VIR, and asks an SMT solver whether some entry state and some environment make the two observably differ. This section walks through a small example, explains why the comparison goes through a new IR instead of one of the engine’s own representations, and states what is checked.\n\n### A Small Example\n\n`bump` reads the captured variable `a`, overwrites it and returns it. The variable lives in slot 2 of the closure’s context. After `bump` has been called a few times with small integers, the engine holds two programs for it. The bytecode follows the source:\n\nThe Maglev graph for the same function (abridged; `n4` and `n8` are constants) is shorter:\n\nIt differs from the bytecode in four ways.\n\n1. The context is no longer a run-time value. It is the constant `n4` : the code was compiled for one particular closure.\n2. There’s a check. If the argument is not a small integer, `CheckSmi` deoptimizes, and its frame says where the interpreter continues: at bytecode offset 5, with these values in these registers.\n3. The store is specialized. `StoreSmiContextCell` writes directly into the cell that holds the variable, without the bookkeeping a general store needs. That is only valid for a small integer.\n4. Both loads are gone. The first was dead. The second was replaced by the value that was just stored, `n2` .\n\nEach step is correct. Each step is also a place where a compiler bug would not show up as a crash in the compiler, but as optimized code that behaves differently from the bytecode on some input. Our tool was designed to identify the semantic nuance between these different tiers.\n\n## Implementation\n\n### Verification IR: Common IR for Ignition and Maglev\n\nThe two listings can’t be compared as they stand, and the reasons are what shaped VIR.\n\n**The two programs are different kinds of objects.** The bytecode is a register machine with an implicit accumulator and a context register that instructions read and write. The graph is in SSA form, with typed nodes and no registers at all. A validator has to give a meaning to both. If each language had its own symbolic semantics, the trusted part would double, and nothing would connect the two semantics except our belief that they agree. We translate both into one small language with one semantics. That semantics is implemented twice, as a concrete interpreter and as an SMT encoding, and the two implementations are checked against each other.\n\n**The two programs work at different levels.** Bytecode operations are generic: a context load works for any context, and a property load is the full JavaScript lookup. Maglev operations are specific: a store that is valid only for a small integer, or a load from a fixed offset after a shape check. Neither language can express the other. The bytecode has no untagged integers and no raw loads, and the graph has no generic operation for the cases it speculated away. VIR contains both levels. The connection between them is itself a statement, for example “objects of this shape keep property `f` at offset 12”. That statement is exactly what the optimization relies on, so it has to be visible to the checker and to the reader.\n\n**What the optimized code assumes is not written in the graph.** The graph says that `n4` is a constant. It doesn’t say that the function’s context *is* that object whenever the code runs, or what guarantees it. VIR attaches such facts to the optimized program as explicit assumptions, each with the reason it is believed to hold: a runtime check, a registered dependency, a compiler invariant, a rule of the language, or the bytecode of the function that created the closure. The solver may use an assumption, the report lists it, and the engine can be used to test it. This is where the bugs we are after live: a belief that nothing protects.\n\n**Unchecked operations have preconditions.** `StoreSmiContextCell` is safe only because `CheckSmi` comes before it. Suppose the check was missing. As far as JavaScript can observe, `bump` would still return the same value and leave the same variable behind on every input. The damage is to the engine’s own invariants, which is how bugs become memory corruption. An IR that models only results can’t  see this. In VIR, the store carries its precondition, and reaching it with the precondition “false” is an outcome of its own.\n\n**Deoptimization joins the two programs.** The frame on `CheckSmi` refers to the bytecode by offset and to interpreter registers by name. Neither representation has a way to say “enter the bytecode at offset 5 with these register values.” VIR gives the reference a *resume point* for each such offset: a block whose parameters are the registers of the frame. A deopt exit is then an ordinary transfer of control with arguments, and the two programs can be linked into one execution. The deopt frame stops being metadata that we trust and becomes part of what is checked.\n\n**Reusing a value is not the same as reading it again.** Maglev returns `n2` where the bytecode loads the slot a second time. Whether that is right depends on whether anything could have changed the slot in between. VIR is in SSA form with an explicit heap: a value never changes once computed, and every read of the heap is an operation on the current heap. “The value loaded earlier” and “the value that is there now” are therefore different terms, and the solver decides whether they are equal. The bug in our case study is a case where they are not.\n\n**Coverage has to be explicit.** JavaScript is large and VIR is small: 30 operations over three kinds of value (tagged JavaScript values, untagged 32-bit integers and bits). A construct outside the subset makes the translation refuse the whole compilation and name the instruction. An execution that leaves the modeled domain at run time, for example arithmetic that would need a floating-point number, ends in a distinct outcome that is reported and never counted as agreement.\n\nThere is also an engineering reason. The engine’s representations can change every week or month and differ from tier to tier. With VIR in the middle, everything that depends on the engine’s formats is confined to two translators. The semantics, the checker and the test infrastructure depend only on VIR, and supporting another tier means writing another translator, not another checker.\n\nWe considered three alternatives:\n\n*1.* **Raise the Maglev graph to bytecode.** The bytecode can’t express untagged arithmetic, raw loads or deopt exits, so the graph would have to be weakened before it could be compared.\n\n*2.* **Lower both programs to machine code.** This would bring the entire object layout and the garbage collector into the model, and the observations we care about are at the level of JavaScript values. The interpreter is also not a per-function piece of machine code.\n\n*3.* **Encode each language directly in SMT.** This is the two-semantics problem above. It also leaves no shared place for assumptions, and no executable form in which to replay a counterexample.\n\n### The Example in VIR\n\nThe reference, translated from the bytecode (abridged):\n\nThe optimized program, translated from the graph (names shortened):\n\nEvery point above appears here. Registers and the accumulator have become SSA values. The constant context is an assumption about the entry state. `CheckSmi` is a guard whose exit names offset 5 and a frame, and block `b3` of the reference is where that exit lands, with the frame’s four registers as its parameters. The specialized store is an ordinary store preceded by its precondition. The reference reads the slot again (`v6`), the optimized program returns the value it stored (` v2`), and whether those are equal is the solver’s question.\n\n### Compare the semantic\n\nWith both programs in VIR, comparing them is a question about executions, instead of program text. Our tool runs the two symbolically from one shared entry state, so every argument, captured variable and heap cell is an unknown that both sides read, and every call is answered by the same unknown environment. The optimized program is not run alone: whenever it takes a deopt exit, execution continues in the reference at the resume point that the exit names. The requirement is then simple to say. Whatever the function is called with, and whatever the rest of the world does, the optimized code must end the same way the interpreter would have: with the same returned or thrown value, and the same state visible to JavaScript afterwards. The formula below states this idea.\n\nLet range over entry states and over environments, that is, the behaviour of callees and the engine’s own choices. Write for the outcome of the reference, and for the outcome of running the optimized program and continuing in the reference at the matching resume point whenever a deopt exit is taken. It checks linked refinement:\n\nHere is the entry contract together with the optimized program’s assumptions, are the outcomes that return or throw, and compares the returned or thrown value and the heap that a JavaScript program can observe afterwards. The precise statement, including executions that leave the modeled subset, is in §Refinement. The solver is asked for a counterexample: an and an that satisfy and make the two sides differ, or make the optimized side violate a precondition.\n\nFor `bump` there is none. On the fast path the optimized program stores and returns , and the reference returns what it reads back from the slot it just wrote, which is the same value. On the slow path the guard hands the argument to `b3`, which performs the same store and read. If we delete the guard from the optimized program, the solver answers with a non-integer argument that reaches the store with its precondition false. If we delete the store, it answers with an input on which both sides return the same value but the captured variable ends up different. Neither difference shows up in the returned value on any input.\n\n### Translating VIR to SMT\n\nTo ask the solver the question above, each VIR program has to become a set of formulas over the same unknowns. CheckRail does this by symbolic execution: it walks the program once, keeps terms instead of values, and records under which condition each way of ending is taken. Every VIR operation has exactly one translation rule. This subsection gives the sorts, a few representative rules, and then the complete translation of `bump`.\n\n**Sorts.** A tagged value is a term of an algebraic datatype. The Hole, `undefined` and `null` are separate constructors, so they cannot be confused with each other or with a number:\n\nAn untagged integer is a 32-bit bit-vector and a bit is a Boolean. The heap is a tuple of arrays. Context slots, for example, are a nested array from object identities to slot indices to values:\n\nThe entry state is a set of uninterpreted constants: one value each for the receiver, the arguments, the closure and the context, the heap arrays, and one object identity for every heap constant the graph names. We write for reading an array and for the array updated at . The predicates , and are the datatype’s testers, and and are its accessors for an object’s identity and a small integer’s payload.\n\n**Symbolic states.** Execution keeps a state : the path condition , a map  from SSA names to terms, and the current heap . The judgment\n\nsays that instruction takes the state on the left to the state on the right and emits the set of guarded outcomes, each a pair of a condition and a way of ending.\n\n**Rules.** A pure operation only extends . Strict equality, for instance, is equality of datatype terms:\n\nA context load reads the *current* heap. It is undefined on a non-object, so it splits off a  outcome and continues under the opposite condition:\n\nA store produces a new heap and leaves every earlier term untouched. This is what keeps “the value loaded before” distinct from “the value there now”:\n\nA guard is where optimized code may leave. The exit carries the frame and the heap at that moment, and execution continues only where the guard holds:\n\nA precondition has the same shape, but the other way of ending is undefined behaviour instead of a clean exit:\n\nArithmetic is bit-precise. Maglev’s checked 32-bit addition becomes a test, a guard on that test, and a wrapping addition. The test is exact: the sum does not overflow when computing it with one more bit gives the same number:\n\nA return ends the path and emits . A branch on sends to one successor and to the other. Where paths meet, at a block with incoming edges that pass the terms for a parameter , conditions are joined and values and heaps are merged:\n\nLoops are unrolled up to a bound, a path that needs more iterations ends in a separate outcome that is reported as not covered.\n\n**The example, translated.** Let the entry constants be , ,  and  (receiver, argument, closure, context), let  be the initial array of context slots, and let . We write only the slots array of each heap. Running the reference from its entry block with  gives\n\nso the reference has two guarded outcomes:\n\nIn the optimized program the context is the constant, , where  is the identity constant for the graph’s `n4`. Its single block gives\n\nThe condition of the outcome is contradictory. That is the formal content of “the check protects the store”.\n\nThe deopt outcome is not final. Linking turns it into the starting state of the reference’s resume block `b3`: the path condition is , the block parameters  are bound to the frame , and the heap is . Executing `b3` gives\n\nand the linked program has the outcomes\n\n**The query for the example.** The precondition contains the assumption , hence  and : both sides end with the same heap. What remains is the returned value. On the reference side it is a read of the slot that was just written, and the array axiom , applied twice, reduces it to the argument:\n\nA mismatch would therefore need , and the solver reports that none exists, in a few milliseconds.\n\nThe same formulas show what each ingredient is for. Without the assumption the query is satisfiable: the solver picks a context other than , the reference writes one object and the optimized code another, and the final heaps differ. Without the guard, the path condition at the is still , so the outcome has condition instead of , and the solver returns an argument that is not a small integer.\n\n## Case study\n\nWe applied CheckRail to CVE-2026-113193, V8 issue 559932543, a Maglev bug fixed by commit `af7d1483` (“Initialize private accessors early in BuildClassLiteral”). We found and reported this bug on **Sep 10, 2026.** We had two builds of the engine: revision `1926a0d990ff`, which predates the fix, and the fix commit itself. Neither was modified. The question for each build is the same: given only what the engine prints about one compilation, can the optimized code behave differently from the bytecode?\n\nWhat makes this a good test case is that the fix doesn’t touch `access` at all. It changes how the generator `maker` initializes the class, so `access`’s own bytecode and its Maglev graph come out byte-for-byte identical on both builds. Diffing the optimized code across the two revisions therefore shows nothing, and the bug cannot be found by looking at the Maglev output alone. It can only be found by checking that output against the bytecode it is supposed to refine, which is exactly the cross-tier comparison CheckRail performs.\n\n### The Program\n\nThe function of interest is `access`, a closure defined inside a class body:\n\nThe class has a private getter `#m`. Reading `x.#m` takes two steps: a *brand check* that `x` is an instance of the class, and a call of the getter. Both need data that the class definition stores in its context: the brand in slot 4 and the getter’s accessor pair in slot 2. The computed property key contains a `yield`, so the generator is suspended in the middle of the class definition and hands out `access` while the class is still being built. Calling `advance(true)` resumes the generator and finishes the definition.\n\n### What the engine compiled\n\nThe bytecode of `access` reads both slots, performs the brand check and fetches the getter, twice: once for `receiver.#m` and once for `object.#m`.\n\nThe Maglev graph for the same function reads each slot once:\n\nMaglev marks the two loads as `constant` because the bytecode reads the slots with an immutable-slot instruction, and it treats a constant load as unaffected by calls. The reads at `@54` and `@57` are served from `n9` and `n10`. The lazy deopt frames after the call also map the interpreter’s register to `n9`, so a deoptimized continuation would use the same value.\n\n### Proving the two versions differ\n\nWe prove the two versions are not the same program by exhibiting an entry state and environment, admitted by the precondition, on which they disagree, the negation of the refinement statement of the semantic:\n\nBoth sides run symbolically from the same  and , but read slot 2 at different points. The reference re-reads it *after* `advance`, passing  to the second `LoadPrivateGetter`. Maglev loads the slot once at entry, into the SSA value `n9`, and reuses `n9` at both getter loads, so it passes the entry value . The divergence is driven by a side effect of `advance`: resuming the suspended generator finishes the class definition, which stores a freshly created accessor pair into slot 2. The two sides therefore read two different objects, the reference the pair `advance` just installed, Maglev whatever occupied the slot before the call.\n\nIn the witnessed execution that earlier value, and so `n9`, is the uninitialized value, the generator was suspended before the accessors were set up, the ordering that the following commit fixes. A private read first does a *brand check* to look up the class brand (slot 4) on the object and throws if the object is not an instance of the class and only then loads the getter. At the first read, `receiver.#m`, the brand check on the arbitrary argument `receiver` throws and the `try`/` catch` swallows it, so the stale `n9` is never used.\n\nThe second read reaches the getter load because of what `advance` builds: it sets `object = new result.value()`, and the resumed generator returns the class `C`, so `object` is a real `C` instance. Its brand lives in slot 4, which *was* initialized before the `yield`, so the brand check passes and execution reaches the second `LoadPrivateGetter`. Only there does the late slot 2 matter: the reference re-read it and holds the real pair, while Maglev feeds the out of date `n9` to the cast to `AccessorPair`, a fatal DCHECK modeled as the deterministic . The reference returns and Maglev aborts. That is where the two semantics diverge.\n\n## Conclusion and Future Work\n\nOur prototype tools demonstrates how cross-tier translation verification can identify correctness violations in speculative JavaScript compilation.\n\nBy translating Ignition bytecode and Maglev IR into a common verification representation, it makes it possible to reason about optimized execution, runtime assumptions and deoptimization within a single semantic model across different tiers.\n\nAn important aspect of this approach is its treatment of speculative assumptions. Rather than accepting compiler-generated constants and specialized operations at face-value, It makes their supporting assumptions explicit and identifies the mechanisms expected to protect them.\n\nThe case study involving CVE-2026-113193 illustrates why this distinction matters. The relevant Maglev graph remains identical across the vulnerable and fixed versions, while the surrounding class-initialization behavior determines whether an assumption about context state is valid.\n\nThis demonstrates how a correctness violation can originate outside the optimized function itself, making cross-tier verification valuable for identifying assumptions that aren’t adequately protected.\n\n## Current Limitations\n\nCheckRail currently supports a subset of Ignition bytecode and Maglev IR. Its verification results are conditional on the modeled semantics, supported operations, entry assumptions and execution bounds.\n\nUnsupported constructs and executions that leave the modeled domain are reported separately, rather than treated as successful verification. This distinction is essential to interpreting the results accurately.\n\nExtending Verification Coverage A natural next step is to expand the supported instruction set and extend the approach to additional V8 optimization tiers.\n\nThe primary challenge is semantic modeling. Each supported operation must have a precise representation that reflects its behavior in the actual engine. Developing these models manually across hundreds of operations is time-consuming and introduces opportunities for subtle errors.\n\nLarge language models may help accelerate this process by generating candidate semantic rules from V8 source code and documented behavior. But generated rules must be validated against the running engine before they can be trusted.\n\nThe broader research direction is to make compiler assumptions, deoptimization behavior and cross-tier semantic consistency explicit and mechanically checkable, enabling correctness violations to be identified without depending on crashes or observable memory corruption.", "url": "https://wpnews.pro/news/llm-assisted-formal-translation-verification-for-compilers", "canonical_source": "https://nebusec.ai/research/tierref-maglev-verification/", "published_at": "2026-11-24 00:00:00+00:00", "updated_at": "2026-11-24 20:44:44.155557+00:00", "lang": "en", "topics": ["ai-safety", "ai-research", "artificial-intelligence"], "entities": ["V8", "Ignition", "Maglev", "CheckRail", "Chrome", "Google"], "also_reported_by": [], "takeaway": "CheckRail translates Ignition bytecode and Maglev SSA graphs into a shared verification IR and SMT-solves for behavioral divergence, catching a known Maglev vulnerability from compiler output alone without a memory-corruption trigger or DCHECK failure.", "recommendation": {"advice": "Verify optimized compiler output against interpreter bytecode by translating both into a common IR and SMT-solving for divergence, including deoptimization paths, rather than relying on crash triggers or DCHECK failures.", "playbook": "evals-testing", "playbook_url": "https://wpnews.pro/playbooks/evals-testing"}, "alternates": {"html": "https://wpnews.pro/news/llm-assisted-formal-translation-verification-for-compilers", "markdown": "https://wpnews.pro/news/llm-assisted-formal-translation-verification-for-compilers.md", "text": "https://wpnews.pro/news/llm-assisted-formal-translation-verification-for-compilers.txt", "jsonld": "https://wpnews.pro/news/llm-assisted-formal-translation-verification-for-compilers.jsonld"}}