WorksComputer Science
SafeJIT: A Speculating JIT Engine Verified Down to the Machine Code
Abstract
JIT compilers are among the most attacked components of modern software. They compile attacker-chosen programs, speculate on attacker-influenced type feedback, and run the result at full native privilege. A single wrongly eliminated guard or a missing deoptimization becomes memory corruption. We present SafeJIT, a small JavaScript engine with a speculating baseline JIT, together with a machine-checked proof in Lean 4 that its statically linked RISC-V and x86-64 executables never crash, on any input, in a model of a Linux user process. The theorem is about the shipped binaries, executed instruction by instruction on Sail ISA models (for RISC-V, the official one), and it covers everything in them: the parser and bytecode compiler, the interpreter and its type-feedback recording, the JIT compiler, all machine code the JIT can generate for any program and any feedback (type guards, guard elimination, loop type facts, register allocation with deoptimization metadata, inline caches, deoptimization and on-stack replacement), a mark-sweep garbage collector, the runtime, and a freestanding libc. The C compiler, assembler and linker are not trusted, and neither is floating-point arithmetic. The proof uses separation logic (iris-lean) over a model of a Linux user process whose stuck states are exactly the ways a process can crash, including fetching code that has not been made executable or whose instruction cache has not been flushed.
Introduction
Just-in-time (JIT) compilers exist to run untrusted code as fast as possible: JavaScript and WebAssembly from any web page, and eBPF programs loaded into the Linux kernel. Their input is chosen by an attacker and their output runs at full native privilege, outside any type system. A logic error in the optimizer, such as a guard that was wrongly removed or a type assumption that is never invalidated, does not cause a wrong answer; it causes memory corruption, and memory corruption in a browser renderer is the first step of a typical exploit chain.
The numbers bear this out. All Chrome exploits caught in the wild in 2021–2023 began with renderer memory corruption, and 60% of those were bugs in V8; historically about half of the exploited V8 bugs were in one of its compilers [16]. Microsoft found that about 45% of the V8 CVEs since 2019 were JIT-related [33]. Of the 97 zero-days Google tracked in the wild in 2023, 19 were in browsers and 9 in JavaScript engines [14], and in 2021 six of Chrome’s fourteen zero-days were in V8, including a TurboFan type confusion caused by a missing deoptimization (CVE-2021-30632) [38]. The usual mitigation for at-risk users is to switch the JIT off, for all sites except user-chosen exceptions in Apple’s Lockdown Mode and in the strict level of Edge’s enhanced security mode, or for unfamiliar sites in its balanced level [1, 29], at a cost of 1.5–10× or more on compute-heavy code [16]. Memory-safe implementation languages do not help: “memory safety can-not be guaranteed by the compiler if a compiler is directly part of the attack surface” [16]. Fuzzing [5, 17] and sandboxing [16] reduce the damage. A proof can remove the bug class.
Prior verification work has covered important parts of this problem (§ 12). Jitawa [31] verified a Lisp runtime and its JIT down to x86-64 machine code, but compiles before execution, without feedback or speculation. Icarus [37] verified the type-specialized inline-cache stubs of SpiderMonkey’s CacheIR generators against models of the macro-assembler. Work on speculation and deoptimization, from sourir [13] to CoreJIT [3, 4], proves semantic preservation across speculative tiers; CoreJIT’s latest version reasons down to CompCert’s x86 assembly semantics, trusting the step from assembly to installed bytes and the runtime primitives. Work on JITs for eBPF and WebAssembly, such as Jitk [43], Jitterbug [32] and [6, 19, 41], reaches machine code and production compilers, but does not verify speculation with deoptimization. None of these proves a theorem about the whole binary of a speculating engine for a dynamic language, at the level where an attacker actually operates.
This paper. We present SafeJIT, a small JavaScript engine with a speculating JIT compiler, and a machine-checked proof in Lean 4 [10] that its compiled RISC-V (RV64) and x86-64 executables never get stuck on any input:
def BinarySafe : Prop :=
∀ argv fs σ₀,
Init Image.entry Image.segments argv fs σ₀ →
∀ c, Reach (Loop, σ₀) c → PrimStep.NotStuck c
theorem memory_safe : BinarySafe -- RISC-V
theorem memory_safe_final : BinarySafe -- x86-64
Here Image is the executable, Init says that is the state right after Linux has executed it with arguments argv and file system fs, Reach is reachability in the operational semantics of the process, and NotStuck c says that configuration c has exited or can take a step (§ 4).
For every command line (including the debugging flags --trace-jit, --dump-jit and --dump-bytecode) and every file system, the statically linked ELF executable, run instruction by instruction on a Sail ISA model [2, 34, 40] (the official one for RISC-V), never executes an illegal instruction or traps, never touches memory that is unmapped or has the wrong protection (including fetching from JIT code that has not been made executable), never fetches an instruction whose bytes were written since the last instruction-cache flush (on RISC-V, where this is required), and only makes well-formed system calls. This holds for any JavaScript program the user supplies and for any type feedback that program produces. The proofs contain no sorry and no axioms beyond Lean’s standard ones and the auxiliary axioms that bv_decide introduces for its verified LRAT checker.
SafeJIT is a demonstrator: the engine is small. But the theorem has the shape one would want for a production engine, and it covers the part of a JIT that is hardest to get right. SafeJIT records type feedback in its interpreter, compiles hot functions to native code that speculates on the observed types, eliminates redundant guards using abstract types (within basic blocks and, on RISC-V, across loop back-edges), allocates locals and a virtual operand stack to registers, caches property lookups on hidden classes, deoptimizes to the interpreter when a guard fails, and enters compiled code in the middle of a loop by on-stack replacement (OSR). CVE-2021-30632, a missing deopt after a map change [38], is a bug in exactly these mechanisms.
Contributions.
An end-to-end safety theorem for the binaries of a complete JIT engine for a dynamic language, stated against Sail ISA models, for all inputs, with neither the C toolchain nor floating point in the trusted base (§ 4). To our knowledge it is the first such theorem for an engine that speculates, deoptimizes and performs OSR.
A proof architecture that makes this tractable (§ 5 and § 6): a per-instruction bridge from Sail to an abstract ISA; a separation logic over whole instructions in which code, including JIT code, is a persistent resource; modular specifications that build in parallel; GC epochs for a verified collector; and a two-layer JIT proof, in which a Lean model of the JIT is proved to emit safe code for every well-formed function and every feedback vector, and the binary’s JIT is proved to write exactly the model’s code.
Two targets with very different ISAs, RISC-V and x86-64, sharing the architecture-neutral parts of the logic (§ 7).
Bugs and gaps found during verification (§ 8), among them an unchecked instruction-cache flush and unchecked assumptions about the size of the address space.
An account of how the system was built: almost entirely by AI coding agents, with one researcher guiding them, in four weeks (§ 10). The proof is about 75 times the size of the C code; that would be prohibitive for people, but it is affordable for agents.
An argument that binary-level verification, which factors the C compiler out of the trusted base, does not make compiler verification obsolete. A JIT is a compiler inside the binary. Most of our effort is compiler-verification work, done inside a binary-level proof (§ 11).
Safety, not correctness. The theorem is safety, not functional correctness: we do not prove that SafeJIT computes what the ECMAScript specification says. NotStuck by itself rules out executing non-executable or stale bytes, touching unmapped or wrongly protected memory, and ill-formed system calls. It does not rule out a store to the wrong object on a writable page, or a well-formed write of the wrong data. The proof does establish much more internally: in its invariants, every value is well tagged and every pointer refers to a live object of the recorded kind, every memory access is justified by a points-to fact owned by the accessing code, and the JIT’s output is exactly what the verified model emits (§ 5 and § 6). These are what rule out the memory corruption on which JIT exploits are built, but they are invariants of the proof, not part of the theorem statement.
Artifact. We plan to release the engine, the proofs and the tooling as open source; they are not yet public. C paths in this paper are relative to the repository root, and Lean paths to proofs/SafeJIT/ (for RISC-V) or proofs/x86/SafeJITX86/ (for x86-64).
Use of generative AI tools. Generative AI was used throughout this work. The engine, the proofs and the tooling were written by AI agents (§ 10). This report was also written by an AI agent, Claude Opus 5.5 in the GitHub Copilot CLI, from the repository, its history and the agent session logs, at the author’s direction; it was revised in response to reviews that were themselves produced with AI agents.
Background
Speculating JIT engines
Production JavaScript engines (V8, SpiderMonkey, JavaScriptCore) execute a function first in an interpreter. While interpreting, they record type feedback: which types each arithmetic operation, comparison or property access has seen. Once a function is hot, a JIT compiler translates it to machine code that speculates that the future resembles the past. If an addition has only ever seen small integers, the compiler emits a 32-bit integer addition, preceded by guards that check the operands’ tags and followed by an overflow check. A guard that fails deoptimizes: it rebuilds the interpreter’s frame from the machine state and resumes in the interpreter at the corresponding bytecode instruction [18]. Conversely, a function that is stuck in a long-running loop can switch from the interpreter into freshly compiled code at a loop header, by on-stack replacement (OSR). Property accesses on objects are accelerated by hidden classes (shapes, maps) and inline caches, which remember the shape seen at an access site and the slot where the property lives [9, 12].
Every one of these mechanisms has an invariant that is easy to break. A guard may be removed because an analysis wrongly concludes it is redundant. The deopt metadata, which maps machine registers back to interpreter slots, may be wrong at a particular exit. An OSR entry may assume facts that hold on the normal entry path but not on the one taken from the interpreter. A cached shape may outlive the assumption that justified it. The resulting code then reads or writes memory based on a value whose type it has misjudged. That is a type confusion, and it is the standard first step of a JIT exploit.
Sail ISA models
Sail [2] is a language for describing instruction set architectures. The official RISC-V model [34] is maintained by RISC-V International and is the golden reference for the ISA; for x86-64 we use an independent Sail model, written from Intel’s manual and hardware behavior [40]. Sail compiles models to theorem provers, including Lean 4. In the Lean backend we use (a free-monad fork of lean-sail inherited from xv6iris [21]), the model is a Lean program in a free monad whose effects (memory reads and writes, undefined values, barriers) are answered by the caller. A machine step (cycle) fetches, decodes and executes one instruction and may raise exceptions, which in our setting are crashes.
Separation logic and Iris
We reason in Iris [20], a higher-order concurrent separation logic, via its Lean 4 port iris-lean [25]. Iris propositions describe resources: owns the memory at , holds if the resources split into parts satisfying and , and (“magic wand”) turns into . Persistent propositions describe knowledge that can be duplicated freely: in our proofs, that a word of code is at an address, or that an object of a given kind lives at a pointer. Iris’s weakest precondition says that is safe to execute and that holds of its result, and adequacy turns a closed proof of a weakest precondition into a statement about the operational semantics, namely that execution never gets stuck. The later modality together with Löb induction () gives recursion and loops without explicit termination measures.
MachCSL and xv6iris
Kaashoek and Zeldovich verified the xv6 kernel at the RISC-V binary level [21] with MachCSL, a concurrent separation logic over the Sail RISC-V model, again with AI agents doing most of the proof work. SafeJIT builds on their setup: we reuse their Sail configuration, their free-monad lean-sail fork and a few pieces of MachCSL, such as the boot-register interpreter. The two projects differ in their object: xv6iris verifies a kernel whose code is fixed when the proof is done, whereas a large part of SafeJIT’s executed code does not exist until run time.
The SafeJIT Engine
SafeJIT is a JavaScript engine written in C: about 2,500 lines for the compiler, interpreter, runtime and collector, 1,400 for the RISC-V JIT backend, 1,100 for the x86-64 JIT backend, and 1,500 for a freestanding C library. Figure 1 shows its structure. A single-pass compiler translates source code to stack bytecode. An interpreter runs the bytecode and records type feedback. Hot functions are compiled to native code that speculates on that feedback, and they return to the interpreter when a speculation fails. Everything, including the libc, is linked into one static ELF executable that makes raw system calls. This section describes the engine as an engineer would; § 4 to § 6 describe what is proved about it.

