SafeJIT: A Speculating JIT Engine Verified Down to the Machine Code
Gabriel Ebner
Key points
From the paper's conclusion- 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.
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.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Proving the Wrong Program: Miscompilations as a Threat to zkVM GuaranteesarXiv · 2026
- Verifying deployed bytecode against executable EVM semantics, with exact gas and no added axiomsarXiv · 2026
- Formalizing the Linux eBPF Core ISA: A Mechanized Operational Semantics and Its Real-World ApplicationsProceedings of the ACM on Programming Languages · 2026
- Keel: A Verified In-Kernel Proof Checker for Proof Carrying BPFarXiv · 2026
- CHERI under Fault Injection: An Emulation-Based Security Evaluation of Capability Hardware Enhanced RISC InstructionsarXiv · 2026
- Handling JAXarXiv · 2026