Figure 1. Architecture of SafeJIT. The theorem covers the whole box, including the machine code that the JIT generates at run time.
Language
SafeJIT supports a subset of JavaScript that is large enough to write realistic benchmarks: let/const/var; numbers (int32 and double), strings, booleans, null and undefined; arrays with literals, indexing, .length and push; objects with literals and property reads and writes; top-level recursive functions; if, while, for, break, continue and return; and all of the arithmetic, bitwise, comparison and logical operators, ??, compound assignment and ++/--. Builtins include print, sqrt, floor, Array(n) and clock. There are no closures, exceptions or eval. The test suite compares the engine’s output against Node.js in four tiering configurations: interpreter only, the default threshold, a threshold of one, and a threshold of two with effectively unlimited deopts.
Every resource limit is a clean error rather than undefined behavior: syntactic nesting (1,000), bytecode, constants and locals per function (65,535 each), operand-stack depth (30,000), call depth (20,000), string length (), nested array-to-string conversions, and source size (1 GiB). Out of memory is a clean exit as well. These limits matter for the proof: every one of them is an obligation that the proof would otherwise fail to discharge.
Values
Every value is a 64-bit word, NaN-boxed (Table 1). A double is stored as is. Other types live in the upper NaN space and are distinguished by their top 16 bits, so a type check is a shift and a compare. Pointers are 48 bits wide, so every heap address must lie below (§ 8 describes how the proof found that this was not always guaranteed).
| top 16 bits | meaning |
| < 0xFFF9 | double (any bit pattern) |
| 0xFFF9 | int32 in the low 32 bits |
| 0xFFFA | false = 0, true = 1, null = 2, undefined = 3 |
| 0xFFFC | pointer to a heap object |
Table 1. NaN-boxed value representation.
Every bit pattern below is a valid double, including the positive canonical NaN and x86-64’s default NaN . Only negative NaNs with a nonzero payload in bits 48–50 collide with the tags, and a double whose bit pattern reads back as another type would be a type confusion. Every double result is therefore checked by an integer test: bits at or above are replaced by the canonical NaN. The JIT emits this test after every floating-point instruction; mk_double in C also canonicalizes every NaN. RISC-V arithmetic produces only canonical NaNs, but x86-64 propagates NaN payloads, so on real hardware the test is needed. In the proof, the ISA models’ floating-point operations remain opaque functions that may return any bits; the integer test is what makes safety independent of floating-point semantics.
Bytecode
The compiler is a Pratt parser that emits stack bytecode directly, one function at a time. While it emits each instruction it also records the operand-stack depth before it and whether a jump targets it. Nothing re-checks the bytecode at run time. The interpreter and the JIT both rely on its well-formedness: every operand is in range, every path reaches an instruction with the same stack depth, the stack never underflows, and it never exceeds the function’s recorded maximum. In the proof this becomes a predicate CodeWF (§ 5.4) that the compiler is proved to establish and that the interpreter and the JIT assume.
Interpreter, feedback and tiering
The interpreter is a dispatch loop over a frame whose slots array holds the locals followed by the operand stack. Arithmetic, comparison, conditional jump and element-access instructions OR a bit into fn->feedback[pc]: int, double (also set when int operands overflow), bool, array, or other. After 200 calls, or 200 loop back-edges, a function is compiled. A function call then enters the JIT code at pc 0, and a back-edge enters it at the loop header by OSR. When JIT code deoptimizes, the interpreter throws the code away and resumes at the failing instruction, which now records the feedback that would have prevented the deopt; the function is recompiled once it is hot again. After deopts a function stays interpreted, where is set by --max-deopts and defaults to 8.
Calls between functions, including calls from JIT code, go through vm_call. It checks the call depth, sets up the callee’s frame on a separate VM stack, and enters the JIT code if there is any, or the interpreter otherwise. JIT code and the interpreter are therefore mutually recursive.
The JIT compiler
The RISC-V JIT (src/jit.c, 1,400 lines) emits RV64IMD code into a buffer, maps it read-write, copies the code in, switches the mapping to read-execute with mprotect, and flushes the instruction cache. The flush’s result is checked; if it fails, the code is unmapped and compilation fails.
Shared frame layout. JIT code uses the interpreter’s frame layout. Because the stack depth at each pc is static, each operand-stack slot is a fixed offset from the frame base, kept in a pinned register. Other pinned registers hold the int tag, the boxed false, the frame, a table of runtime helpers, and the globals. At a bytecode boundary where nothing is cached in registers, the memory frame is exactly what the interpreter would have. Deoptimization then amounts to storing the pc and stack depth into the frame and returning, and OSR is a jump to the native address of a loop header.
Speculation. For each instruction, a strategy is chosen from its feedback (Table 2). Int code checks both operands’ tags, performs a 32-bit operation, and checks for overflow and −0. Double code checks that the operands are numbers, converts ints, and uses the FPU. Array code checks the tag, the object kind and the bounds, and then loads or stores directly. Instructions without any feedback were never executed by the interpreter. Their code deoptimizes unconditionally (a “soft deopt”), so that a branch that was cold at compile time does not stay generic forever. On the sieve benchmark, soft deopts changed the speedup from 1.3× to about 20×.
| feedback | strategy | code |
| only int | int | tag guards, 32-bit ALU, overflow/−0 checks |
| int, double | double | number guards, convert, FPU op, canonicalize |
| only bool | bool | branch on the raw bits |
| only array | array | tag, kind and bounds guards; direct access |
| none | deopt | deoptimize unconditionally |
| other | generic | call a C runtime helper |
Table 2. Strategies chosen from type feedback.
Guards and deopt stubs. A failed guard branches to a small out-of-line stub. The stub writes back any state that is cached in registers, loads the bytecode pc and the stack depth at which to resume, and jumps to the shared deopt exit. The exit spills the register-allocated locals, stores pc and depth into the frame, and returns 1 to jit_enter’s caller.
Guard elimination. The compiler tracks an abstract type for each stack slot and each local (unknown, int, double, bool, array), and for each stack slot, the local it was copied from, if any. After i < n has been checked as int, a later i + 1 does not check i again. Results of int operations are known ints, a.length is a known int, and so on. A guard is emitted only if the abstract type does not already imply it.
Loop type facts. At a merge point, the compiler normally forgets all abstract types. On RISC-V, a merge point may instead begin with checks of assumed types for up to 16 locals, which deoptimize if a check fails. The code after the checks (the loop head) knows those types. Entries from the interpreter, fallthrough and forward jumps run the checks. A backward jump whose own abstract state implies the facts skips them and jumps directly to the head. jit_compile infers the facts with a first code-generation pass, which records the abstract state at every jump into each merge point, and then compiles a second time with the intersection of those states. The facts are only hints: any choice is safe, because the checks enforce them. If the second pass fails, the compiler falls back to compiling without facts.
Register allocation. On RISC-V, the first five locals live in callee-saved registers. Their frame slots are stale except right after a spill, which happens before every helper call
(helpers may collect garbage or inspect the frame) and at the deopt exit. Within straight-line code, the top of the operand stack is virtual: a pending slot is held in one of eight pool registers, or it is a copy of a local or a constant. Pending slots are flushed to the frame before any operation that may read the frame or leave straight-line code. The deopt stub of an instruction materializes exactly the pending slots that exist at that instruction’s start. This is the deopt metadata that production JITs keep, in its simplest form. A comparison followed by a conditional jump is fused into a single native branch.
Objects and inline caches. Objects have hidden classes: a shape is a node in a transition tree, and each child adds one property. Shapes are immortal, so a cached shape stays valid forever. Every property access site has a monomorphic inline cache holding a shape and a slot (for a store that adds a property, also the shape after the addition). The caches are data-driven: the JIT embeds the address of the site’s cache in the code, and the code reads the cache at run time. It checks that the receiver is an object whose shape equals the cached one, then loads or stores the cached slot directly; on a miss it calls the runtime’s property helper, which updates the cache. The code is never patched, and the cache is shared between the interpreter and JIT code.
An example. Figure 2 shows the code that --dump-jit prints for part of the loop for (let i = 0; i < a.length; i++) s = s + a[i];. Locals a and i are in registers s0 and s9. a.length checks that a is an array, and its result goes to a pool register (a5) instead of the frame. The comparison does not check i’s tag, because the loop fact says that i is an int, and it is fused with the loop’s exit branch. Element access does not check that a is an array, because it was checked in the same block. The deopt stubs at 0x150 and 0x1b8 write the pending state back to the frame before they leave.

Figure 2. Annotated --dump-jit output (RISC-V) for the loop of sum(a). Comments are ours.
Runtime, garbage collector and libc
The runtime implements the generic semantics: conversions, + on strings, comparisons, number printing, arrays, objects and the builtins. Strings, arrays and objects are collected by a non-moving mark-sweep collector (src/gc.c, about 100 lines). It runs only at a safepoint in vm_call, once enough objects have been allocated since the last collection. At that point every live value is the callee, a slot on the VM stack, or a global; NaN-boxing makes pointers precise, and no C local, machine register or JIT code holds a collectible object across a call. Functions, natives and shapes are immortal. JIT code is never freed: each function is compiled at most times, so the code leaked by deopts is bounded by times a constant multiple of the program size.
The libc (src/libc) is written to be easy to verify: straight-line code, bounded loops, fixed-size buffers and no heap use in the number conversions. _start switches to a static 64 MiB stack. malloc uses a size-class allocator over 64 MiB
; 18 GET_LENGTH feedback={arr} -> array
114: mv a0, s0 # local 0 (a) is in s0
118: srli t0, a0, 48 # tag
11c: addi t1, s4, 3 # s4 = 0xFFF9; +3 = object
120: bne t0, t1, 150 # guard: object
124: slli a0, a0, 16 # unbox pointer
128: srli a0, a0, 16
12c: lwu t0, 0(a0) # object kind
130: li t1, 1
134: bne t0, t1, 150 # guard: array
138: lwu a3, 4(a0) # length
13c: ... # box as int32
148: mv a5, a3 # pending stack slot in a5
14c: j 164
150: sd s9, 24(s1) # deopt stub: materialize
154: sd s0, 32(s1) # the pending slots,
158: li t0, 18 # pc = 18,
15c: li t1, 2 # depth = 2,
160: j 78 # to the deopt exit
; 19 LT feedback={int} -> int (i known int)
164: mv a0, s9
168: mv a1, a5
16c: sext.w a0, a0
170: sext.w a1, a1
174: blt a0, a1, 17c # fused with JMP_IF_FALSE
178: j 260 # loop exit
; 23..29 GET_LOCAL i; GET_LOCAL a; GET_LOCAL i
(virtual)
; 32 GET_ELEM feedback={arr} -> array (a known array)
17c: mv a0, s0
180: mv a1, s9
... bounds check, load a[i] into a5 ...
1b8: sd s8, 24(s1) # deopt stub of GET_ELEM
...
mmaped arenas with a real free. strtod and printf("%e") are exact (correctly rounded), using a fixed 4096-bit bignum. The C compiler is GCC with -march=rv64g: no compressed instructions and no libgcc, so the binary and the JIT’s output are both made only of 32-bit instruction words.
The x86-64 backend
src/x86_64/jit.c is a port of the RISC-V JIT to x86-64. It has the same frame layout, strategies, guards, guard elimination, deopt protocol and OSR, but neither register allocation nor loop facts. The port has to deal with x86’s peculiarities.
idiv traps on division by zero and on INT_MIN / -1, so the divisor is checked first and the division is done in 64 bits. Overflow is detected with the OF flag. ucomisd sets ZF/PF/CF for unordered operands, so comparisons are chosen so that NaN operands give false. SSE arithmetic propagates NaN payloads, so the check after every FP operation is required on real hardware, not just defensive. The stack must be 16-byte aligned at calls into C helpers. Everything else (compiler, interpreter, runtime, collector and most of the libc) is the same C code, compiled with GCC for x86-64-v1.
The Theorem
This section states what is proved and what is trusted. We describe the RISC-V development; § 7 describes how the x86-64 one differs.
A process language in which stuck means crashed
The theorem is stated over a small-step semantics of a Linux user process (Proc/Lang. lean). A process state consists of the Sail register file, a byte-addressed memory with per-page read/write/execute protection, and an abstract kernel state (open files with their offsets and contents, and the file system). A step either executes one Sail cycle, or, when the instruction at the program counter is illegal, executes a system call atomically according to a contract. The language is constructed so that every way a real process can crash is a state with no step (Table 3).
| event | Linux | model |
| trap out of U-mode (illegal or misaligned instruction, ebreak, …) | fatal signal | no step |
| access outside mapped memory or against its protection | SIGSEGV | no step |
| executing JIT code not made executable | SIGSEGV | no step (fetch needs X) |
| fetching a byte written since the last I-cache flush | stale code | no step |
| a failed Sail assertion | — | no step |
| syscall outside the contract (unknown number, bad pointer, bad flags) | −EFAULT, … | no step |
| exit_group(n) | exit | final value |
Table 3. Crashes and how the process model represents them.
Instruction-cache coherence. The Sail RISC-V model executes fence.i as a no-op and leaves instruction-cache coherence to the memory model. On SMP Linux fence.i is not enough anyway, because the thread may migrate to another hart; user programs must call the riscv_flush_icache system call. The process memory therefore tracks dirty bytes. Every store marks the bytes it writes, and an instruction fetch of a dirty byte has no step. Only a riscv_flush_icache that returns 0 clears the dirty bits, and the initial image is clean. A JIT that writes code and runs it without a successful flush is therefore stuck in the model, as it may be on real hardware.
Address space. Linux on Sv57 can hand out addresses up to : mmap falls back above once the low window is full, and before Linux 6.6 the stack sat just below the top of the address space. The model therefore lets the kernel place the stack and mmap results anywhere below , except for the platform’s CLINT region, which the Sail configuration requires to be unmapped. The program itself must not assume more than it checks.
The statement
Let Init entry segs argv fs σ₀ say that is a state in which the kernel has just executed the ELF image with entry point entry and loadable segments segs, with argument vector argv and file system fs. Safety says that every reachable configuration can step or has exited:
def Safe (entry : Addr) (segs : List Segment) : Prop :=
∀ argv fs σ₀, Init entry segs argv fs σ₀ →
∀ c, Reach (Loop, σ₀) c → PrimStep.NotStuck c
def BinarySafe := Safe Image.entry Image.segments
theorem memory_safe : BinarySafe
def ElfSafe := Elf.Wf file ∧ Safe (Elf.entry file)
(Elf.segments file)
theorem memory_safe_elf : ElfSafe
argv ranges over all lists of byte strings, so the theorem covers every JavaScript program (the program is a file named on the command line), every flag (including --jit-threshold=N, --max-deopts=N, and the debugging flags that disassemble JIT code), and every file system state. memory_safe_elf restates the theorem over file, the raw bytes of the safejit executable, read through a small formal ELF loader (Proc/Elf.lean). The image that the proofs work with, a list of decoded instructions in Image.lean, is generated by an untrusted script; decide +kernel checks that it agrees with what the loader reads from the raw bytes.
The theorem quantifies over every state after a successful modeled exec, so it is only as meaningful as Init is satisfiable. We check part of this: initRegs_nonempty shows that the register-file part of Init has a witness for every entry point and stack pointer, established by running the Sail model’s own initialize_registers followed by the writes that Linux performs at exec. We have not built a witness for the full predicate on the actual image (with loaded segments, a valid stack and an admissible argument vector); Init is written to be a direct transcription of what Linux does, and arguments are C strings, so they cannot contain NUL bytes.
A safety theorem is also satisfied by an engine that does nothing interesting, for example a JIT that always fails or always deoptimizes. Two things rule this out for SafeJIT. The binary’s compiler is proved to write exactly the code of the executable model Jit.compile (§ 6), and that model is tested against the logged compilations of the real engine; and the benchmarks (§ 9) show that the JIT code runs and is 2–25× faster than the interpreter.
The trusted base
The trusted base consists of the following.
The Sail RISC-V model with the F and D extensions, compiled to Lean by Sail’s Lean backend, and the free-monad Sail library. Our regeneration script also fixes a bug in that backend:
flen = flen_bytes * 8was printed without parentheses, so every FP register was eight bits wide.The process abstraction: one U-mode hart with
satp = Bare, sequentially consistent memory with per-page protection, no signals, no interrupts, and the dirty-byte rule for instruction fetches.The syscall contract (
Proc/Syscall.lean) for twelve system calls: read, write, openat, close, lseek, mmap (anonymously only), mprotect, munmap, clock_gettime, riscv_flush_icache, exit and exit_group. Every call except the two exits may fail with any error code, so the program must handle failure everywhere. A successful mmap returns fresh pages anywhere below . A failed flush leaves the instruction cache stale.The exec state: the registers that Linux sets up and the System V initial stack, which can lie anywhere in .
The ELF loader (
Proc/Elf.lean) and its well-formedness conditions (a RISC-V executable without an interpreter, segments inside the file and disjoint, no wrap-around, page-congruent offsets), and the raw file dumpElfFile.lean, which a separate Lean program checks byte for byte against the executable.Lean’s kernel, and the compiled LRAT checker of
bv_decide, whose uses appear as auxiliary axioms. No proof usesnative_decide.
The trusted base does not include the C compiler, assembler or linker, since the proof is about their output, or the libc, which is part of the binary. Nor does it include floating point: the model’s softfloat operations are opaque functions, and no safety argument depends on their results. NaN-boxing canonicalizes every double with an integer test, and any value derived from a floating-point result, such as an array index from fcvt, is bounds-checked before it is used. The build is reproducible: compiling the sources produces exactly the bytes in ElfFile.lean.
What the theorem does not say. The theorem does not say that SafeJIT implements JavaScript correctly, that it terminates, or that it does not leak memory. Out-of-memory, nesting limits and JavaScript errors are clean exits, and so are consistent with safety. A program that loops forever is safe. These are deliberate choices. Safety is the property that attackers need to violate, and it can be stated without a formal semantics of JavaScript. Each of these stronger properties is an extension, not a replacement (§ 11).
Proof Architecture
Figure 3 shows the structure of the proof. At the bottom, the Sail model executes one instruction as a long program of register reads, memory events and bit-vector operations. One bridge lemma per instruction form turns this program into an abstract one-step semantics. An Iris program logic over whole instructions sits on top of that, and the separation-logic specifications of the binary’s functions are proved in that logic. Adequacy of the logic then gives Safe. This section goes through the layers from the bottom up. § 6 covers the JIT.

Figure 3. The layers of the RISC-V proof. Red is trusted, orange is the ISA abstraction, yellow is the program logic, green are the program proofs, and blue is the statement.
From Sail to an abstract ISA
The Sail model’s cycle function, compiled to Lean, is a program in a free monad whose effects are register reads and writes, memory events and nondeterministic choices. To reason about it we use a symbolic executor, twalk, a Lean tactic that proves that a cycle run from a symbolic register file satisfying some hypotheses ends in a given postcondition for every answer to every effect. It executes one effect at a time. It folds closed subterms by kernel reduction and decides branch conditions with decide, then bv_decide, then bv_omega, using only the hypotheses that mention the condition’s variables. When a condition cannot be decided it splits on it. Decoding a symbolic instruction word with a symbolic register field needs special simplification procedures, which select instruction fields by width.
Each bridge lemma proves one instruction form for all operands. For example, cycle_addi covers addi rd, rs1, imm for all rd, rs1 and imm. It takes 487 steps and about 25 seconds. The lemma states that the cycle fetches the instruction, preserves the configuration invariant Cfg (U-mode, no translation, the PMP and PMA settings, interrupts disabled), sets PC to and updates the register file. Loads and stores additionally require a naturally aligned address in main memory and record the data access. The 87 bridge lemmas cover every instruction form in the binary and every form the JIT emits: 30 integer ALU forms, eight control-transfer forms, eleven loads and stores, thirteen RV64M forms, 24 F/D forms and fence. i. For the multiplication and division instructions, a separate file proves that Sail’s Int arithmetic (truncating division with an overflow clamp) equals the corresponding BitVec operation. Floating-point results are the model’s opaque softfloat functions.
A script reads the lemma statements and generates Proc/ISA.lean: an inductive type Instr with one constructor per lemma, its encoding, a memory precondition Instr.Pre and a functional next-state function Instr.next. A generic lemma step_instr then says that, if the program counter points at executable bytes encoding and holds, every cycle ends in the state given by i.next. Above this layer, no proof mentions Sail. Every word of .text is decoded into an Instr (or ecall) by a script, and the decoding is checked: every word must decode uniquely and re-encode exactly.
An instruction-level separation logic
We instantiate iris-lean’s language interface with the process: an expression is AExpr.run r, a register file about to execute, and a step is one instruction or one system call. The state interpretation is an authoritative ghost map over the bytes of memory, with each byte’s protection, a ghost copy of the kernel state (OSIS), and a ghost set of clean bytes. The basic resources are as follows.
ptsN a dq p n w: the bytes at hold , with fraction or discarded fractiondq, and the page protection includesp.bytesAt,slotsandcstrQare byte strings, stack words with arbitrary contents, and NUL-terminated strings.cleanAt a: byte is read-only and clean, so it can be fetched. It is persistent, and only the boot rule and the rule for a successfulriscv_flush_icacheproduce it.instrAt pc w: a persistent, executable, clean, read-only word at . The same rules therefore fetch from.textand from JIT code.
There is one rule per class of instructions. For example, a load requires instrAt r.pc i.encode and a points-to for the address i.access r computes, and continues under a later with the next state:
Syscall rules follow the contract, and each covers the failure case as well as success. For example, wp_sys_mmap hands out fresh zero-filled pages below on success. The adequacy theorem, together with a proof that the start-up code _start and the prologue of __libc_start_main reach main with the expected resources, reduces BinarySafe to a weakest precondition at main.
Function specifications. A function specification is a weakest precondition at the function’s entry address, in continuation-passing style. Here is strlen:
spec_theorem strlen_spec (x f : Nat → BitVec 64) (dq :
DFrac) (p : Perm)
(hpr : p.r = true) (s : List Byte) (hx0 : x 0 = 0) (Φ
: Byte → IP) :
⊢ textCode −∗ cstrQ (x 10) dq p s −∗
(cstrQ (x 10) dq p s −∗ ∀ x', ⌜Clobbers x x' [10, 14,
15] ∧
x' 10 = BitVec.ofNat 64 s.length⌝ −∗
WP (AExpr.run ⟨x 1 &&& ~~~1#64, x', f⟩) {{ Φ }}) −∗
WP (AExpr.run ⟨&strlen#64, x, f⟩) {{ Φ }}
textCode is persistent ownership of all of .text. The continuation is the weakest precondition at the return address in ra (x 1), with the new register file x’, which may differ from x only in the listed registers. A spec thus says precisely which registers a function may clobber. This is the ABI as the compiler actually used it, which can be narrower than the standard one. &strlen#64 is a symbolic address: a notation, generated from the ELF symbol table, that expands to the address of strlen in this build. Proofs refer to code addresses only in this form, such as &fmod+0xdc or &"(null)"#64. After a relink most proofs still check, unless the code inside a function moved.
Executing code. Tactics run straight-line code: sl_step executes one instruction, finding the right points-to in the context by the address the instruction accesses, and sl_steps runs up to the next branch, jump or ecall. Stack frames are read off the code rather than typed into the proofs: frameSaves &fn scans fn’s prologue for its register spills, so a proof does not hard-code the frame layout that the compiler chose. Loops are proved by induction or by Löb induction.
Modular specifications. With hundreds of functions and specifications, the proofs must be checked in parallel, and a change to one function’s proof must not trigger a rebuild of its callers’ proofs. We built a small Lean extension for this (Holds.lean). An interface module states a specification with spec_theorem, as above but without a proof. This defines its statement foo_spec.Stmt and a theorem foo_spec that takes [Holds foo_spec.Stmt] as an instance argument. A proof module imports only the interfaces of its callees, assumes their statements as section variables, and proves its own with spec_holds foo_spec := by ..., which registers an instance of Holds that is parametric in the callees’ Holds assumptions. The top-level module imports all proof modules and closes the specifications callees first with spec_link, after which instance resolution assembles a closed proof term. No axioms are involved: a missing proof leaves an instance that cannot be resolved, and the main theorem does not typecheck. The RISC-V proof has 376 spec_holds declarations and the x86 proof has 222. Besides build parallelism, this split was what made it possible for several AI agents to work on the proof at once § 10.
The runtime: heap, values and garbage collection
Allocator. The malloc specification exposes the size-class design: the invariant allocInv owns the current arena and the 95 free lists, and malloc(n) returns either 0 or an mblock, a zero-filled, 16-byte-aligned block behind a header, owning its padding up to the class capacity. free takes an mblock back. Clients that free memory, such as the JIT’s scratch buffers and realloc, keep the mblock rather than forgetting it.
Heap and values. The heap invariant heapInv owns an authoritative ghost map from addresses to object kinds (string, array, object, function, native). Every live object has a persistent fragment:
def objAt (p : Addr) (k : Kind) : IP :=
⌜p.toNat % 16 = 0 ∧ p.toNat < 2 ^ 47⌝ ∗
tylS p k ∗ objRo p k
def valOk (v : BitVec 64) : IP :=
⌜IsNum v ∨ IsSpecial v ∨ ∃ k, v >>> 48 = 0xFFFC#64⌝
∗ objAt (v &&& ptrMask) k
objRo gives fractional, read-only access to an object’s immutable part: a string’s bytes, or a function’s bytecode, constants and metadata. The mutable parts (an array’s length, capacity and element block, an object’s shape and slots, a function’s feedback bytes, counters and fn->jit pointer) live in the heap invariant and are borrowed from it. For a function, the read-only part includes the facts that its bytecode is well formed (CodeWF, below), that the jump-target table is consistent with it, and that every property-access opcode names an existing inline cache. valOk is the value invariant: the VM stack, globals, array elements, object slots and return values all hold valid values. Its pointer case bounds the address below , which is where the proof uncovered the address-space bug § 8.
Inline caches are cells icCell a that hold either nothing or a shape and slot index for property n, or a transition to a shape that adds n. Shapes are immortal and persistent (shapeAt sh ns), and the cell’s invariant icOk says that a cached slot index is below the number of properties of the cached shape, so an object with that shape has the slot. JIT code reads the cache at run time, so this invariant is what makes an inline load from a cached slot safe, whatever the cache holds at that moment. When the runtime’s property helper updates a cache, a ghost map of loans records that the cell is lent out of its function’s body.
GC epochs. objAt is persistent, but objects are freed by the collector. We handle this with epochs. The heap ghost map is not a global constant: objAt, valOk and every invariant mentioning them are parameterized by an instance HG : HeapGS, the current epoch’s ghost name. A garbage collection allocates a fresh ghost map that contains only the marked objects. Persistent facts about the old epoch become useless, except for those that are transferred. The transfer is
That is, every object that was live in HG and is reachable from the roots R, from the constants of a live function, or is immortal is still live in HG’. The collector’s specification gc_spec takes the callee, the VM stack and the globals as roots, and returns a new epoch HG’ with epT HG HG’ R. Every continuation that may be resumed after a collection, such as a vm_call caller’s or the JIT code’s jKont, quantifies over the epoch it resumes in, and carries its own roots (vstk B rs) across the call. The interpreter switches epochs at exactly one point, the safepoint at the beginning of vm_call. The collector’s proof is split into marking (with an invariant on the mark stack and the marked set), the root loops, draining, sweeping, which frees the unmarked strings, arrays and objects, and the construction of the new epoch.
The bytecode compiler
The safety of the interpreter and the JIT depends on the bytecode being well formed: the interpreter does not check stack depths or operand ranges at run time. The proof therefore splits into a predicate on bytecode and two theorems: the compiler establishes it, and the interpreter and JIT are safe for any code that satisfies it. CodeWF requires
every instruction start (a byte with a recorded depth ) to hold a valid opcode whose operands lie within the code and have no recorded depth;
operands to be in range: constant indices below nconsts, local indices below nlocals, global indices below 4096;
the recorded depth depth[pc] to be consistent along every edge: a jump’s target and an instruction’s fall-through successor have the depth that the instruction leaves, so control cannot fall off the end of the code;
no instruction to underflow the stack, and both the depth before and after an instruction to be at most max_stack ;
execution to start at with an empty stack.
A second predicate, WalkWF, says that decoding the code linearly from 0, as the JIT does, meets only instruction starts, including in unreachable code. The compiler writes depth[pc] and the jump-target flags as it emits, rather than running a separate analysis, and the proof tracks a model of the
emitted code through the recursive-descent parser. The compiler’s specification cp_spec says that compile_program, given any byte string as source code, either exits with a syntax error or returns a valid function object, so CodeWF holds for every function it creates. With 38,457 lines, the compiler proof is the largest single component other than the JIT. One reason is that the lexer, the parser and the emitter are all intertwined in one pass over the source.
The interpreter
The interpreter’s specification VC (Figure 4) says that vm_call(callee, args, argc), called with a valid callee and valid arguments on the VM stack, returns a valid value or exits through a JavaScript error, within a native stack budget that depends on the current call depth d. The interpreter calls the JIT through three entry points: jit_compile, jit_has_entry and jit_enter. Their specifications form the proposition JH, and the interpreter is proved assuming it:

Figure 4. The specification of vm_call (simplified). (x 10) is the callee, the arguments vs on the VM stack, and sp (x 2) must have room for vcW nj d words. vmWorld is the runtime world (allocator, heap, kernel state, globals), and vcKR is the continuation, which receives the result in a new epoch. Exiting through a JavaScript error satisfies 1.
The proof is by Löb induction, since vm_call is recursive: the CALL opcode handler calls vm_call, and the induction hypothesis is available under a later, which the call instruction strips. It covers every opcode handler, the dispatch loop, argument setup, tier-up, OSR entry, resumption after a deopt, and the calls to natives. JIT code can call back into vm_call, so JH’s specification of jit_enter in turn takes ▷ VC as a hypothesis (§ 6). Because JH assumes VC only in this form, the JIT proof jh_holds : textCode ⊢ JH does not depend on the interpreter’s proof, and vc_holds : textCode ⊢ VC combines the two.
Native stack. Stack overflow is a crash, so every specification accounts for native stack usage: slots (x 2 − 8 * w) w gives a function w words of stack. The interpreter’s budget vcW nj d depends on the JS call depth d (limited to 20,000) and on nj, the number of arrays that to_string is currently joining (at most 1000, to detect cycles). The C code checks these limits before recursing, and the binary’s static 64 MiB stack is large enough for the worst case. The libc’s start-up code switches to this stack, so the kernel’s stack limit does not matter.
Putting it together
The top-level module Sep/Safe.lean links all the specifications and combines the start-up proof, main’s option parsing (including every debugging flag), file reading, cp_spec and vc_holds. The result is memory_safe : BinarySafe. Finally, ElfCheck.lean proves by decide +kernel that the ELF loader, applied to the raw file, yields exactly the entry point and segments of the generated image. This step takes about 80 seconds, comparing the data word by word. It gives memory_safe_elf.
Verifying the JIT
The JIT is the reason for the project, and its proof is the largest part: 51,095 lines on RISC-V and 101,323 on x86. This section explains how it is structured. The central difficulty is that the JIT’s output is not a fixed piece of code. It depends on the function’s bytecode, which the attacker controls, on the type feedback, which the attacker also controls, and on the JIT’s own analyses. We must show that every piece of code that jit_compile can emit is safe, and that the binary’s jit_compile emits only such code.
Two layers
We split the problem with a Lean model of the compiler.
Jit.compile : JIn → JSis a functional transcription ofjit_compile, function by function, in a state monad over a record that mirrors C’s structJ: the instruction buffer, the bytecode-to-codepc_map, the jump fix-up list, the abstract types of locals and stack slots, the pending (virtual) stack, and a failure flag. The inputJInholds the bytecode, constants, jump targets, the feedback bytes and the loop facts. C’s ints become Ints, loops become structural recursions, and instruction words are built by the same bit formulas as the C encoders.
Code safety: for every well-formed function and every input, if compile does not fail then the code it produces, placed at any address, is safe to enter at offset 0 and at every jump target that the
pc_maplists.
Refinement: the binary’s
jit_compile, run on a function object, writes into fresh executable memory exactly the words of(compile i).bufand thepc_mapofcompile i, whereiis the function’s current bytecode and feedback, together with the loop facts that a first pass computes (jit_compile_spec).
The model is not trusted: the refinement proof connects it to the binary. Still, a model that disagrees with the C code makes the refinement proof fail late and in a confusing way.
We therefore test it differentially: tests/jitmodel/run.sh dumps every compilation of the test suite and the benchmarks from an instrumented build, replays each one through compile compiled by Lean, and checks that the code words, the pc maps and the failure flags are identical. There is one such test for each architecture.
The interface between the JIT and the rest of the proof is the class JitModel, which the heap invariant uses to describe fn→jit:
def jitCode (p : Addr) (fi : FnInfo) (j : Addr) : IP :=
∃ i : JIn, (mem pMA : Addr), ∀ j'.code
ptsN j .discard rwPerm 8 mem * ptsN (j + 16) .discard
rwPerm 8 pmA *
J.code mem i * □ (∀ pc, ⌜pc < fi.fc.len⌝ →
ptsN (pmA + 4 * pc) .discard rwPerm 4 (J.pcMap i pc))
A function’s JIT code is a persistent fact: the code J.code mem i (for RISC-V, codeAt mem (compile i).buf, that is, instrAt for each word) and its pc map are read-only forever. JIT code is never freed: when a function deoptimizes, fn→jit is cleared, but other activations may still be running the old code. The heap ghost state, the interpreter and the GC work with any JitModel, which is how they are shared between the two architectures.
Installing code
jit_compile compiles into a malloced buffer, then maps fresh pages with mmap (read-write), copies the code, and calls mprotect to make them read-execute. On RISC-V it then calls riscv_flush_icache and, if any step fails, unmaps the pages and returns NULL. In the logic, mmap returns bytesAt with write permission, mprotect converts it to a discarded (read-only) fraction with execute permission, and only the flush rule produces the cleanAt tokens that instrAt needs. This is W⊕X: code pages are never writable and executable at the same time, are never made writable again, and are never patched. That is why read-only ownership of code can be persistent and duplicable: the code can be shared by any number of activations, nothing can write to it, and the proof needs no reasoning about self-modifying code.
The safety invariant
Code safety is stated for a fixed environment : JEnv: the model input, the code address, the frame, the VM stack area, the registers at entry and the continuation. The persistent part is jCtx ε Φ: the model did not fail, the code is at ε.B, the function object is live, and the various layout facts hold. The ownership part, jRes ε Φ ⊢ st, owns the interpreter frame holding the locals ls and the operand stack st, the unused slots of the frame, the runtime world, the saved registers and the native stack, and the continuation jKont, which is jit_enter’s postcondition. All values in ls and st satisfy valOk. Register-allocated locals. On RISC-V, the first five locals live in callee-saved registers. Their frame slots are stale. jRes therefore owns a frame holding lm, which agrees with ls except at the register locals, and the pure fact RegsOk x ls says that the registers hold the current values. Every call out of JIT code preserves them because they are callee-saved, which the callee’s spec states through Clobbers. Before a call that can trigger a GC, the code spills the register locals to the frame, so they are roots.
The virtual stack. The RISC-V JIT delays pushes: a constant or a local that is pushed and consumed by the next instruction is never stored. The compiler state records for each slot above the pending base pb whether it is in a register, a local, or a constant. The invariant jResP says that the slots from pb upward are where the compiler state says they are, and that memory holds only the stack below pb.
Type facts. For guard elimination, the compiler tracks an abstract type for each local and stack slot, and whether a slot is a copy of a local. The facts are an Iris proposition:
Note what tyV leaves out. Integer and double facts say nothing, because they are irrelevant to safety: code that wrongly treats a value as an integer computes with garbage bits, but it re-boxes the result into a valid integer. An array fact, on the other hand, means that the JIT reads the array’s length and data pointer without a check, so it must be backed by objAt, and boolean facts matter because the code computes !b by flipping its low bit. The safety invariant is weaker than a full typing invariant, which made the proof smaller. The facts must survive garbage collection, since array facts mention objAt in the current epoch. tyOk_epoch transports them along epT, provided that every value in the frame is a root.
The main loop. The compiler walks the bytecode linearly: the trajectory traj i m is the bytecode pc and compiler state after steps. The specification SS m says that the code emitted at step is safe, starting from any register file and frame consistent with the compiler state before step :
SS_all : JCtx , SS m is proved by Löb induction together with a downward induction on , from the end of the trajectory. A step’s code continues at the next step, which the downward induction provides, or jumps to an arbitrary step, which the Löb hypothesis provides under the later of the jump instruction. The Löb induction ranges over all heap epochs, because the code of a call can resume in a new epoch.
The proof of one step is a case split on the opcode and the code-generation strategy, which is chosen from the feedback byte. Each case is a template lemma: the instructions emitted for, say, an integer addition with an overflow check, starting from a compiler state s, run from a frame satisfying tyOk_s and jResP to the end of the template’s code with a frame satisfying the invariants for the state after the step, or they branch to the instruction’s deopt stub. The template lemmas are stated over the output of the model’s emitters, such as exec (genInsn pc op d) i s, so the arithmetic on offsets, register numbers and immediates is evaluated symbolically, and the lemmas hold for all of them at once. The per-opcode proofs are in about 100 modules, which build in parallel.
Jumps and OSR. At a jump target, the compiler forgets all type facts and materializes the virtual stack, so the invariant at a target is the trivial one (tyOk_pre_tgt). Any jump can thus continue there. OSR entries are exactly these points: jit_enter (jc, f, pc) with a pc whose pc_map entry is set runs the prologue, which saves the callee-saved registers and loads the register locals, and then jumps to the instruction’s code. Its precondition frameAt is the interpreter’s frame invariant, which implies jRes with no type facts.
Loop facts. Loop facts complicate this picture. A loop header with facts starts with checks of the assumed local types, and the code after the checks, the head, knows them. A backward jump whose state implies the facts goes straight to the head and skips the checks. All other entries, including OSR, go through the checks. The facts l f are an input of the model, and the proof holds for every lf: the C code computes them in a first pass, but safety does not depend on how. Hence the loop-fact analysis is not verified and does not need to be. If it is wrong, the code deoptimizes.
Exits. Each instruction’s guards branch to a shared deopt stub after the instruction, which materializes the virtual stack as it was at the start of the instruction, loads the bytecode pc into t0 and the stack depth into t1, and jumps to the common exit. The exit spills the register locals, stores pc and depth into the frame, restores the callee-saved registers, and returns 1 (wp_stub, wp_exit). The interpreter resumes there, re-executing the instruction that failed. For this to be safe, the frame must satisfy the interpreter’s invariant frameAt at that pc. This holds because the JIT’s frame always contains valid values and has the depth that CodeWF assigns to the pc. Since the instruction has not had any visible effect when a guard fails, the frame is the one before the instruction. Note that this proof says nothing about whether the deopt is correct, that is, whether the interpreter computes the same result that the JIT would have; only that the interpreter can safely continue.
Calls. JavaScript calls from JIT code go to the runtime’s rt_call, which calls vm_call; JIT code is thus re-entrant. The specification of jit_enter assumes VC, and the JIT proof uses it for the call helper. Calls to other helpers (rt_binop, rt_get_prop, and so on) use their specifications directly. Before each call, the code writes the register locals and the virtual stack back to the frame, which is also what makes them roots for the GC. After the call, the template lemma moves the type facts and the continuation to the new epoch.
Refinement: jit_compile computes compile
The refinement proof is a conventional, if large, separation-logic proof of a C program with malloc, realloc, free and loops: each C function in jit.c has a specification saying that, on a buffer holding the model state , it leaves the buffer holding the state after the corresponding model function. Because the model is a literal transcription, each function’s proof follows its code. The arithmetic of the model is on unbounded integers, so the proof also shows that the C arithmetic does not overflow, using the bounds of CodeWF. jit_compile runs up to three passes (a first pass to compute the loop facts, the real one, and a fallback without facts if that fails), and may return NULL, since mmap, mprotect or the flush can fail. Running out of heap memory is a clean exit. Finally, jh_holds packages jit_compile_spec, the specification of jit_has_entry and that of jit_enter (which runs the prologue and then uses SS_all) into JH.
What made this tractable
Three choices kept the JIT proof manageable. First, the two layers separate two very different kinds of reasoning, about the semantics of generated code and about a C program manipulating buffers, and each can be developed and changed independently, since they meet only at compile. Second, the JIT was designed for the proof: one compiler state, deopt stubs per instruction rather than per guard, and type facts reset at every jump target. Third, the invariant is about safety only. The proof never has to say which value the JIT code computes, only that it is valid, and this is what makes it possible to prove the code safe for any feedback.
The x86-64 Port
To test whether the approach depends on the simplicity of RISC-V, we ported the engine and the proof to x86-64. The x86 backend (src/x86_64/jit.c, 1,063 lines) is a port of the RISC-V JIT that keeps its design: the same frame layout, strategies, abstract types, guard elimination and deopt stubs, but no register allocation, virtual stack or loop facts. The C code is otherwise shared, and the binary is built with gcc’s default -march=x86-64. The x86 proof states the same theorem, memory_safe_final : BinarySafe, over the Sail x86-64 model, for every command line including the debugging options. One link is weaker than on RISC-V: there is no x86 counterpart of memory_safe_elf. The theorem is about Image.entry and Image.segments, which the script proofs/tools/elf2lean_x86.py extracts from the executable, so on x86-64 that script is part of the trusted base. It took nine days from the first commit on the x86 model to the unconditional theorem, plus two days for the debugging options.
The model
We generate Lean from the sail-x86 model [40], which had not been compiled to Lean before. This required patches to the model and a post-processing script, because we hit ten bugs in Sail’s Lean backend (for example, return inside try/catch handlers, unescaped Lean keywords used as identifiers, and record updates that do not parse) and two problems with Lean 4.32: its new do elaborator fails on some join points followed by loops, and some recursive Sail functions have no termination measure. The model also needs assumptions that the RISC-V one does not:
CPU profile. The processor is pinned to x86-64-v1 (SSE2, no later extensions), by turning the CPUID feature flags into constants. This is what gcc and our JIT emit, and the engine never executes cpuid.
Floating point. The model’s 162 floating-point ex- ternals are opaque constants. This is sound as long as MXCSR keeps its default value (round to nearest, exceptions masked), and the binary contains no instruction that changes it.
Loops. Sail while loops are compiled to Lean’s Loop type, which is unspecified in the free monad. We give a fueled instance that runs at most iterations and then fails an assertion. A
rep movsbwith a 64-bit count terminates within this bound.
The process model is the RISC-V one, minus riscv_flush_icache. On x86 Linux, a single thread sees its own stores in instruction fetches, so there is no dirty-byte tracking. The address space follows Linux’s default for 4-level paging: mmap results and the initial stack lie below (§ 8). The mprotect and mmap contracts both require the range to be mapped, whereas RISC-V, like Linux, also allows mmap of unmapped pages; this is a stronger obligation on the program. A processor exception is recorded by the model in a pending-fault flag rather than delivered. Writing this flag, changing the privilege level or mode, or failing an assertion has no step. A syscall instruction is executed atomically by the kernel.
Bridging variable-length instructions
On RISC-V we decode .text into a list of instructions. x86 instructions have variable length, so the image is instead a list of pages of raw bytes. The proofs cut a function’s bytes out of .text with decide +kernel, and the model decodes them. A bridge lemma covers one encoding, with the ModRM byte, the REX prefix and the operands symbolic, and gives the new values of RIP, the general-purpose registers and the flags, and the exact list of memory events. The flags are stated as bit-vector operations, for example BitVec.saddOverflow for OF. There are 474 bridge lemmas in 146 files. Most of them are generated by scripts (ALU forms by operation, operand size and prefix; loads and stores by addressing mode; SSE moves, arithmetic, comparisons and conversions; shifts; condition codes), and the rest are written by hand. A coverage script disassembles the binary and reports every instruction that no lemma matches. Some instructions needed special care:
idivtraps on a zero divisor and onINT_MIN / -1; its lemma requires the divisor to be nonzero and the quotient to fit, and the JIT checks the divisor and divides in 64 bits so that the second case cannot occur.rep movsandrep stosare loops in the model; their lemmas are proved by induction over the fueled loop with an invariant per iteration.gcc inlines fmod using the x87
fpreminstruction, so there are lemmas for a few x87 instructions, with hypotheses on the x87 tag word that rule out stack faults.ucomisdsets ZF, PF and CF for unordered operands, so the JIT chooses comparisons for which NaN gives false. x86 arithmetic propagates NaN payloads, so a result can collide with a NaN-box tag, and the JIT checks every floating-point result (§ 3). The default NaN0xFFF8...is itself a valid double and is left alone.
Sharing the proof
The x86 program logic is the same Iris instantiation, with the codeAt a bs resource for byte ranges instead of instruction words. The architecture-neutral modules (the ghost state, points-to, byte strings, stack slots) are shared by both developments. The models of the runtime data structures (the allocator’s size classes and mblock, the heap and value invariants, the shapes and inline caches) are also shared, and they refer to global addresses only through a class Layout and to JIT code only through JitModel, which each target instantiates.
The function proofs themselves are not shared, since they are about different machine code. The structure is the same as on RISC-V, however, and so are the specifications, up to the calling convention, so the RISC-V proofs served as a blueprint. The x86 JIT has its own Lean model (x86Jit), its own differential test, and the same two-layer proof. The x86 JIT proof is larger than the RISC-V one (101k lines vs. 51k), in part because an x86 instruction does more than a RISC-V instruction: a single add with a memory operand reads memory, computes and sets six flags, and the proofs must track the flags that later branches depend on.
What the Proof Found
SafeJIT was written to be verified, and it was tested and hardened before the proof started: a differential test suite against Node.js, a robustness suite of about 200 malformed and adversarial programs, and a round of review and fuzzing, which led to fixes for deep nesting, cyclic arrays, out-of-bounds reads in the lexer, length overflows, and unchecked realloc and mprotect results. Nevertheless, two bugs that testing had not found surfaced during verification. Neither was found by the proof alone. Both were found when we asked an agent based on a different model to assess how strong the safety claim was and where its assumptions were unrealistic. That review pointed out two places where the trusted model was too optimistic, the instruction cache and the size of the address space. Once we made the model faithful, the proofs of the existing code failed, and the failures pointed at the code that had to change.
Unchecked instruction-cache flush. The Sail RISC-V model executes fence.i as a no-op, and the first version of the process model did not model instruction caches at all. With that model the JIT was probably safe, but the model was wrong: a real RISC-V core can fetch stale instructions after the JIT writes new code. We added dirty-byte tracking to the process model (§ 4), and the proof of jit_compile failed. (The review had already predicted this failure.) The C code called gcc’s __builtin___clear_cache, which on Linux/RISC-V calls the riscv_flush_icache system call, but discards its result. If the system call fails, the engine runs code that the hart may not see. The fix is to call __riscv_flush_icache directly and unmap the code and fail the compilation if it returns an error. The system call rarely fails in practice, but this is exactly the kind of assumption that verification is supposed to eliminate: the contract says that it may fail, so a proof must handle it.
Addresses above 2⁴⁷47. SafeJIT’s NaN-boxing stores pointers in the low 48 bits of a value. The first version of the trusted model assumed that the kernel places all memory below 2³⁸, which is the user address limit on Sv39. That is not true on Sv48, where it is 2⁴⁷, nor on Sv57: there, before Linux 6.6, the initial stack could be placed just below 2⁵⁶, and mmap returns addresses above 2⁴⁷ once the lower part of the address space is exhausted. A pointer above 2⁴⁸ would be truncated when boxed, and the engine would access the wrong memory. When we changed the model to let the kernel use any address below 2⁵⁶, the proofs of the start-up code and of mmap’s callers failed. Now __libc_start exits with status 127 if the initial stack or any argv string lies at or above , and the mmap wrapper unmaps any mapping that reaches above and fails with ENOMEM, so that malloc and jit_compile fail cleanly. The checks are in the shared libc, so the x86-64 build has them too. The x86-64 model, however, follows Linux’s default 47-bit address space with 4-level paging: its mmap contract and initial stack stay below , so its proof steps through the checks but never has to handle a successful high-address allocation or a high initial stack.
A lesson about the trusted base. Both bugs survived a mechanized proof for a while because the trusted model encoded the same optimistic assumption that the programmer (here, an agent) had made. The trusted base deserves as much review as the code. For each feature of the real system that the model abstracts away (caches, address-space layout, failing system calls), one should ask whether the abstraction is conservative. Asking an agent built on a different model was a cheap way to get such a review, and it found both problems in minutes. We now state the syscall contract so that every call may fail, every mmap may return any address below , and only a successful flush makes new code fetchable.
Tools. Generating the models exposed bugs in the tools as well. Sail’s Lean backend printed flen = flen_bytes * 8 without parentheses in the RISC-V model, making every floating-point register eight bits wide. The x86 model hit ten more bugs in the Lean backend and two problems in Lean (§ 7). Such bugs are a reminder that the generated model is part of the trusted base: a model bug that makes an instruction behave more nicely than the hardware could hide a real bug in the engine.
Engine changes for verifiability. Some changes were not bug fixes but made the engine easier to verify. The compiler records stack depths and jump targets as it emits code, replacing a separate bytecode verifier that ran at load time; the proof that the compiler’s output is well formed is simpler than a proof of the verifier would have been, and it removes a pass. Every code generator in the JIT is marked noipa, so that gcc compiles it separately, and a change to one generator does not change the machine code, and hence the proofs, of the others. The engine is compiled for RV64G without compressed instructions, so that instructions are aligned 32-bit words. The libc is freestanding, with raw system calls and a static 64 MiB stack, so that the specifications need not depend on glibc or on resource limits.
Evaluation
We evaluate three things: whether the JIT is worth having (performance), how the engine was tested beyond the proof, and what the proof costs (size and checking time).
Performance
SafeJIT is a baseline JIT, and its benchmarks are small kernels that exercise the four things it optimizes: calls (fib, a naive recursive Fibonacci of 27), integer loops (loop, five million iterations of an integer update), floating-point loops (mandel, a 160 × 160 Mandelbrot set with at most 200 iterations per point) and array accesses (sieve, ten runs of the sieve of Eratosthenes up to 200,000). Table 4 shows the running times. The RISC-V build runs under user-mode qemu-riscv64 on an x86-64 host, so its absolute times mean little, but the speedup of the JIT over the interpreter is meaningful: both run under the same emulator. The x86-64 build runs natively on an AMD EPYC 7V12. We report the best of ten runs, measured end to end; SafeJIT’s startup is about half a millisecond.
| RISC-V (qemu) | x86-64 | Node.js | ||||||
| interp | JIT | × | interp | JIT | × | jitless | full | |
| fib | 0.29 | 0.13 | 2.2 | 0.037 | 0.014 | 2.6 | 0.141 | 0.117 |
| loop | 7.75 | 2.27 | 3.4 | 0.438 | 0.148 | 3.0 | 0.301 | 0.141 |
| mandel | 5.10 | 0.22 | 23.1 | 0.362 | 0.039 | 9.3 | 0.250 | 0.119 |
| sieve | 3.77 | 0.15 | 25.3 | 0.459 | 0.057 | 8.1 | 0.373 | 0.149 |
Table 4. Running times in seconds (best of 10). RISC-V under qemu-user, x86-64 native. Node.js 18 times include about 0.09 s of startup.
On RISC-V, the JIT is 2–25× faster than the interpreter. The gains are largest where speculation removes the most work: in mandel and sieve, loop facts let the JIT drop the type checks on locals, and doubles and array elements are handled inline instead of through runtime helpers. fib gains least, because every call goes through the runtime’s vm_call, which sets up an interpreter frame. The x86-64 JIT has no register allocation, virtual stack or loop facts (§ 7), and every local lives in memory, so its speedups are smaller, 2.6–9.3×. (Speedups under an emulator need not match those on RISC-V hardware, which we did not measure.)
To put the numbers in context, Table 4 also shows Node.js 18 on the same programs (with a small prelude that defines print). End to end, SafeJIT’s x86-64 JIT is faster than Node on fib, mandel and sieve and about as fast on loop, and V8’s interpreter (--jitless) is slower than SafeJIT’s JIT on all four. But Node’s times include about 0.09 s of startup, which dominates runs this short, while SafeJIT starts in under a millisecond. Subtracting the startup gives only a rough estimate of V8’s optimizing tiers: about 2.9× faster than SafeJIT’s x86-64 JIT on loop, 1.3× on mandel, on par on sieve, and about 2× slower on fib, where the startup is most of Node’s time. A precise comparison would time the kernels in-process. We do not claim more than that SafeJIT’s JIT is a real JIT: it gives the kind of speedup that justifies a baseline tier, on the kinds of code that baseline tiers are for.
Testing
The proof says nothing about functional correctness (§ 4), so the engine is tested as well:
Differential tests against Node.js. Eleven test programs (arithmetic, arrays, bit operations, calls, comparisons, cyclic structures, doubles, errors, loops, objects, strings) are run in four modes: interpreter only, the default threshold of 200, compile on the first call (
--jit-threshold=1), and compile on the second call while allowing up to 1,000 deopts (--jit-threshold=2 --max-deopts=1000), which compiles with type feedback from a single call and so deoptimizes frequently. Each output is compared with Node’s. The benchmark script also checks that the interpreter and the JIT print the same results.Robustness. A generator produces 204 hostile inputs: nesting 200,000 levels deep in every syntactic position, operand stacks near and beyond their limits, lexer edge cases, huge strings and arrays, and 150 random token sequences. Each runs in all four modes, and the test fails if any run is killed by a signal or times out. This suite, and the fixes it drove, predate the proof.
libc. The freestanding
printf,strtodand math functions are tested against glibc.The JIT model. An instrumented build of the RISC-V engine logs every compilation (bytecode, feedback, emitted code). A Lean program runs the model
Jit.compileon each logged input and checks that it produces the same code byte for byte. This test was the main tool for writing the model (§ 6). The x86-64 model is tested the same way.
The proof makes part of the robustness suite redundant: no input can crash the engine, since a crash is a stuck state (a timeout is still possible). But the tests are cheap, and they were invaluable during development, when a failing differential test pointed at a bug in minutes that would have taken hours to find from a stuck proof.
Proof size and cost
Table 5 shows the size of the development. The RISC-V proof is about 221k lines of Lean, of which 57k are generated: the dump of the ELF image and its symbols, and the instruction datatype. The generated Sail models are not counted. The x86-64 proof is about 264k lines, of which 12k are generated: the image, the symbols and the bridge lemmas produced by scripts. In total, the two proofs are about 485k lines of Lean for 6.5k lines of C, a ratio of about 75:1 (64:1 excluding generated code). For the initial version (4.4k lines of C and 194k lines of Lean), the ratio was 45:1; the JIT optimizations added after it (register allocation, the virtual stack, loop facts) are where the proof grew fastest.
| C (engine + libc) | Lean, RISC-V | ||
| engine (src) | 3,868 | Sep | 103,540 |
RISC-V jit.c | 1,376 | compiler | 38,457 |
| libc | 1,545 | interpreter | 7,870 |
x86-64 jit.c | 1,063 | GC | 4,145 |
| Jit | 51,095 | ||
| process model | 7,748 | ||
| ELF image, symbols | 55,783 | ||
| other | 2,655 | ||
| total | 220,821 | ||
| generated | 57,488 | ||
| total C | 6,476 | Lean, x86-64 | |
| Sep | 138,829 | ||
| Jit | 101,323 | ||
| bridges | 16,197 | ||
| other | 7,466 | ||
| total | 263,815 | ||
| generated | 12,022 |
Table 5. Size in lines. Indented rows are included in the row above; generated is included in the total. Sep is the separation-logic layer with the program’s proof; Jit is the JIT model and its proofs. The generated Sail models are not counted.
A few steps dominate the time it takes to check the proofs. Compiling the Sail RISC-V model takes about 45 CPU-minutes.
Each of the floating-point bridge lemmas takes about five minutes, and they build in parallel. Running a function’s straight-line code symbolically (twalk) takes 5–25 seconds per cycle in the control-flow graph. Checking that the ELF file matches the image (ElfCheck, by decide +kernel) takes about 80 seconds. Since Lean builds are incremental at the module level, a change to one function’s code mostly re-checks that function’s proof, which is why every code generator is compiled as a separate function (§ 8).
Development with AI Agents
All of SafeJIT (the engine, the libc, the tests, the Lean models, the proofs and the proof tooling) was written by AI agents: Claude Opus 5.5 running in the GitHub Copilot CLI, guided by one researcher. Of the 1,411 non-merge commits on the main branch before this report, 1,395 carry an agent’s session identifier; the researcher’s own commits are a handful of README edits and housekeeping. This section describes how the work was organized, what it cost, and what we learned. We think this is the most important result of the project: not that a small JIT can be verified, which was never in doubt, but that it took four weeks.
Setup and timeline
The project started from a single prompt, asking for “a simple javascript engine with a risc-v jit compiler” that does “some basic type speculation”. The agent produced the engine in under two hours. A second agent session was asked to replicate the approach of xv6iris on this engine, with the goal of proving it memory safe “in particular that the optimized jit-generated code doesn’t break that safety either”, and allowing it to change how the engine is built. This session ran for four weeks and produced the RISC-V proof. Table 6 shows the milestones.
| Oct 23 | Engine written; verification session starts |
| Oct 28 | Researcher review: proofs are not using separation logic; migration to Iris |
| Nov 6 | First unconditional safety theorem for the RISC-V binary |
| Nov 9 | Allocator with a verified free; initial version complete (404 commits) |
| Nov 10 | Objects and inline caches, GC; x86-64 session starts |
| Nov 13 | I-cache and address-space model fixes (§ 8) |
| Nov 14 | Debugging options verified |
| Nov 15 | RISC-V register allocation |
| Nov 16 | ELF cross-check; x86-64 proofs parallelized |
| Nov 17 | Loop facts |
| Nov 18 | Unconditional theorem for the x86-64 binary |
| Nov 20 | x86-64 debugging options verified |
Table 6. Milestones (2026). Commits per day peaked at 339, 344 and 250 on Nov. 16–18, when parallel workers were active.
The initial RISC-V version (engine, interpreter, baseline JIT with speculation, OSR and deopts, allocator, and the proof) took about ten working days. Later features (objects, the GC, register allocation, the virtual stack and loop facts) were added in the same session, each on its own branch, and merged once the proof covered it again.
For the x86-64 port, the researcher started a second, concurrent session. For its first week, that session worked alone: it ported the engine, patched the Sail x86 model’s Lean output, generated the bridge lemmas and built the shared modules. On Nov. 16 the researcher suggested porting the specification files first and then discharging the proofs in parallel. The agent then acted as a coordinator: it wrote the specifications, assigned groups of functions to worker agents (22 sub-agents over the session, typically about six at a time), each in its own branch, reviewed and merged their branches, and forwarded fixes between workers. Within three days the x86-64 theorem was proved without premises.
What the researcher did
Table 7 summarizes the interaction. Across all sessions, the researcher wrote about 180 prompts totalling about 17,000 characters, roughly the size of this section. Of these, 68 were some variant of “Excellent work, please continue!” and another 14 asked the agent to merge a branch. The rest fall into a few categories:
| RISC-V | x86-64 | all | |
| calendar days | 29 | 11 | 29 |
| researcher prompts | 56 | 69 | 182 |
| sub-agents | 2 | 22 | 33 |
| model requests | 33.6k | 41.5k | 79.5k |
| input tokens | 3.6 G | 4.4 G | 8.4 G |
| of which cached | 97% | ||
| output tokens | 33 M | 34 M | 71 M |
| model time | 91 h | 94 h | 196 h |
Table 7. Effort. Model time is the sum of the durations of model requests, including concurrent ones. Tokens include cached input. The all column also includes the sessions for the initial engine, the adversarial review and tooling, so it exceeds the sum of the other two.
Setting goals. The initial prompts, and the choice of each next feature: “Are we already in a good shape to add a GC?”, “let’s tackle inferring type facts across loop back-edges next”, “There’s a brand new x86 model for sail … we should try it.”
Steering the design. The most consequential intervention came on the fifth day: “We don’t seem to be using separation logic at all. It’s a whole lot slower than xv6.” Until then the agent had reasoned about executions directly, with a whole-machine safety notion and no framing, and about 28k lines of proofs had to be migrated to the Iris-based logic. Others asked to prove properties instead of checking them at run time (which led to bytecode metadata by construction, § 8), to make proofs robust against recompilation (which led to symbolic addresses), to keep the x86-64 proofs in separation logic rather than repeating a “historic artifact” of the RISC-V proof, and to align the x86-64 specification pattern with the RISC-V one.
Keeping the agent honest. The researcher asked the agent to remove a sorry that was only a fallback in a tactic, and challenged a status report that described the RISC-V JIT proof as an assumption, which it was not. The researcher also asked a different agent how strong the safety claim was, which led to the two model fixes of § 8.
Operations. Machine reboots, a stuck build, and file-descriptor limits that the parallel builds exceeded.
The researcher did not write proofs, and did not need to read most of them: the Lean kernel checks them, and the only things a human must check are the statement of the theorem, the trusted base, and the axioms the proof depends on (§ 4).
Lessons
The proof checker is the reviewer. A proof assistant is an ideal environment for an agent: every claim is either checked or not, and the agent cannot talk its way past the kernel. Agents do make mistakes in their reports: once, an agent missed a sorry in a lemma it had reported as proved (and found and fixed it in the next step). Such mistakes are caught by looking at the theorem statement and at #print axioms, not by reading hundreds of thousands of lines of proof. Our checklist at each milestone was short: no sorry, no native_decide, the expected axioms only, and an unchanged statement.
Specifications are the unit of parallelism. Because every function’s proof depends only on the specifications of its callees (§ 5), proofs can be done in any order and by different agents. In the first week of the x86-64 work, a single agent built the model, the bridge lemmas and the shared infrastructure, and verified the first few functions. Once the specifications were in place and the work was parallelized, the remaining functions, including the JIT, took three days. The coordinator’s job was then mostly to merge branches, rebuild, and pass fixes from one worker to another (for example, a workaround for a proof that the elaborator accepted but the kernel rejected).
Mechanical size is cheap. The proof is about 75 times the size of the code. For humans this would be prohibitive: seL4’s verification took about 20 person-years of effort, of which about 11 were for the seL4-specific proof and the rest for frameworks and tools [22]. xv6iris, also built with agents, took 102 calendar days including its framework [21]. (Person-years and calendar days are different units; SafeJIT took 29 calendar days.) For agents, the size of a proof matters much less than its difficulty, and much of SafeJIT’s proof is easy but long: symbolic execution of straight-line code, one lemma per instruction form, one template lemma per opcode. Investments that make proofs more mechanical (scripts that generate bridge lemmas, tactics like twalk, symbolic addresses that let proofs survive a relink) paid off more than investments that make them shorter.
Executable models catch mistakes early. The JIT model is a Lean function that can run, and testing it against the C code on every compilation in the test suite (§ 9) found most mistakes in the model in seconds, long before a proof attempt would have.
The trusted base needs adversarial review. The agent that wrote the proofs also wrote the process model, and both bugs of § 8 hid in that model. A model that the proof’s author chose is a weak point whether the author is a human or an agent. Asking a different agent to attack the claim was cheap and effective, and we would make it a routine step.
Resources. Build time was a constant concern. The Lean build grew to over 1,400 jobs, and some single proofs took tens of CPU-minutes to check. The agents spent noticeable effort on build performance (splitting modules, reducing imports, replacing expensive tactic calls), often at the researcher’s prompting. With several agents building at once, the machine (128 cores) ran into its file-descriptor limit.
Discussion
Binary verification does not make compilers obsolete
Kaashoek and Zeldovich argue that verifying the binary “allows MachCSL to factor out the compiler, linker, assembler, and other parts of the build process from the trusted computing base” [21], and that the proofs absorb gcc’s optimizations for free. SafeJIT relies on the same idea: gcc is untrusted, and we never reason about C.
A JIT shows where this argument stops. The machine code a JIT runs does not exist when the proof is done. It is generated later, from programs and type feedback chosen by the attacker. The binary can be verified, but one function in it is a compiler, and its specification must quantify over every program it could be given and every code it could emit. “For every well-formed function and every feedback vector, the emitted code preserves the invariants” is a compiler-verification theorem, and most of the work in SafeJIT’s proof is spent there: template lemmas for each opcode, soundness of the abstract types that remove guards, and the consistency of deopt and OSR exits with the interpreter. Binary-level verification removes gcc from the trusted base; it does not remove the need to verify the compilers that are part of the system. JIT engines are such systems, and they are some of the most attacked software in existence. Verified-compiler research is still needed, now inside binary-level proofs.
The two-layer structure of the JIT proof (§ 6) is how we combine them: a model of the JIT that is a Lean function, proved safe with the usual tools of compiler verification, and a proof that the binary of jit_compile refines that model. The refinement layer is mechanical (about 12k lines for the RISC-V JIT) and does not grow with the sophistication of the analysis, only with the size of the code generator.
Limitations
Safety, not correctness. The theorem says that the engine never gets stuck. It does not say that it computes the right answer, that it terminates, or that it is free of side channels. Speculative-execution attacks are outside the model, as they are for most verified systems; V8’s developers concluded that code-level mitigations cannot fully contain Spectre and turned to process isolation [28]. A wrong answer from the JIT is still a serious bug, but it is not an exploitable one in the sense of § 1: in a production engine, type confusion is dangerous because it leads to memory corruption, and memory corruption is what the theorem rules out.
A small engine. SafeJIT lacks closures, exceptions, eval, most of the standard library, regular expressions, typed arrays and concurrency. Its JIT is a baseline JIT with simple register allocation; it has no optimizing tier. We believe that the missing language features are “more of the same”: each new heap kind extends the “heap invariant” and the interpreter’s opcode proofs, and JIT fast paths for them have the same shape as the existing paths for arrays and objects (tag guard, kind guard, bounds or shape check, then a direct access). Native library functions are proved separately against a fixed interface and do not touch the JIT proof. An optimizing tier is a different matter. It is where most production JIT bugs are, and verifying one is verified-compiler work at scale. The structure of our proof carries over, but the effort will be larger.
Memory reclamation. The collector frees strings, arrays and objects, but not functions or JIT code. Functions are immortal anyway, and since a function is compiled at most times (the --max-deopts limit, 8 by default), the code leaked by deopts is at most times a constant multiple of the program’s size. Reclaiming code becomes necessary once functions can die, and it is a cross-cutting change: code ownership (codeAt) is a persistent fact in the proof, so a running activation would need non-persistent evidence that its code stays mapped. We plan to keep the live code in a per-epoch invariant that the collector opens, and to count the activations of each piece of code.
Single-threaded. There is no background compilation and no concurrent collection. The logic supports concurrency (MachCSL verifies multi-core xv6), but the engine would need the most changes.
Trusted base. The theorem trusts the Sail models, our process model of Linux, Lean’s kernel, and the LRAT checker of bv_decide (§ 4). The process model is ours, and § 8 shows that it can be wrong in ways that matter. On x86-64, the floating-point instructions are opaque, and the proof assumes that the MXCSR register keeps its default value (§ 7).
Future work
In order of value, the next steps are:
Bounds-check elimination. Array accesses always check the index. Eliminating the check when the index is known to be in range, such as a loop counter compared against length, needs range facts on top of the loop type facts, and an invariant that the array does not shrink in the meantime. Bugs in this area are subtle: in CVE-2019-8518, loop-invariant code motion hoisted an array access ahead of the bounds check that guarded it [15].
Wider register allocation. Only five locals live in registers, and pending stack slots are flushed at every merge point. Keeping pending state across merges would remove most of the remaining frame traffic in loops.
Parity for x86-64. The x86-64 JIT has no register allocation, virtual stack or loop facts. Porting them is mostly a matter of porting the RISC-V model and proofs, which is the kind of work that agents do well.
Code reclamation and closures, as described above.
eBPF. An eBPF verifier and JIT in the same framework would be a second demonstrator with immediate practical relevance, and the verifier’s range analysis is the kind of analysis that bounds-check elimination needs.
Related Work
Table 8 compares SafeJIT with the closest prior work.
| Work | What is verified | Level | Theorem | Speculation |
| Myreen [30] | JIT for a small bytecode language | x86 machine code | functional correctness | no |
| Jitawa [31] | Lisp runtime, GC and JIT | x86-64 machine code | functional correctness | no |
| Jitk [43] | classic BPF JIT | Coq, extracted with CompCert | functional correctness | no |
| Jitterbug [32] | Linux eBPF JITs, per instruction | Rosette model of the C | functional correctness | no |
| CertrBPF [45] | eBPF VM for RIOT | Coq, C | correctness, isolation | no |
| Agni [42] | Linux eBPF verifier range analysis | SMT | soundness | – |
| VeRA [7] | Firefox JIT range analysis | C++ pass, SMT | soundness of one analysis | – |
| Icarus [37] | CacheIR stub generators | macro-assembler model | safety of stubs | IC guards |
| sourire [13] | speculative optimizations | IR | semantic preservation | yes |
| CoreJIT [3, 4] | JIT with speculation and deopt | Coq model, CompCert back end | semantic preservation | yes |
| VeriWasm [19] | Wasm AOT output | x86 binary checker | sandbox safety | no |
| vWasm [6] | Wasm compiler | F★ | sandbox safety | no |
| Crocus [41] | Cranelift lowering rules | SMT | rule correctness | no |
| CakeML [23, 36, 39] | ML compiler, runtime and Eval | machine code | functional correctness | no |
| Islaris [35] | machine-code fragments | Sail Arm/RISC-V | functional correctness | – |
| xv6iris [21] | xv6 kernel and user programs | RISC-V binary, Sail | functional correctness | – |
| SafeJIT | whole engine incl. JIT output | RISC-V and x86-64 binaries, Sail | safety for all inputs | yes, plus OSR |
Table 8. Table 8. Verified JITs and related systems. “Speculation” means guards on dynamically observed types with deoptimization to a lower tier.
Speculation and deoptimization. Speculation with deoptimization goes back to Smalltalk and Self [9, 12, 18]. Guo and Palsberg [44] formalized trace-based compilation, including hot-path recording and side exits, with a bisimulation criterion. Flückiger et al. [13] gave a formal account of speculation with explicit assumptions and deoptimization across program versions: sourir is an IR with assume instructions that deoptimize to a less optimized version, and they prove a set of optimizations correct in their presence. D’Elia and Demetrescu [11] give a correctness argument for OSR that reconstructs the state across program versions. Preserving a program’s live values across a transition is stronger than what we prove (that the destination frame is safe to resume), but it is not a theorem about an engine binary. CoreJIT [3] is a JIT verified in Coq that speculates, deoptimizes and performs dynamic optimization over a CompCert-style IR. It proves semantic preservation of the whole dynamic compilation process. Its successor [4] adds a native back end through CompCert and reasons about the transitions between interpreted and generated code down to CompCert’s x86 assembly semantics; it trusts the step from assembly syntax to installed machine bytes and the implementations of runtime primitives. These are correctness proofs, and stronger than ours in that sense. SafeJIT’s theorem is weaker (safety), but its trusted boundary is the ISA model: the interpreter, runtime, collector, libc and the bytes of the generated code are all part of the verified binary. Our JIT’s abstract types, loop facts and deopt metadata are much simpler than the optimizations these works handle.
Verified JITs for real code. Myreen [30] verified a JIT for a small stack-based bytecode language down to x86 machine code in HOL4, including self-modifying code, using his decompilation into logic. Jitk [43] verified a JIT for classic BPF using CompCert, and Jitterbug [32] verified the Linux kernel’s eBPF JITs instruction by instruction, finding many bugs. CertrBPF [45] is a verified eBPF interpreter for an embedded OS, and Agni [42] and VeRA [7] verify range analyses in the Linux eBPF verifier and in Firefox’s JIT, respectively. TurboTV [24] validates individual TurboFan IR transformations in V8 with SMT; a check of one translation is neither a test oracle nor a proof about all emitted programs. These systems target languages without dynamic types, or verify one component, and none of them speculates with deoptimization.
Jitawa [31] is the closest precedent for a dynamic-language runtime verified together with its JIT at the machine-code level: its parser, printer, copying collector and JIT compiler for a Lisp were verified in HOL4 down to x86-64 code, with a functional-correctness theorem whose premises include the initial memory and the execution of the source program. It compiles each function before running it, without feedback, guards, deoptimization or OSR. Icarus [37] is the closest precedent for type-specialized fast paths in a real JavaScript engine. It verifies safety properties of the inline-cache stubs that SpiderMonkey’s CacheIR generators can emit, by symbolic meta-execution over models of the macro-assembler, and integrates the generated code back into Firefox. Its unit of verification is the stub generator and the modeled operations; ours is the engine image, the emitted instruction bytes and the transitions between tiers. An inline-cache miss, which falls back to a generic path, is also simpler than a whole-frame deoptimization.
WebAssembly. For WebAssembly, VeriWasm [19] checks that the x86 output of an ahead-of-time compiler stays in its sandbox, vWasm [6] is a compiler verified in F★ to produce sandboxed code, and Crocus [41] verifies the instruction-lowering rules of Cranelift. Like SafeJIT, VeriWasm and vWasm prove a safety property rather than correctness, which is the property that matters for a sandbox. None of these verifies speculation; production engines do speculate on WebAssembly, for example V8 inlines indirect calls based on feedback and deoptimizes when the assumption fails [26].
Machine-code verification. CompCert [27] and CakeML [23, 39] are verified compilers; CakeML’s proofs go down to machine code and include its runtime and garbage collector. CakeML also compiles at run time: its verified interactive REPL [23] and its verified Eval [36] compile and install new code that exchanges values with existing code, so run-time code generation alone does not distinguish SafeJIT; feedback-directed speculation does. Cai, Shao and Vaynberg [8] gave a Coq framework for local reasoning about code that is stored and generated in writable memory. Our codeAt resource applies the same idea to concrete engine code, with page permissions and the RISC-V cache-flush contract. Islaris [35] introduced separation logic over Sail ISA models, using Isla to compute instruction traces and Iris for reasoning. xv6iris [21] applied the idea to a whole system: it verifies the RISC-V binary of the xv6 kernel and user programs against the Sail model in Lean, with a concurrent separation logic, MachCSL, built on iris-lean [20, 25]. Its proofs were also developed with AI agents, and found 11 bugs in xv6. SafeJIT builds directly on xv6iris: we reuse its Sail model configuration, its fork of the Sail Lean backend, and parts of MachCSL (access kinds, the boot sequence, and board writes). What is new in SafeJIT is what a JIT needs on top of this: code as a resource that is created at run time and installed through mprotect and a cache flush, a JIT whose output is verified for every input, and the proof structure of § 5.4 and § 6 that connects the two. seL4 [22] remains the reference point for the effort that a full functional-correctness proof of a systems component takes.
Testing JITs. Fuzzers such as Fuzzilli [17] and JIT-Picking [5] find many JIT bugs, and differential testing of a JIT against its own interpreter is a standard oracle. We used the same techniques during development (§ 9). They find bugs; a proof shows their absence.
Conclusion
SafeJIT is a JavaScript engine with a speculating JIT compiler whose RISC-V and x86-64 executables are proved, in Lean against the Sail ISA models, never to get stuck on any input. The proof covers everything that runs: the parser and bytecode compiler, the interpreter, the runtime and garbage collector, the freestanding libc, the JIT compiler, and every piece of code that the JIT could emit for any program and any type feedback, including its guards, deoptimization exits and on-stack-replacement entries. Neither the C compiler nor floating-point arithmetic is trusted.
The engine is small, and its JIT is a baseline JIT. But the parts that make JITs dangerous, speculation over attacker-controlled feedback, removal of guards based on abstract types, and transitions between tiers, are all there, and they are verified at the level where an attacker operates. Two lessons stand out. First, binary-level verification does not remove the need for compiler verification when the binary contains a compiler; the two have to be combined, and a model of the JIT that is proved safe and refined by the binary is an effective way to combine them. Second, AI agents change the economics of this kind of work. The proof is 75 times the size of the code and took four weeks, with one researcher whose role was to set goals, steer the design, and check the statement and the trusted base. We think this makes it plausible that production JIT engines, and other security-critical systems that were long considered out of reach, can be verified at the level of their binaries.
Acknowledgments
SafeJIT builds on xv6iris by M. Frans Kaashoek and Nickolai Zeldovich: its Sail model configuration and Lean backend fork, and parts of its MachCSL framework (MIT license). We thank the authors of Sail, the Sail RISC-V and x86 models, Lean, and iris-lean, on which this work depends.
References
References
- [1]Apple. 2024. Harden Your Devices with Lockdown Mode. Apple Personal Safety User Guide. https://support.apple.com/guide/personal-safety/harden-your-devices-with-lockdown-mode-ipsd5abf79d0/web
- [2]Alasdair Armstrong, Thomas Baurereiss, Brian Campbell, Alastair Reid, Kathryn E. Gray, Robert M. Norton, Prashanth Mundkur, Mark Wassell, Jon French, Christopher Pulte, Shaked Flur, Ian Stark, Neel Krishnaswami, and Peter Sewell. 2019. ISA Semantics for ARMv8-A, RISC-V, and CHERI-MIPS. Proc. ACM Program. Lang. 3, POPL (2019). https://doi.org/10.1145/3290384
- [3]Aurèle Barrière, Sandrine Blazy, Olivier Flückiger, David Pichardie, and Jan Vitek. 2021. Formally Verified Speculation and Deoptimization in a JIT Compiler. Proc. ACM Program. Lang. 5, POPL (2021). https://doi.org/10.1145/3434327
- [4]Aurèle Barrière, Sandrine Blazy, and David Pichardie. 2023. Formally Verified Native Code Generation in an Effectful JIT: Turning the CompCert Backend into a Formally Verified JIT Compiler. Proc. ACM Program. Lang. 7, POPL (2023). https://doi.org/10.1145/3571202
- [5]Lukas Bernhard, Tobias Scharnowski, Moritz Schlegel, Tim Blazytko, and Thorsten Holz. 2022. JIT-Picking: Differential Fuzzing of JavaScript Engines. In ACM SIGSAC Conference on Computer and Communications Security (CCS). 351–364. https://doi.org/10.1145/3548606.3560624
- [6]Jay Bosamiya, Wen Shih Lim, and Bryan Parno. 2022. Probably-Safe Multilingual Software Sandboxing using WebAssembly. In USENIX Security Symposium. 1975–1992. https://www.usenix.org/conference/usenixsecurity22/presentation/bosamiya
- [7]Fraser Brown, John Renner, Andrés Nötzli, Sorin Lerner, Hovav Shacham, and Deian Stefan. 2020. Towards a Verified Range Analysis for JavaScript JITs. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI). 135–150. https://doi.org/10.1145/3385412.3385968
- [8]Hongxu Cai, Zhong Shao, and Alexander Vaynberg. 2007. Certified Self-Modifying Code. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI). 66–77. https://doi.org/10.1145/1250743.1250743
- [9]Craig Chambers, David Ungar, and Elgin Lee. 1989. An Efficient Implementation of SELF, a Dynamically-Typed Object-Oriented Language Based on Prototypes. In Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA). 49–70. https://doi.org/10.1145/74877.74884
- [10]Leonardo de Moura and Sebastian Ullrich. 2021. The Lean 4 Theorem Prover and Programming Language. In Automated Deduction – CADE 28 (LNCS, Vol. 12699). 625–635. https://doi.org/10.1007/978-3-030-79876-5_37
- [11]Daniele Cono D’Elia and Camil Demetrescu. 2018. On-Stack Replacement, Distilled. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI). 166–180. https://doi.org/10.1145/3192366.3192396
- [12]L. Peter Deutsch and Allan M. Schiffman. 1984. Efficient Implementation of the Smalltalk-80 System. In ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL). 297–302. https://doi.org/10.1145/800017.800542
- [13]Olivier Flückiger, Gabriel Scherer, Ming-Ho Yee, Aviral Goel, Amal Ahmed, and Jan Vitek. 2018. Correctness of Speculative Optimizations with Dynamic Deoptimization. Proc. ACM Program. Lang. 2, POPL (2018), 49:1–49:28. https://doi.org/10.1145/3158137
- [14]Google Threat Analysis Group and Mandiant. 2024. We’re All in this Together: A Year in Review of Zero-Days Exploited In-the-Wild in 2023. https://storage.googleapis.com/gweb-uniblog-publish-prod/documents/Year_in_Review_of_ZeroDays.pdf
- [15]Samuel Groß. 2019. JavaScriptCore OOB Access in FTL JIT due to LICM Moving Array Access before the Bounds Check. Project Zero issue 42450850 (CVE-2019-8518). https://project-zero.issues.chromium.org/issues/42450850
- [16]Samuel Groß. 2024. The V8 Sandbox. V8 blog. https://v8.dev/blog/sandbox
- [17]Samuel Groß, Simon Koch, Lukas Bernhard, Thorsten Holz, and Martin Johns. 2023. FUZZILLI: Fuzzing for JavaScript JIT Compiler Vulnerabilities. In Network and Distributed System Security Symposium (NDSS). https://doi.org/10.14722/ndss.2023.24290
- [18]Urs Hölzle, Craig Chambers, and David Ungar. 1992. Debugging Optimized Code with Dynamic Deoptimisation. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI). 32–43. https://doi.org/10.1145/14309.143114
- [19]Evan Johnson, David Thien, Youssef Alhessi, Shravan Narayan, Fraser Brown, Sorin Lerner, Tyler McMullen, Stefan Savage, and Deian Stefan. 2021. Doveryai, no Proveryai: SFI Safety for Native-Compiled Wasm. In Network and Distributed System Security Symposium (NDSS). https://doi.org/10.14722/ndss.2021.24078
- [20]Ralf Jung, Robbert Krebbers, Jacques-Henri Jourdan, Aleš Bizjak, Lars Birkedal, and Derek Dreyer. 2018. Iris from the Ground Up: A Modular Foundation for Higher-Order Concurrent Separation Logic. Journal of Functional Programming 28 (2018), e20. https://doi.org/10.1017/S0956796818000151
- [21]M. Frans Kaashoek and Nickolai Zeldovich. 2026. Extending Concurrent Separation Logic to the Hardware Level to Verify the xv6 OS Kernel on RISC-V with AI Agents. https://doi.org/10.48550/arXiv.2609.04043 arXiv:2609.04043v3 [cs.LO] Version 3.
- [22]Gerwin Klein, Kevin Elphinstone, Gernot Heiser, June Andronick, David Cock, Philip Derrin, Dhammika Elkaduwe, Kai Engelhardt, Rafal Kolanski, Michael Norrish, Thomas Sewell, Harvey Tuch, and Simon Winwood. 2009. seL4: Formal Verification of an OS Kernel. In ACM Symposium on Operating Systems Principles (SOSP). 207–220. https://doi.org/10.1145/1629575.1629596
- [23]Ramana Kumar, Magnus O. Myreen, Michael Norrish, and Scott Owens. 2014. CakeML: A Verified Implementation of ML. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). 179–191. https://doi.org/10.1145/2535838.2535841
- [24]Seungwan Kwon, Jaeseong Kwon, Wooseok Kang, Junyoung Lee, and Kihong Heo. 2024. Translation Validation for JIT Compiler in the V8 JavaScript Engine. In IEEE/ACM International Conference on Software Engineering (ICSE). 1–12. https://doi.org/10.1145/3597503.3639189
- [25]Lean community. 2026. iris-lean: Iris in Lean 4. GitHub repository. https://github.com/leanprover-community/iris-lean
- [26]Daniel Lehmann and Matthias Liedtke. 2025. Speculative Optimizations for WebAssembly using Deopts and Inlining. V8 blog. https://v8.dev/blog/wasm-speculative-optimizations
- [27]Xavier Leroy. 2009. Formal Verification of a Realistic Compiler. Commun. ACM 52, 7 (2009), 107–115. https://doi.org/10.1145/1538788.1538814
- [28]Ross McIlroy, Jaroslav Sevcik, Tobias Tebbi, Ben L. Titzer, and Toon Verwaest. 2019. Spectre is Here to Stay: An Analysis of Side-Channels and Speculative Execution. arXiv:1902.05178 [cs.PL]arxiv.org/abs/1902.05178
- [29]Microsoft. 2025. Enhance Your Security on the Web with Microsoft Edge. Microsoft Support. https://support.microsoft.com/en-us/edge/enhance-your-security-on-the-web-with-microsoft-edge
- [30]Magnus O. Myreen. 2010. Verified Just-in-Time Compiler on x86. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). 107–118. https://doi.org/10.1145/1706299.1706313
- [31]Magnus O. Myreen and Jared Davis. 2011. A Verified Runtime for a Verified Theorem Prover. In Interactive Theorem Proving (ITP) (LNCS, Vol. 6898). 265–280. https://doi.org/10.1007/978-3-642-22863-6_20
- [32]Luke Nelson, Jacob Van Geffen, Emina Torlak, and Xi Wang. 2020. Specification and Verification in the Field: Applying Formal Methods to PJF Just-in-Time Compilers in the Linux Kernel. In USENIX Symposium on Operating Systems Design and Implementation (OSDI). 41–61.
- [33]Johnathan Norman. 2021. Super Duper Secure Mode. Microsoft Browser Vulnerability Research blog. https://microsoftedge.github.io/edgevr/posts/Super-Duper-Secure-Mode/
- [34]RISC-V International. [n. d.]. The Sail RISC-V Model. GitHub repository. https://github.com/riscv/sail-riscv
- [35]Michael Sammler, Angus Hammond, Rodolphe Lepigre, Brian Campbell, Jean Pichon-Pharabod, Derek Dreyer, Deepak Garg, and Peter Sewell. 2022. Iris: Verification of Machine Code Against Authoritative ISA Semantics. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI). 825–840. https://doi.org/10.1145/3519939.3523434
- [36]Thomas Sewell, Magnus O. Myreen, Yong Kiam Tan, Ramana Kumar, Alexander Mihajlovic, Oskar Abrahamsson, and Scott Owens. 2023. Cakes That Bake Cakes: Dynamic Computation in CakeML. Proc. ACM Program. Lang. 7, PLDI (2023), 1121–1144. https://doi.org/10.1145/3591266
- [37]Naomi Smith, Abhishek Sharma, John Renner, David Thien, Fraser Brown, Hovav Shacham, Ranjit Jhala, and Deian Stefan. 2024. Icarus: Trustworthy Just-In-Time Compilers with Symbolic Meta-Execution. In ACM Symposium on Operating Systems Principles (SOSP). 473–487. https://doi.org/10.1145/369475.369549
- [38]Maddie Stone. 2022. The More You Know You Don’t Know: A Year in Review of 0-days Used In-the-Wild in 2021. Google Project Zero blog. https://googleprojectzero.blogspot.com/2022/04/the-more-you-know-more-you-know-you.html
- [39]Yong Kiam Tan, Magnus O. Myreen, Ramana Kumar, Anthony Fox, Scott Owens, and Michael Norrish. 2019. The Verified CakeML Compiler Backend. Journal of Functional Programming 29 (2019), e2. https://doi.org/10.1017/S0956796818000229
- [40]Rui Uyemura. 2026. sail-x86. https://github.com/shina-lab/sail-x86/tree/1829cb6eec5f924b0fd920582953a2402357a12a.
- [41]Alexa VanHattum, Monica Pardeshi, Chris Fallin, Adrian Sampson, and Fraser Brown. 2024. Lightweight, Modular Verification for WebAssembly-to-Native Instruction Selection. In ACM International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS). https://doi.org/10.1145/3617232.3624862
- [42]Harishankar Vishwanathan, Matan Schachnai, Srinivas Narayana, and Santosh Nagarakatte. 2023. Verifying the Verifier: eBPF Range Analysis Verification. In Computer Aided Verification (CAV) (LNCS, Vol. 13966). https://doi.org/10.1007/978-3-031-37709-9_12
- [43]Xi Wang, David Lazar, Nickolai Zeldovich, Adam Chlipala, and Zachary Tatlock. 2014. Jitk: A Trustworthy In-Kernel Interpreter Infrastructure. In USENIX Symposium on Operating Systems Design and Implementation (OSDI). 33–47.
- [44]Shu yu Guo and Jens Palsberg. 2011. The Essence of Compiling with Traces. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL). 563–574. https://doi.org/10.1145/1926385.1926450
- [45]Shenghao Yuan, Frédéric Besson, Jean-Pierre Talpin, Samuel Hym, Koen Zandberg, and Emmanuel Baccelli. 2022. End-to-End Mechanized Proof of an eBPF Virtual Machine for Micro-controllers. In Computer Aided Verification (CAV) (LNCS, Vol. 13372). https://doi.org/10.1007/978-3-031-13188-2_15