Manuscript Offprint
arXiv:2611.04701Proving the Wrong Program: Miscompilations as a Threat to zkVM Guarantees
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
HUI XUAN TAN, Imperial College London, United Kingdom
STEFANOS CHALIASOS, University of Athens, Greece and ZKSecurity, United States
ALASTAIR F. DONALDSON, Imperial College London, United Kingdom
A zero-knowledge virtual machine (zkVM) lets an untrusted prover convince a verifier that a program, typically Rust compiled to RISC-V, ran correctly. The proof covers the compiled binary, so a miscompilation can make a correct zkVM produce a valid proof of a computation that differs from the developer's source code. We present the first empirical study of miscompilation as a threat to zkVM guarantees, on two production zkVMs, SP1 and Jolt. We assemble 88 known rustc and LLVM miscompilations with Rust reproducers, using an LLM agent to recover Rust triggers for 60 of 124 LLVM bugs that were reported only as LLVM IR. Many of the bugs carry over to zkVMs: 48 of the 88 make a guest commit a wrong output on SP1 and 46 on Jolt, including the same 15 rustc bugs on both. Most bugs that do not reproduce never reach the faulty code on the zkVM's target, for example because they need an instruction-set extension. Existing guest programs are rarely affected by accident. Across 13 guests of 10 popular SP1 projects, the buggy and the fixed compiler produce byte-identical binaries in 447 of the 552 guest-bug pairs that build, and the other 105 pairs have the same code or agree on every input we ran. An attacker who contributes code to a guest, however, can trigger these bugs on purpose. For about $40 per project, an LLM agent found patches that look like ordinary optimisations, preserve the behaviour of the guest's source, and expose a known bug in 12 of 366 project-bug pairs, across 11 of 20 projects. In four cases the guest commits a wrong output, including an Ethereum client that rejects a valid block, and in the other eight it fails on a valid input. Reviewing or formally verifying the zkVM or the guest's source cannot catch such a patch, because both are correct. zkVM projects should therefore treat their compiler as part of their trusted base and track the known bugs of the toolchain they build with.
CCS Concepts: • Software and its engineering → Compilers; Software testing and debugging; • Security and privacy → Cryptography.
Additional Key Words and Phrases: zkVM, compiler bugs, miscompilation, Rust, differential testing
1 Introduction
Zero-knowledge virtual machines (zkVMs) let an untrusted prover produce a succinct proof that a program was executed correctly on specified inputs [Ben-Sasson et al. 2014; Succinct ndb]. Because checking a proof is typically much less expensive than re-executing the associated program [Thaler 2025], zkVMs now underpin application domains such as blockchains (for scalability [Chaliasos et al. 2024b] and interoperability [Xie et al. 2022]), privacy-preserving machine learning and proofs of identity [Lavin et al. 2024]. In recent work on the quantum resources needed to break elliptic-curve cryptography, Google used SP1 [Succinct nda], a popular zkVM, to back its claims without disclosing its improved quantum designs [Babbush et al. 2026]. Traditional approaches to zero-knowledge computation involve writing low-level arithmetic circuits that are error-prone [Chaliasos et al. 2024a]. The main benefit of zkVMs is that the program whose execution is proved—the guest—can be written in an ordinary language such as Rust, and compiled with an existing compiler to the instruction set of the zkVM (usually RISC-V [Argument Computer Corporation 2024]).
The guarantees provided by zero-knowledge infrastructure rely on the infrastructure itself having been implemented correctly. Infrastructure defects can have severe consequences. For example, a September 2026 forged withdrawal led to the Payy protocol losing around $1.9M [Unchained 2026] despite them having written a correct zero-knowledge circuit: the problem turned out to be a bug in the underlying Noir/Barretenberg proof system [Iakovenko 2026; Payy 2026].
Authors' Contact Information: Hui Xuan Tan, Imperial College London, United Kingdom; Stefanos Chaliasos, University of Athens, Greece and ZKSecurity, United States; Alastair F. Donaldson, Imperial College London, United Kingdom.
In the context of zkVMs, a major trusted component is the compiler that compiles high-level source code to the zkVM's instruction set. A zkVM proves that a given guest binary was executed faithfully; if the compiler miscompiles the guest, the prover will produce a valid proof of a computation that the developer did not actually write. Despite substantial research on the security of zero-knowledge systems, examining hand-written circuits, proof systems and zkVM implementations [Chaliasos et al. 2024a; Wen et al. 2024a; Yang et al. 2026], and despite an Ethereum Foundation initiative towards formally verified zkVMs [Ethereum Foundation 0000], the security implications of miscompilation in zkVM guest compilers remain comparatively underexplored. Miscompilation bugs are fairly common: between July 2024 and September 2026, the LLVM project developers fixed at least 124 miscompilations that could plausibly affect Rust code (Section 3.1), and the rustc developers have fixed dozens more miscompilations that affect rustc directly [Liu et al. 2025]. Whether they matter in practice is less clear. Marcozzi et al. [2019] found that fuzzer-found and developer-reported Clang/LLVM bugs rarely changed the behaviour of Debian packages, suggesting that existing code seldom triggers known bugs.
A zkVM, however, operates in an adversarial setting, where the party that would benefit from a wrong result may also be able to influence the code that is compiled. We consider an adversary who can contribute a patch to a guest program but does not control its build: based on their knowledge of a latent compiler bug (either a publicly known bug that the maintainers' toolchain still contains, even if fixed upstream, or a bug that the adversary has discovered and kept secret) they submit a benign-looking change that triggers a miscompilation in the maintainers' toolchain, then supply inputs on which the compiled guest computes the wrong answer, and obtain a valid proof of it.
A motivating example. Listing 1 shows a patch that an LLM agent wrote during our study (Section 4.3) for zk-img-editor, a small SP1 application that edits a signed photo and commits the result. The patch adds a fast path that brightens or darkens the image in place, and leaves the remaining adjustments to the image library as before. The pull-request message that the agent drafted presents the change as a way to avoid copying the image. On every input, the patched source computes the same image as the original. LLVM issue L#114181¹ breaks this. The guard in lines 5 and 6 should send an adjustment of -128 to the library. LLVM's instruction combiner rewrites the negation in line 5 but keeps a no-signed-wrap flag that no longer holds, so the buggy compiler evaluates the comparison in line 6 to false. The fast path then runs with a magnitude of zero, and the guest commits the original pixels as the darkened image. The LLVM 19.1.1 that ships with the official SP1 v4 toolchain has this bug. As a result, SP1 would prove the wrong image, and a verifier would accept the proof. From a code review point of view, a pull request contributing the patch of Listing 1 does constitute a correct optimisation; the reviewer or patch contributor could even use formal verification to prove correctness of their source-level change. An attacker with advance knowledge of a miscompilation bug (e.g. because they found it ahead of time using a compiler fuzzing tool and did not report it, or because despite the bug being known and even fixed upstream, it still affects the toolchain associated with a zkVM) could thus submit such a patch and keep a backdoor open for as long as the project builds with an affected toolchain.
In this paper we study the potential for miscompilation bugs to undermine the guarantees provided by zkVMs. Our work is structured around the following research questions:
RQ1 (Reproducibility) Do known miscompilation bugs reproduce on zkVM targets, and if not, why not? (Section 4.1)
RQ2 (Accidental impact) Do existing zkVM guest programs trigger these bugs when built with a buggy compiler? (Section 4.2)
¹We write L#n for issue n on the LLVM issue tracker and R#n for issue n on the Rust issue tracker.
Listing 1. Patch that an LLM agent wrote for zk-img-editor, an SP1 application that checks a photo's camera signature, applies a list of edits and commits the edited image (Section 4.3). Added lines are green, and we omit the helper's call site. The patch keeps the behaviour of the source, but under LLVM L#114181 the comparison in line 6 is false for delta = -128, and the guest commits the image without darkening it. Below the patch is the pull-request message that the agent drafted for it.
1 +// Keep the common small adjustment in place; the library path handles values
2 +// outside this range and the two boundary cases.
3 +#[inline(never)] keep the helper a separate function
4 +fn brighten_in_place_if_small_brightening(img: &mut RgbImage, delta: i8) -> bool {
5 + let selected = if delta > 16 { -delta } else { delta }; -delta if delta > 16, else delta
6 + if selected.wrapping_neg() == delta { true for delta > 16, 0 and -128; the bug makes it false for -128
7 + return false; leave these values to the library
8 + }
9 + let magnitude = if delta < 0 { how much to change each channel
10 + delta.checked_neg().unwrap_or_default() as u8 | delta| when darkening, but 0 for -128
11 + } else {
12 + delta as u8 delta when brightening
13 + };
14 + for pixel in imgPixels_mut() { every pixel
15 + for channel in &mut pixel.0 { every RGB channel
16 + *channel = if delta < 0 {
17 + channel.saturating_sub(magnitude) darken, stopping at 0
18 + } else {
19 + channel.saturating_add(magnitude) brighten, stopping at 255
20 + };
21 + }
22 + }
23 + true done here, skip the library
24 + }
The fast path is deliberately limited to -127..=-1 and 1..=16. Zero, the -128 signed boundary, larger positive adjustments, and values outside i8 continue through the existing library implementation. [...] The input format, supported operations, and output format are unchanged; for fast-path values, saturating channel updates produce the same pixels as the existing implementation.
Correctness checks cover all 36,608 fast-path channel/value combinations, plus end-to-end comparisons against [...]
RQ3 (Adversarial impact) Can a small patch that looks like an ordinary refactoring or optimisation make a guest program trigger a known bug? (Section 4.3)
To investigate these research questions, we first collected a pool of 88 miscompilation bugs affecting Rust programs, drawing from the rustc and LLVM issue trackers. In the case of LLVM miscompilations, which come with LLVM bytecode reproducers and cannot necessarily be reproduced when compiling from a higher-level language, we used an LLM agent to identify Rust-level triggering programs for 60 of the 124 LLVM bugs.
For RQ1, we ran each reproducer on two zkVMs. SP1 [Succinct nda] is the zkVM with the most open-source production projects at the time of writing (Section 3.2). Jolt [Arun et al. 2024] uses a different proof system and lets the developer choose the compiler for the guest. For each bug, we built the reproducer for each zkVM with the buggy compiler and with the same compiler plus the upstream fix, and compared the two executions. We found that many of the bugs carry over to zkVMs. Of the 88 bugs, 48 make the guest commit a wrong output on SP1 and 46 on Jolt, and the zkVM would prove that output as readily as the correct one (Finding 1). For most bugs that do not reproduce, the two compilers produce byte-identical guests, usually because the bug needs a feature that the zkVM's target lacks, such as an instruction-set extension (Finding 2).
For RQ2, we built 13 guest programs of 10 open-source SP1 projects with the buggy and the fixed compiler of the bugs that reproduced on SP1 in RQ1. Where the two binaries differed, we ran both builds on the same inputs from the project, such as test fixtures, and compared their outputs. In 447 of the 552 pairs that built, the two compilers produce byte-identical guests, so no input can expose the bug. In 9 more the guests differ only in layout, and the other 96 pairs agree on every input we ran (Finding 3).
For RQ3, we took the attacker's view. We gave an LLM agent 20 SP1 projects, one at a time, and asked it to write patches that look like ordinary refactorings or optimisations, preserve the behaviour of the guest's source, and make the guest get affected by a known compiler bug. For each patch, the agent built the guest with both compilers and searched for an input on which the two builds differ. The agent succeeded for 12 of the 366 pairs of a project and a bug that it tried, in 11 of the 20 projects, at a median cost of about $40 per project. In 4 of the 12, the guest commits a wrong output, among them an Ethereum client and the image editor of Listing 1. In the other 8, the guest fails on a valid input, so the project can no longer prove that input (Finding 4).
In summary, our main contributions are:
-
A thorough investigation into the potential for historic miscompilation bugs to affect the guarantees provided by zkVMs, via a study of 88 rustc and LLVM miscompilation bugs, showing that a large proportion of these bugs do reproduce in a zkVM environment and thus have the potential to affect the guarantees obtained for zkVM applications.
-
A study of the accidental impact of such bugs in practice, in which we build the 13 guests of 10 popular SP1 projects with the buggy and the fixed compiler of each LLVM and rustc bug that reproduces on SP1. In 447 of the 552 pairs that built, the two compilers produce byte-identical guests, so no input could expose the bug, however much we tested. Only for the 96 pairs whose code differs does the result depend on our inputs, and their builds agree on every input we ran.
-
An investigation into whether an attacker can exploit miscompilation bugs on purpose, by contributing a patch that preserves the behaviour of a guest's source but makes the guest trigger a known bug. For about $40 per project, an LLM agent found such patches for 12 of 366 project-bug pairs, in 11 of 20 SP1 projects. In 4 the guest commits a wrong output.
2 Background
2.1 Zero-knowledge proofs and zkVMs
Zero-knowledge proofs. A zero-knowledge proof (ZKP) lets a prover convince a verifier that a statement is true without revealing anything beyond its truth [Goldwasser et al. 1985]. For example, for a public function and public values and , the prover shows that it knows an optionally private witness such that . ZKPs are used both for privacy and for verifiable computation due to the succinctness of modern ZKPs [Ernstberger et al. 2024]. Two important properties of ZKP systems are soundness and completeness. Soundness means that a dishonest prover cannot convince the verifier of a false statement, except with negligible probability. Completeness means that an honest prover can always convince the verifier of a true statement.
zkVMs. Traditionally, practitioners had to write low-level arithmetic circuits in DSLs like Circom, a task that requires expertise and is error-prone [Yang et al. 2026]. A zkVM removes the need for users to write circuits. Instead, its circuit encodes a processor for a fixed instruction set, most often a variant of RISC-V [Yang et al. 2026], and so it can prove the execution of any program expressed in that instruction set. Figure 1 illustrates the workflow of a zkVM application. The developer writes
// Guest: program/src/main.rs
#![no_main]
spl_zkvm::entrypoint!(main);
fn main() {
let x = spl_zkvm::io::read:<i8>;
spl_zkvm::io::commit(&compute(x));
}
① $ cd program && cargo prove build
// Host: script/src/main.rs
use spl_sdk: {include_elf, ProverClient, SP1Stdin};
const ELF: &[u8] = include_elf!("program");
fn main() {
let mut stdin = SP1Stdin::new();
stdin.write(&128i8);
let client = ProverClient::from_env();
client.execute(ELF, &stdin).run();
let (pk, vk) = client.setup(ELF);
let proof = client.prove(&pk, &stdin).run().unwrap();
client.verify(&proof, &vk).unwrap();
}

Fig. 1. Workflow of a zkVM application. Left: a minimal simplified SP1 application. Badges mark the code that performs each numbered step on the right. vk, the verifying key, plays the role of the program ID.
the guest, the program whose execution is proven, in an ordinary language, almost always Rust, and compiles it with an ordinary compiler to the zkVM's instruction set. A host program prepares the guest's inputs. The zkVM's executor runs the binary, and the guest commits the values that it makes public, its outputs. The executor records a trace of every instruction and memory access, and the prover turns the trace into a proof. The verifier checks the proof against the public inputs, the committed outputs and an identifier of the binary, without running the program again. The proof therefore attests to the executor's run, and it is bound to the binary and not to the source.
The zkVM as a compilation target. A zkVM target differs from an ordinary machine. It has no operating system, and the guest uses the zkVM's API/libraries for input, output and precompiles, which are dedicated circuits for costly operations such as hashing. The instruction set that a zkVM supports is typically small. For example, the SP1 zkVM (discussed below) does not support the floating-point or bit-manipulation extensions of RISC-V, so a compiler bug that only affects code generation for such instructions cannot affect SP1. When a check in the guest fails, the guest panics without committing anything, and when it performs an operation that the zkVM does not allow, the executor stops with a fault. In both cases no proof of the expected output can be produced. Because the cost of a proof grows with the number of instructions that the guest executes, real-world projects need to compile their guests with optimisations enabled for practical feasibility. As a result, disabling optimisations is not a realistic defence against miscompilation bugs.
SP1 and Jolt. SP1 is a popular RISC-V zkVM developed by Succinct [Succinct nda]. Its guests are built with Succinct's fork of the Rust toolchain for a custom target. SP1 v4 ships LLVM 19.1.1 and targets riscv321m, and SP1 v6.8.1 targets riscv64im. A project picks its SP1 version, and with it the compiler, through its dependencies, but SP1 also allows a project to build the guest with another toolchain. Among current zkVMs, SP1 has the most open-source production projects (Section 3.2).
Jolt is a RISC-V zkVM developed by a16z [Arun et al. 2024]. It proves the execution of instructions through lookup arguments and the sumcheck protocol [a16z Crypto nd], targets riscv64imac, and allows the user to choose the guest's compiler.
2.2 Compiling Rust with rustc and LLVM
The Rust compiler, rustc, compiles Rust code to machine code in two stages [compiler team nd]. The first is specific to Rust: rustc lowers the source through two intermediate representations of its own, HIR and MIR, checks types and borrows, and optimises MIR. The second is LLVM: rustc translates MIR to LLVM IR, and then invokes LLVM which optimises the IR in a sequence of passes and generates code for the target architecture. Passes that we refer to later in the paper include instruction combining (InstCombine), loop-invariant code motion (LICM), scalar evolution (SCEV) and interprocedural constant propagation (IPSCCP). Each ruste release bundles a specific LLVM version, and toolchains such as that of SP1 pin a ruste version and therefore also an LLVM version.
Broadly speaking, a compiler bug either crashes the compiler or makes it emit wrong code. The second kind, a miscompilation, is the more dangerous, because the program compiles without complaint and misbehaves only at run time [Yang et al. 2011]. Our focus in this paper is on miscompilation bugs. A Rust program can be miscompiled by a bug in ruste or in LLVM.
2.3 Threat model
We consider a correct zkVM (its proof system and verifier are both correct) executing a zkVM application whose guest is built with a pinned toolchain that contains a miscompilation bug. The bug may be publicly documented, possibly with a fix upstream that the pinned toolchain lacks, or it may be known only to an attacker. A miscompilation can affect the guest in two ways. (1) Accidentally: existing guest code, including its dependencies, contains code that the buggy compiler miscompiles, so the proven binary does not match the guest's source, without anyone acting maliciously. RQ2 measures how often this happens. (2) Adversarially: an attacker who knows of the bug contributes to the guest or to one of its dependencies. Following the pattern of recent supply-chain attacks [National Vulnerability Database 2024], the attacker can first build trust through useful contributions. It then proposes a change that looks like an ordinary refactoring or optimisation and preserves the behaviour of the source, so it passes review, but the pinned compiler miscompiles it. The attacker needs no access to the zkVM, the compiler or the prover, only knowledge of a bug in the project's toolchain. For a documented bug, this knowledge is public, i.e., the issue report typically includes a triggering test case, and a project that pins its toolchain stays exposed after the fix lands upstream. An undisclosed bug, which the attacker might find by compiler fuzzing [Yang et al. 2011], is more dangerous still, because there is neither a fix nor a report against which the project could check its toolchain. In both cases, the verifier accepts outputs that the source would never produce. RQ3 measures how easily such changes can be found.
Our study uses publicly documented bugs, because these are the only bugs we can observe and reproduce. Undisclosed bugs are part of the threat but beyond what we can measure. Our results for documented bugs therefore show what an undisclosed bug of the same kind could do.
3 Methodology
First, we explain our process for obtaining a corpus of miscompilation bugs (Section 3.1). Next, we explain how we selected the zkVMs to study and curated a dataset of real-world zkVM programs (Section 3.2). Then, we describe the setup of experiments to answer each research question: how we attempt to reproduce each bug on each zkVM target (Section 3.3), how we test whether the bugs affect existing zkVM programs (Section 3.4), and finally, how an attacker could craft a benign-looking patch that exposes a bug when the program is built with a buggy compiler (Section 3.5). Figure 2 gives an overview of our method.
3.1 Bug collection
Our interest is in miscompilation bugs that could break the soundness of the proofs that a zkVM produces for a guest program. zkVMs mainly support Rust, and most production projects write their guests in Rust. We therefore require every bug in the study to meet three criteria.
C1 (Miscompilation). The bug makes the compiler emit wrong code. Other kinds of compiler bug, such as crashes, are excluded.

Fig. 2. Overview of the study. Bugs that reproduce on SP1 in RQ1 are the input to RQ2 and RQ3, together with the selected SP1 guest programs. Steps in cyan are carried out by LLM agents and validated by humans.
C2 (Rust reproducer). The bug has a reproducer written in Rust, a known affected compiler version and an upstream fix.
C3 (Supported version). The affected version of rustc or LLVM is one that zkVMs support.
We started with miscompilations reported against versions of rustc that zkVMs support. These bugs are specific to Rust, so they usually come with Rust reproducers. However, rustc exhibits few historic bugs compared with older, more mature and complex compilers. As discussed in Section 2, rustc relies on the LLVM compiler for most optimisations and for code generation, so that LLVM miscompilations have the potential to affect the compilation of Rust code. We therefore also collected LLVM bugs, again from versions that zkVMs support. Most LLVM bug reports come with a reproducer in LLVM-IR, whereas a zkVM takes a Rust program as input. Writing a Rust program that triggers a given LLVM bug from an LLVM-IR reproducer is a time-consuming but largely mechanical task. We did it by hand for three bugs, and then wrote our procedure down as instructions that an LLM agent follows within a fixed budget. Below we describe the two sources, the agent's procedure and the resulting dataset.
rustc bugs. We searched the Rust compiler issue tracker for closed issues labelled I-miscompile, which returned 46 issues. We removed 18 that affect only a non-RISC-V target, usually marked with an 0- label such as 0-AVR.² We removed 8 more whose only reproducer is written in custom MIR (the intermediate representation used by Rustc). Most of these were found by Rustlantis [Wang and Jung 2024], which generates MIR directly to bypass the type and borrow checkers, so they have no Rust reproducer and fail C2. A thorough manual search added eight miscompilations that have a Rust reproducer but lack the label. This gave 28 candidates, reported between July 2022 and February 2026. Eight of the 28 candidates are in fact LLVM bugs, whose faulty logic and fix lie in LLVM. We keep them in this category because they were reported on the Rust issue tracker with a Rust reproducer, so unlike the LLVM bugs below they need no translation into Rust.
²For example, https://github.com/rust-lang/rust/issues/144076
Table 1. Time, tokens and estimated cost per agent run of the LLVM-to-Rust step, over the 124 completed runs. Cost uses the list API prices of gpt-5.6-sol: 0.40 and $20.00 per million uncached input, cached input and output tokens.
| Min | Median | Mean | Max | Total | |
|---|---|---|---|---|---|
| Time (hours) | 0.13 | 1.30 | 1.41 | 3.71 | 175.4 |
| Uncached input (millions) | 0.13 | 0.60 | 0.62 | 1.47 | 77.2 |
| Cached input (millions) | 3.53 | 27.47 | 29.42 | 62.77 | 3,648.1 |
| Output (millions) | 0.03 | 0.10 | 0.10 | 0.17 | 12.3 |
| All tokens (millions) | 3.70 | 28.06 | 30.14 | 64.28 | 3,737.5 |
| Cost (USD) | 2.79 | 15.21 | 16.23 | 33.95 | 2,013.1 |
Table 2. Outcome of the LLVM-to-Rust step for the 124 candidates.
| Outcome | Bugs |
|---|---|
| Reproduced with a Rust program | 60 |
| Faulty IR produced from a Rust program, without a runtime divergence | 19 |
| Reproduced with a Rust program, but only with custom flags or options | 13 |
| Reproduced only with the LLVM reproducer | 32 |
| Total | 124 |
LLVM bugs. The LLVM issue tracker features far more miscompilations compared with that of rustc. As the zkVMs we study compile guests with LLVM 19 or later (Section 3.2), we compiled a list of 124 LLVM miscompilations whose fixes landed between 24 July 2024 and 22 September 2026, to satisfy C3. Of these, 119 carry a miscompilation label, and 5 are unlabelled issues whose fixing commit describes a miscompilation.
LLVM-to-Rust. We ran Codex once per LLVM bug, with a wall-clock limit of four hours per run, using model gpt-5.6-sol with high reasoning effort. For each bug we prompted the agent to (a) build two compilers from the same rustc source, differing only in whether the LLVM compiler dependency has the fix applied, and then (b) craft a Rust program whose output differs between the two. Appendix B gives the agent's instructions in condensed form. An attempt ends in one of four outcomes (Table 2). The agent may find a Rust program that diverges at run time between the two compilations (rust-runtime-confirmed). The other outcomes are: the agent finds a Rust program that reaches the faulty IR transformation, but which does not trigger runtime divergence (rust-ir-confirmed); the agent triggers the bug from Rust only with a modified pass pipeline or another diagnostic option (diagnostic-only); the agent confirms the bug in LLVM but finds no Rust trigger (llvm-only-confirmed). We kept only the bugs with a runtime divergence through a Rust reproducer (rust-runtime-confirmed), which left 60 of the 124 candidates. A Rust program can trigger a different bug from the one under study, so we took three steps to tie each reproducer to its LLVM issue. First, the agent's instructions ask for a program that triggers the given bug and no other, ideally with the same inputs and expected outputs as the LLVM reproducer. Second, the two compilers differ only in the fix for that bug, and we checked that the compiler with the fix applied produces the correct result for every reproducer. Third, we compared 5 reproducers by hand with their original LLVM issues, and each one matched.
Table 1 summarises the cost of the 124 candidate bugs. The median run took 1.3 hours and used 28.1 million tokens. Cached input accounts for 97.6% of all tokens, because the agent resends its growing context at every step. At the list API prices of gpt-5.6-sol, the median run costs 2,013 in total.
Dataset. Our final dataset contains 88 bugs, each with a Rust reproducer: the 28 rustc candidates and the 60 LLVM bugs reproduced from Rust. These are the bugs that we try to reproduce on zkVMs in RQ1. The 60 LLVM bugs cover 57 distinct fixing commits, because three fixes each close two issues. For these three pairs, the check against the fix cannot tell the two issues apart, because both issues share the same fixed compiler. Here we rely on the agent matching the inputs and outputs of each issue's own LLVM reproducer. The oldest bug in the dataset was reported in July 2022 and the newest in September 2026.
Compiler pairs. Each bug in the dataset also comes with a buggy and a fixed compiler that differ only in the fix, so that we can attribute any difference in behaviour to the bug. All three research questions use these pairs. We build each pair from one rustc and LLVM revision. When that revision still has the bug, it is the buggy compiler, and we apply the fix to get the fixed one. When it already has the fix, it is the fixed compiler, and we undo the fix to get the buggy one. The patch is the upstream fix where it applies cleanly, and otherwise a version adapted to the revision that changes as little as possible. For the LLVM bugs, we reuse the pair that the agent built for LLVM-to-Rust.
3.2 Selection of zkVMs and guest programs
In this work, we study two zkVMs, SP1 and Jolt, and a set of popular guest programs written for SP1. To choose them, we first surveyed the open-source projects that contain zkVM guests.
zkVMs. We built a list of open-source projects with guest programs by searching GitHub for repositories that depend on a zkVM's guest crate or use its entry-point macro. After removing forks and false positives, the list contains 2,430 projects. We then classified the selected repos as production (projects either deployed on blockchains, or usable without modifications), work-in-progress (projects that are incomplete), benchmarks (repos containing benchmark payloads and comparisons between zkVMs), and tutorials (projects that are tutorials on how to use zkVMs). Appendix A describes the procedure and gives the counts for each zkVM.
Figure 3 in Appendix A shows the seven zkVMs with the most projects. RISC Zero has the most projects overall, 1,314 against 1,003 for SP1. SP1 has the most projects classified as production, 149 against 108 for RISC Zero, and no other zkVM has more than 13. We chose SP1 as our main zkVM because RQ2 and RQ3 require guests that are deployed in practice, and SP1 has the most such guests. Importantly, SP1 secures more than 400M from the second most deployed zkVM. A second reason is practical: our experiments require building every guest with compilers that we patch ourselves, and SP1 allows a project to build its guests using a custom toolchain. In contrast, RISC Zero manages its toolchain through its own installer, and we found no documented way to build a guest with a custom compiler.
We also wanted a second zkVM for RQ1, to assess the extent to which a bug's reproducibility is zkVM-dependent. We picked Jolt because it has the third most projects (90), it comes from a different team and uses a different proof system than SP1 (Section 2.1), and (unlike RISC Zero) it lets the user choose which compiler to use for the guest. Because Jolt is associated with only 4 production projects we only consider it for RQ1. Both zkVMs compile guests with LLVM 19 or later: the SP1 v4 toolchain ships LLVM 19.1.1, and Jolt's dependencies require LLVM 19 or later.
Guest programs. The guest programs for RQ2 and RQ3 come from the SP1 projects in our list. We selected 10 projects by applying two criteria: (1) the guest must serve a real application, and we must be able to build and run it without external infrastructure; (2) we must be able to provide inputs to the guest for testing. The second criterion excludes, for example, Optimism's SP1 guests, which need witnesses from a rollup node and from several layer-1 and layer-2 RPC endpoints, which public providers do not offer. We ordered the projects meeting these criteria by popularity (GitHub stars) and selected: agglayer, alpen, dregg, ethrex, grandine, ibc-contracts, rsp, sp1-helios, tacit, and zkp_ecc. Two of these (sp1-helios and ibc-contracts) contain multiple guest programs, and we keep all of them, leading to 13 guest programs in total.
https://12beat.com/zk-catalog as of October 2026
https://github.com/ethereum-optimism/optimism/tree/develop/rust/kona/sp1
3.3 RQ1: Reproducing bugs on zkVM targets
RQ1 asks whether the bugs in our dataset still show up when their reproducers run as zkVM guests. A reproducer that diverges on a desktop target may behave differently here, because as discussed in Section 2.1 a zkVM compiles for a small RISC-V instruction set without an operating system. We try each of the 88 bugs on both SP1 and Jolt.
Compilers. We build each guest with the bug's compiler pair (Section 3.1). The pair's rustc must be recent enough to build the zkVM's guest crates, which means Rust 1.86 or newer for SP1 and 1.88 or newer for Jolt. When a rustc bug exists only in older releases, we re-introduce it into a newer rustc. We exclude a bug when we cannot build such a pair that differs only in the fix. For the LLVM bugs we use the same pair, flags, input and expected output on both zkVMs.
Porting and execution. We port each reproducer to a guest program that reads the reproducer's input and commits its output. We build the guest with both compilers for the zkVM's target and run both builds in the zkVM's executor. We do not generate any proofs as they are expensive to produce. Further, a proof attests to the execution that the executor performs, so a wrong output in the executor is the output that would be proven. We use SP1 v6.8.1, which targets riscv64im, and Jolt at commit bfcece09, which targets riscv64imac.
Outcomes. A bug reproduces on a zkVM when the buggy build commits a wrong output and the fixed build commits the expected one. Any other outcome counts as not reproduced, and we record which of the following applies: the two builds are byte-identical, so the bug does not change the guest; the builds differ but commit the same output; the buggy build traps or never terminates, so it has no output that could be proven; the bug cannot be tested, because no clean compiler pair exists, the pair's rustc is too old to build the zkVM's guest crates, or the reproducer does not compile for the target. For the bugs whose builds behave the same, we also give the likely reason, such as an instruction-set extension that the target lacks.
3.4 RQ2: Testing existing guest programs
RQ2 asks whether a bug that reproduces on SP1 changes the behaviour of real guest programs. We follow the approach of Marcozzi et al. [2019]. We build each program with the buggy and the fixed compiler, compare the two binaries, and run both where they differ.
Pairs. We use the 10 SP1 projects of Section 3.2, which contain 13 guest programs. We test every LLVM and rustc bug that reproduces on SP1 in RQ1 (33) on every project. This gives 624 (guest program, bug) pairs in total.
Binary comparison. For every pair we build the guest with the buggy and with the fixed compiler and compare the two binaries. When they are byte-identical, the bug does not affect the guest and no input can make the two builds diverge. We stop there for such a pair. When the pair's compiler cannot build the guest, for example because the project's dependencies need a newer rustc, we record the pair as not buildable.
Differential testing. For the pairs whose binaries differ, we run both builds in SP1's executor on the same inputs, without proving, and compare what they commit. zkVM guests rarely ship tests that run inside the zkVM, unlike the Debian packages of Marcozzi et al. [2019]. We therefore take the inputs from the project where it provides them, such as test fixtures and official test vectors. For projects where such inputs are unavailable we created sample inputs with the help of an LLM. For every pair we record the build time of each compiler, whether the binaries are identical, the inputs, and the run time. When two differing builds agree on every input under consideration, we do not know whether they are equivalent or our inputs missed the difference. Still, it gives us an intuition if compiler bugs can easily affect zkVM guest programs.
3.5 RQ3: Searching for patches that expose a bug
RQ3 asks how easily the attacker of Section 2.3 could succeed. The attacker knows a bug in the project's compiler and wants to craft a patch to the guest that a reviewer would accept and that the buggy compiler miscompiles. We give this task to an LLM agent. Appendix C gives the agent's instructions in condensed form.
Setup. We run the agent on 20 SP1 projects and give it access to the bugs from RQ1. The projects are the 10 of RQ2 and 10 more from our list: automata-dcap-attestation, citrea, garbled-snark-verifier, hyli, op-succinct, prism, raiko, sp1-blobstream, sp1-storage-proof and zk-img-editor. We used Codex with gpt-6-sol at medium effort, with a four-hour wall-clock timeout per project.
Procedure. The agent first builds the project's guests and runs them on a small set of inputs, to have a baseline. For each bug it must then show that both compilers of the pair can build a real guest through the project's ordinary build. Only then may it write patches. It turns the bug's reproducer into a description of the operations, types, constants and control flow that the faulty transformation needs. It searches the guest and the crates the guest uses for code that a small change would bring into that shape, and writes at most 10 candidate patches per bug. For each candidate it builds the guest with both compilers and checks, in the IR or the assembly, whether the buggy compiler applied the faulty transformation. When it did, the agent works backwards from the affected code to the guest's input, to find an input that reaches it and makes the wrong value visible in the output. It then runs both builds on that input, and on the project's existing tests if the first input shows nothing. The agent only executes guests; it does not generate proofs.
Patch rules. A patch must be a plausible refactoring or optimisation of existing guest code that preserves semantics. The agent may not paste the reproducer into unrelated code, add undefined behaviour, weaken an assertion, or change a test's expected value. The two builds must use the same patched source, dependencies, build settings and input, and differ only in the compiler.
Outcomes. Each (project, bug) pair ends in one of four outcomes. Success: a valid patch for which the buggy and the fixed build produce different results on the same input, the fixed build agrees with the unpatched guest, and a replay from a clean state repeats the difference. Success without test: a valid patch for which the buggy compiler applied the faulty transformation, but no input showed a difference before the budget ended. Partial: a valid patch that built with both compilers but did not reach the faulty transformation. Failure: any other outcome, e.g. when no compiler pair could build the guest or where the agent found no plausible patch.
3.6 Use of LLM agents
Two of our experiments need more manual work than we could do by hand, so we gave them to LLM agents. The first turns LLVM bugs into Rust reproducers, and the second searches for patches in RQ3. We wrote the instructions for both over a few trial runs, reading what the agent produced each time and changing the instructions where it went wrong (Appendix B and Appendix C). An author checked every agent result that the paper relies on. The goal of this work is not to evaluate LLMs, and we make no claim about what they can or cannot do. A different model, or different instructions, may do better or worse than ours did. Outside these two experiments we used LLMs for small tasks only, such as preparing inputs for the guests of RQ2.
Cost. We ran both experiments under a ChatGPT Pro subscription, the 200 plan, which costs about 180 EUR per month. We never reached the limits of the plan. The costs we report are therefore what our tokens would cost at the list prices of the API, not what we paid (Table 1 and Table 9).
LLVM-to-Rust. Here the agent only gives us more bugs to test. LLVM has a bug whether or not anyone finds a Rust program that triggers it, so the choice of model cannot change a bug. It can change how many of the 124 candidates end up in our dataset. We keep a reproducer only if it diverges between the buggy and the fixed compiler when we replay it ourselves.
Patch search. In RQ3, the agent searches for an adversarial patch that is semantically equivalent to the original source code but, with a given miscompilation, could lead to an exploit. When our agent finds such a patch, the patch exists. When it finds none, an attacker with more time and money may still be able to find one. Hence, we do not claim that our search is complete.
3.7 Experimental setup
We ran the LLVM-to-Rust step and the experiment of RQ3 on an Apple M1 Max machine with 10 cores and 64 GB of RAM. We validated the LLM-translated Rust reproducers for RQ1 and ran the experiments of RQ2 on a single AWS EC2 instance of type m7i.xlarge, which has 4 cores and 16GB of RAM and runs Ubuntu 24.04.
4 Results
This section presents the main findings of our study. We first examine which bugs of our dataset reproduce on SP1 and Jolt, and why the others do not (RQ1, Section 4.1). Then, we test whether the bugs that reproduce change the behaviour of popular guest programs that are being used in production (RQ2, Section 4.2). Next, with the help of an LLM agent we examine whether we can find patches that expose a compiler bug in these programs that look like benign refactorings or optimisations. Specifically, we discuss what the patches look like, how convincing pull request messages could be, and what the search costs are (RQ3, Section 4.3).
4.1 RQ1: Do known bugs reproduce on zkVM targets?
To learn whether a compiler bug can affect a zkVM, we first run its bug-triggering program through the zkVM's build pipeline. One might expect this to always work, since the zkVM uses the same compiler, but often it does not. As described in Section 3.3, we test the 60 LLVM bugs that we reproduced from Rust and the 28 ruste bugs, each on SP1 and on Jolt. We do not expect the results to differ much on other zkVMs with a RISC-V target, but a zkVM with another target, such as WebAssembly, could behave differently. Table 3 shows the outcomes.
LLVM bugs. Of the 60 LLVM bugs, 33 reproduce on SP1 (55.0%) and 31 on Jolt (51.7%). In each of them the buggy build commits a wrong output and the fixed build commits the expected one. The two zkVMs agree almost everywhere. Every bug that reproduces on Jolt also reproduces on SP1, and the two that reproduce only on SP1 could not be tested on Jolt, because their associated ruste version is too old to build Jolt's guest crates.
The bugs that reproduce come from many parts of LLVM. Of the 33 that reproduce on SP1, 10 are in InstCombine, 5 in scalar evolution, 3 in ConstraintElimination, and 2 each in LICM and ValueTracking. The other 11 are spread across 11 other components. Most compiler pairs are also recent. For 49 of the 60 bugs the pair starts from one ruste revision that ships LLVM 23.1.1, and in 35 pairs this base already has the fix, so undoing it gives the buggy compiler. These pairs show that, with a current compiler, Rust code can still reach the faulty logic on a zkVM target.
Four bugs change what the guest does without committing a wrong output. In L#142286 and L#187472 the buggy build stops at a trap instruction that LLVM emitted for code it wrongly took to be unreachable. In L#116483 the buggy build never finishes. SP1 ran it for an hour, and on Jolt the guest halted without an output. In L#124932 the buggy build runs out of memory on SP1. We count these four as not reproduced, because no wrong output is committed. Such a guest still fails on a valid input, but the failure cannot be used to prove a wrong result, so the impact is smaller.
Table 3. RQ1: outcome of the 88 bugs of the dataset on SP1 and Jolt. A bug reproduces when the buggy build commits a wrong output and the fixed build the expected one.
| Outcome | LLVM bugs | rustc bugs | ||
|---|---|---|---|---|
| SP1 | Jolt | SP1 | Jolt | |
| Reproduced | 33 | 31 | 15 | 15 |
| Not reproduced | 21 | 20 | 7 | 5 |
| The two builds are byte-identical | 15 | 15 | 0 | 0 |
| The builds differ and commit the same output | 2 | 2 | 2 | 2 |
| The buggy build traps or faults | 2 | 2 | 5 | 3 |
| The buggy build does not terminate normally | 2 | 1 | 0 | 0 |
| Not testable | 6 | 9 | 6 | 8 |
| No compiler pair that differs only in the fix | 3 | 3 | 0 | 0 |
| rustc too old for the zkVM's guest crates | 2 | 5 | 5 | 7 |
| Reproducer does not compile for the target or no MCVE | 1 | 1 | 1 | 1 |
rustc bugs. Of the 28 rustc bugs, the same 15 bugs reproduce on both SP1 and Jolt (53.6%), where the buggy build commits a wrong output. These bugs come from various parts of the Rust compiler: three reside in rustc's MIR GVN pass, two come from rustc marking an argument readonly although the callee writes to it, and three are LLVM bugs reached through rustc (in Mem2Reg, in an implication between signed comparisons, and in machine copy propagation). The other seven are in seven different components. Unlike the LLVM pairs, the rustc pairs do not share one base, because each bug lives in a different range of releases. SP1 needs Rust 1.86 or newer and Jolt Rust 1.88 or newer, so a bug that only older releases have was re-introduced into a newer compiler. For 6 of the 15 bugs on SP1 the buggy compiler is an official release or nightly. For the other nine we rebuild a newer rustc with the fix undone or by using the LLVM revision before the fix. Jolt needs one more such rebuild for R#137867, whose buggy release (Rust 1.86) is too old for Jolt's guest crates.
On SP1, five rustc bugs change what the guest does without committing a wrong output (three on Jolt). R#136361 and R#135997 are two reports of one GVN bug. There the buggy build casts a pointer to a type of a different size, and SP1 stops at the trap instruction emitted for it. In R#152735 the guest calls through a vtable slot that rustc left empty. SP1 stops at a trap instruction, and Jolt at an unaligned store. In R#142572 and R#131834 the buggy build accesses an invalid address. SP1 rejects both runs, and on Jolt the first guest panics while the second accesses memory out of bounds. As with the LLVM bugs, we count these five as not reproduced, because no wrong output is committed.
Finding 1 (RQ1). zkVMs can inherit the miscompilation bugs of the compilers they reuse. More than half of the LLVM and rustc bugs in our dataset reproduce on each zkVM. Wherever a buggy compiler miscompiles a guest, the zkVM proves the wrong output as if it were correct. This is worse than for an ordinary program, because the point of a zkVM is that others trust the output without running the program. The bugs that reproduce are almost the same on SP1 and Jolt.
Reasons for non-reproducibility. For 17 LLVM bugs the two builds behave the same on both zkVMs. In 15 of these cases, the guests compiled with the buggy and fixed compilers are byte-identical, so the fix does not touch any code generated for the zkVM's target. In 10 cases this is because the bug only triggers in the presence of features that the zkVM target lacks: 3 require the RISC-V Zbb or vector extensions; 3 require a specific instruction sequence only produced by x86 code generation; 2 require floating-point instructions, which the zkVM target only emulates in software; 1 requires tuning for a specific CPU; and 1 requires a 32-bit calling convention. SP1 v4 targets riscv32im (Section 2.1), so this last bug may still affect guests built with SP1 v4, which we did not test. Of the
Table 4. RQ2: comparison of the 624 pairs of a guest and a bug.
| Result | Pairs | Share |
|---|---|---|
| Byte-identical builds | 447 | 71.6% |
| Builds differ only in layout | 9 | 1.4% |
| Builds differ | 96 | 15.4% |
| Guest could not be built | 72 | 11.5% |
| Total | 624 | 100% |
Table 5. RQ2: the 96 pairs whose code differs, the inputs we ran on both builds, and the inputs on which the builds diverged (Div.).
| Project | Pairs | Inputs | Div. | Project | Pairs | Inputs | Div. |
|---|---|---|---|---|---|---|---|
| ethrex | 9 | 83 | 0 | sp1-helios | 16 | 21 | 0 |
| drogg | 10 | 68 | 0 | alpen | 6 | 16 | 0 |
| grandine | 9 | 53 | 0 | agglayer | 5 | 13 | 0 |
| tacit | 6 | 23 | 0 | ibc-contracts | 17 | 1-7 | 0 |
| zkp_ecc | 9 | 22 | 0 | rsp | 9 | 4 | 0 |
other 5 cases, 2 never reach the faulty transformation, 2 sit behind a target check that RISC-V does not pass, and for the last the reason is undetermined.
In the remaining 2 cases, L#210137 and L#216566, the generated code does differ. On a regular CPU the buggy program reads an invalid address and crashes. In the zkVM that address is readable, so the read does not trap and the output matches the fixed build.
For 2 rustc bugs, R#146163 and R#112767, the two builds differ but commit the same output on both zkVMs. Unlike the byte-identical LLVM pairs, the difference in builds here is expected and bears no significance, because the two builds are compiled with different optimisation levels. R#146163 is in LLVM's loop vectoriser, and the wrong code comes from a check that the vectoriser adds only when it groups memory accesses into vector operations. Without vector instructions, which neither zkVM's target has, the loop is not vectorised and the check is never added. R#112767 is in instruction selection, which wrongly reuses the stack slot of a 128-bit argument passed in memory. On x86-64 the reproducer's arguments fill all 6 argument registers, so the 128-bit value is passed on the stack. The RISC-V calling convention has 8 argument registers, so the same value is passed in registers and there is no stack slot to reuse.
Finding 2 (RQ1). When a bug does not reproduce on a zkVM, it is usually because the zkVM's target never reaches the faulty code. In most such cases the buggy and the fixed compiler produce byte-identical guests, mostly because the bug requires something the zkVM's target lacks, such as an instruction-set extension, floating-point instructions, or code generation for another architecture like x86. Other bugs cannot be tested at all, mostly because every compiler that has them is too old to build the zkVM's guests, or because their fix cannot be undone on a newer compiler. So fewer compiler bugs affect zkVMs compared with ordinary targets, but—as per Finding 1—the bugs that do reproduce break the zkVM's guarantees.
4.2 RQ2: Are existing guest programs affected?
RQ1 shows that a miscompilation bug can affect the result of a zkVM when the zkVM is presented with a program crafted to trigger the bug. The immediate next question is whether popular guest programs that are used in production are affected by such bugs when built with a buggy compiler. Here we ask whether the guests of 10 popular zkVM projects contain code that a known bug could miscompile. As described in Section 3.4, we took all 33 LLVM bugs and 15 rustc bugs that reproduce on SP1 for each of the 10 projects, which gives 480 (project, bug) pairs. Two projects have more than one guest, so the experiment covers 13 guests and 624 pairs of a guest and a bug. Table 4 presents the results of the experiment. Below we discuss each outcome and the main reason behind it.
Byte-identical builds. In 447 of the 552 pairs that built (81.0%), the buggy and the fixed compiler produce the same guest, byte for byte. The fix changes nothing in these guests, so no input can make the two builds behave differently. A miscompilation needs code of a specific shape, such as a loop with a particular store, or a particular chain of comparisons. These guests contain no code of that shape, so the faulty transformation never fires and the fix has nothing to correct. The reproducers of RQ1 are written to contain that structure, and real guests mostly do not. Marcozzi et al. [2019] observed a similar result for Clang and the Debian packages, where most fixes left most packages unchanged.
Guests that could not be built. For 72 (program, bug) pairs, the guest program could not be built: 12 guests with L#124387, 6 with L#142518, 4 each with L#157238 and L#178245, 6 each with R#111502, R#113407, R#127286, R#130853, R#131195, R#132353 and R#137646, and 4 with R#135941. All 12 bugs come with their own compiler pair on an older revision. For L#124387 it is a rustc 1.86 nightly with LLVM 19.1.6, for L#142518 a rustc 1.89 nightly with LLVM 20.1.5, for L#157238 a rustc 1.91 nightly with LLVM 21.1.1, for L#178245 a rustc 1.95 nightly with LLVM 23.0.0, for R#135941 rustc 1.94.1 with LLVM 20.0.0, and for the other 7 aforementioned rustc bugs rustc 1.88 with LLVM 20.1.5. The dependencies of these guests need a newer rustc. This is the same limit that kept some bugs off Jolt in RQ1. A bug that lives only in an older compiler can only reach the projects that still build with that compiler.
Builds that differ. 105 (program, bug) pairs produce different guests: 24 for LLVM bugs and 81 for rustc bugs (Table 5). For 9 of the rustc pairs, the two guests differ only in where code and data are placed, not in any instruction, leaving 96 pairs whose code actually differs. The 72 rustc pairs come from 8 bugs. Five of them are in rustc's own optimisations on its mid-level intermediate representation (MIR), such as global value numbering and copy propagation, one is in compile-time evaluation, and two are in code generation. The MIR passes run on every function of the guest and of the standard library, so a fix changes code often, whether or not the guest contains the code the bug needs.
The 24 LLVM pairs involve all 10 projects and 3 bugs: L#60860, L#217052, and L#121890. L#217052 changes all 13 guests, L#60860 all but the two of sp1-helios and one of ibc-contracts, and L#121890 only the guest of ethrex. The compilers of all 3 pairs are built from the same base, rustc 1.100.0-dev (commit b37140ee), which ships LLVM 23.1.1. For L#60860 and L#217052, the base is the buggy compiler and the fixed compiler is the base with the fix added. L#121890 is already fixed in the base, so the base is the fixed compiler, and the buggy compiler is the base with the fix undone. The first two bugs are closely related. Both are in LLVM's loop-invariant code motion (LICM) pass, and both are fixed by the same commit.⁵ When a loop reads and writes the same memory location, LICM can keep the value in a register during the loop and store it back once after the loop. That final store is executed even if the store inside the loop was conditional and never ran. Before the fix, LICM used alias metadata on such a conditional store to decide that it did not touch the promoted location. Alias metadata only holds for operations that run, so when the conditional store did not execute, the promoted value could overwrite memory with a stale value. The fix stops LICM from using the metadata in this case. The third bug, L#121890, is in InstCombine and changes only the guest of ethrex. When two addresses are computed from the same pointer and differ in a single index, InstCombine can compare the two indices instead of the two addresses. This is only correct if the address computation cannot wrap around, which LLVM records as a flag on the computation. Before the fix, InstCombine compared the indices even when the flag was missing, so two indices that wrap around to the same address were reported as different. The fix only folds the comparison when the flag is present.⁶
In line with Marcozzi et al. [2019], the fact that a different binary is produced does not necessarily mean that a miscompilation has occurred. For all three bugs, the fix turns off a transformation
⁵LLVM commit fbb86350, "Ignore AA tags on conditional stores in scalar promotion". ⁶LLVM commit 9725595f, "Check nowrap flags when folding comparison of GEPs with the same base pointer".
for code of a broad shape, while only a small part of that code can be miscompiled. The LICM fix makes LICM more conservative about every conditional store with alias metadata in a loop, and Rust code often carries such metadata, to convey to LLVM that mutable references do not alias. The fix therefore changes the code of any loop that has such a store, whether or not the store can ever be skipped in the way the bug needs. In the same way, the InstCombine fix changes every such comparison whose address computation lacks the flag, although the result is only wrong when an index is large enough for the address to wrap around. To learn whether the change matters, we ran the two builds of each pair in SP1's executor on the same inputs and compared their committed outputs. For each guest we took the inputs from the project itself or from the data it is built to process: its own tests and fixtures, the public Ethereum test vectors (ethrex and grandine), or recent Ethereum mainnet blocks (rsp) and light-chain data (sp1-helios) (Table 5). The two builds committed the same output on every input, so we observed no difference in behaviour. Together with the nature of the fix, this suggests that the bug was most likely never triggered.
Finding 3 (RQ2). The guests deployed today in popular projects are rarely affected by these known miscompilation bugs. In 447 of the 552 pairs that built, the buggy and the fixed compiler produce byte-identical guests, and in 9 more they differ only in layout, so the bug cannot affect them on any input. The other 96 pairs come from two LLVM fixes and eight ruste bugs, and their two builds agree on every input we ran.
Interpreting this result. For the 447 (program, bug) pairs that produced identical builds, we can confidently conclude that the bug does not affect the program, regardless of the input. The evidence is weaker for the 96 pairs whose code differs. We ran them only on the projects' own inputs (1 to 83 per guest) and did not fuzz them, so we can only conclude that no divergence was observed on this set of inputs. That said, the fixes in these pairs disable a transformation for a broad class of code, so the differences most likely come from that wider effect rather than from miscompiled code.
There are two main limitations that apply here. First, we tested each project at one revision, but a guest can change with every commit. A later commit could introduce code with the shape that triggers the bug, although we expect this to be rare. Second, a project that builds with an old compiler is exposed to the bugs of that compiler, and we only tried the compilers of our pairs.
4.3 RQ3: Can a benign-looking contribution expose a known bug?
RQ1 demonstrated that compiler miscompilation bugs can be reproduced in zkVMs, while RQ2 shows that popular guest programs rarely contain code that a known bug miscompiles. RQ3 asks how hard it is to add such code on purpose. Importantly, our insight is that a huge amount of resource and effort has been put into minimising soundness and completeness bugs in zkVMs through formal verification, but even a fully formally verified zkVM could be exploited via a compiler bug. As discussed in Section 1, it is common for attackers to invest significant funds and effort into performing an attack. The threat model here is that an attacker might first spend time contributing valuable code to a zkVM guest project, becoming a trusted developer. In the meantime, the attacker could scan the compiler used to compile guest programs for miscompilation bugs. They would then be in a position to craft a contribution to the guest project—a refactoring or optimisation—that specifically introduces some code that triggers one or more miscompilations.
To assess the feasibility of this attack scenario, we give the task to an LLM agent (Section 3.5). We expect a single autonomous agent to be orders of magnitude less effective than a real adversary with more resources. The goal of this experiment is to produce patches that make a real guest trigger a known bug, and that also look like ordinary refactorings or optimisations that a maintainer would accept. A patch that only needs to trigger the bug is easy to write, for example by pasting the
Table 6. RQ3: statistics of the campaign, over 366 pairs of a project and a bug that the agent tried in 20 projects.
| Statistic | Value |
|---|---|
| Pairs: success / success without test | 12 / 0 |
| Pairs: partial / failure | 17 / 337 |
| Candidate patches written / valid | 149 / 138 |
| Patches reaching the faulty transformation | 21 |
| Compilations / guest executions | 1,157 / 1,050 |
| Successful run, min / median / max (minutes) | 9 / 25 / 176 |
Table 7. RQ3: time per phase, from the activity records that the agent kept (23.8 hours in total).
| Phase | Hours | Share |
|---|---|---|
| Compiler pair | 11.4 | 48.0% |
| Project setup and baseline | 5.0 | 21.2% |
| Patch search | 2.7 | 11.3% |
| Reporting | 1.8 | 7.7% |
| Inputs, execution and replay | 1.6 | 6.5% |
| Bug analysis | 1.3 | 5.3% |
bug's reproducer into the guest. Such a patch would not survive review, so we count a patch only when it preserves the behaviour of the source and reads as a plausible change to the existing code.
The experiment was opportunistic. We ran the agent on one project at a time, one after the other, and each run could read the reports of the earlier runs. The agent chose which bugs to try on a project, wrote up to 10 patches per bug and, for each patch, searched for an input on which the buggy and the fixed build behave differently (Section 3.5). This gave the agent a lot of freedom in picking candidate bugs for each project and in how to exploit them.
Across the 20 projects, the agent chose to try 366 project-bug pairs, skipping the bugs it judged irrelevant to a project. Table 6 summarises the campaign. The agent found a successful patch for 12 pairs (3.3%), in 11 of the projects. A success is a valid patch for which the buggy build produces a different result from the fixed build on the same input, and the fixed build agrees with the unpatched guest. The successes come from only 5 bugs. L#219503 succeeded on seven projects, L#115149 on two, and L#114181, L#126012 and L#224832 on one each. Because each run could read the reports of the earlier ones, later runs may have favoured bugs that had already succeeded, which would explain part of this concentration. Another 17 pairs ended as partial. In these the agent wrote a valid patch that both compilers built, but the buggy compiler did not apply the faulty transformation to it. The remaining 337 pairs failed, either because the bug's compiler pair could not build the guest or because the agent found no valid patch. No pair ended as a success without test. Whenever a valid patch made the buggy compiler apply the faulty transformation, the agent also found an input on which the two builds differ. An author reviewed every success. The agent reported one more success, for ethrex with L#126012, which we rejected on review as a false positive (see below).
Most of the agent's time went into the compiler pair of each bug (Table 7). For each bug the agent provisioned the buggy and the fixed compiler, building them from one source revision with only the fix applied or reverted, and checked that both build the project's guest. This took 48.0% of the recorded time, setting up the project another 21.2%, and the search for patches only 11.3%. For the projects of RQ2 we could have shortened this step, since RQ2 already shows which compiler pairs build which guests, but in this experiment we wanted to give the agent full freedom.
Overview of successful patches. Table 8 lists the projects for which we managed to achieve a successful result, reporting the compiler component associated with the selected optimisation bug, a brief summary of the code change introduced by the patch, and the impact of the bug. The zk-img-editor project appears twice because we achieved two positive results for this project.
The four "Wrong output" results of Table 8 are cases where the guest built with the buggy compiler finishes normally and commits a wrong output. These are the most critical, because the zkVM would prove the wrong output. The patches lead to: an Ethereum client rejecting a valid block (ethrex), a bridge committing a validator bitmap with 8 of its bytes set to zero (sp1-blobstream), and an image editor committing incorrect pixel values (zk-img-editor). All four break soundness.
Table 8. RQ3: the 12 successes, grouped by what the guest built with the buggy compiler does. Component is the LLVM component that has the bug, and in every case the fixed build matches the unpatched guest.
| Project | Component | Code that the patch changes | Effect |
|---|---|---|---|
| The guest commits a wrong output (4) | |||
| zk-img-editor | InstCombine | Brightness filter on RGB pixels | Wrong output |
| zk-img-editor | InstCombine | Darkening filter, done in place | Wrong output |
| ethrex | InstCombine | Common prefix of two trie paths | Wrong output |
| sp1-blobstream | LoopLoadElim | Packing of the validator bitmap | Wrong output |
| The guest fails on a valid input (8) | |||
| garbled-snark-verifier | SCEV | Check of an instance's wire slots | Panic |
| alpen | IPSCCP | Merkle hashing of a checkpoint | Panic |
| grandine | IPSCCP | Merkle tree of the state transition | Panic |
| sp1-helios | IPSCCP | Hash of a beacon block header | Fault |
| tacit | IPSCCP | Hash of a beacon block header | Fault |
| ibc-contracts | IPSCCP | Merkle hash of a Tendermint header | Fault |
| dregg | IPSCCP | BLAKE3 hashing of four chunks | Fault |
| zkp_ecc | IPSCCP | Parser of a qubit operand | Fault |
For the Ethereum client and the bridge, the results could be catastrophic. The stakes of the image editor are low, since the bug only skips one darkening edit, but it shows what the proof gets wrong. zk-img-editor proves the provenance of an image: its proof says that the committed image is a photo signed by a camera, with exactly the listed edits applied. With the bug, the proof says that the photo was darkened when it was not, so a verifier accepts a false history for the image.
In the eight "Panic" and "Fault" cases, the buggy build panics or faults and commits nothing, so there is no wrong output to prove. An attacker can still use them, because they prevent a valid input from being proven. This breaks completeness, and with it the liveness of the application: a rollup or a bridge that cannot prove a valid input stops making progress, and for a blockchain liveness is one of the main properties. Seven of these cases come from one bug, L#219503, in which LLVM's interprocedural constant propagation drops the branch that ends a recursion. The agent used the same idea on seven projects. It specialised a recursive hash of a fixed number of fields or chunks, and the buggy compiler removed the check that stops the recursion.
Reasons for failure to produce patches. There are two causes for the 337 failures. In 117 cases the agent is not able to commence search because the compiler pair associated with the bug cannot build the project's guest. A typical reason for this is that the bug requires an older compiler than the project's dependencies accept, the same limit we met in RQ1 and RQ2. On hyli no compiler pair built the guest at all, and on citrea, grandine and agglayer only 3, 6 and 7 did. The compiler pair for bug L#220904 could not build the guest associated with any project, and for bug L#124387 only 6 projects could be built. In the other 220 failure cases the compilers worked, but the agent found no place in the guest where a plausible patch would produce the code needed to trigger the bug. The 17 partial outcomes are valid patches that built with both compilers, but the buggy compiler did not apply the faulty transformation to them. They come mostly from L#126012 (5 pairs) and L#219503 (4 pairs).
Examples. Below we show two of the successful patches. In the case of a successful patch, the agent also drafts the message for a pull request that would carry the patch, and we quote the message associated with each example. Recall that, as per the goal of the experiment, the agent was instructed to produce benign-looking patches together with convincing pull request messages. If an attacker were following this approach in earnest, they would likely go further and (a) provide some metrics for optimising patches to demonstrate their positive practical impact, and (b) work to hide the bug-triggering change inside a larger pull request to increase its chances of going unnoticed.
Example 1: An image filter (zk-img-editor, L#114181). This is the patch of our motivating example in Section 1. The guest applies a list of transformations to an image and commits the result. The patch in Listing 1 adds a fast path that brightens or darkens the image in place for small adjustments and leaves the other values to the library. For an adjustment of -128 the comparison is true and the request goes to the library, which darkens the image. The buggy compiler evaluates the comparison to false. The fast path then runs with a magnitude of zero and leaves the image as it was, and the guest commits pixels that were never darkened.
Example 2: An Ethereum client (ethrex, L#115149). In this project the guest executes a block against the state trie and commits whether the block is valid. Listing 2 changes the function that counts the common prefix of two trie paths. It checks the first three bytes through a helper and falls back to the old comparison otherwise. The helper walks a small array with a raw pointer until it reaches a zero byte. The buggy compiler wrongly marks the pointer step in the loop as in bounds and so drops the store of the array's first byte. The helper then reads a byte that was never written, and the prefix comes out wrong. With the fixed compiler, the patched guest accepts a valid block from Ethereum's test suite, as the unpatched guest does. With the buggy compiler, it commits that the block failed validation. The other 42 bytes of its output are the same, and both executions exit normally.
Plausibility of the patches. The two patches have a few things in common. They are small: they add 33 and 44 lines, each in one function and one helper. Each has a comment that gives a reason for performing this change that could convince a maintainer it is a useful change, such as avoiding a copy or skipping a bounds check. Each keeps the old code as the fallback for the inputs it does not handle, which makes the change look like a careful optimisation. The messages read like ordinary pull requests, with a summary, details of the cases that still take the old path, and the tests that were run. Those tests pass, because the source is correct and either the tests do not handle the cases where the output would be different, or a non-buggy compiler is used.
A careful reviewer could still object, especially if the change is proposed by a random developer, or if it comes without benchmarks demonstrating optimisation gains. With more instructions and a higher budget, an agent could likely make the patches even more realistic and accompany them with clear benchmarks showing performance gains. The guard of Listing 1 tests a range through a negation where two comparisons would do, and Listing 2 needs unsafe for three bytes. These are mainly objections of style. They would not lead the reviewer to suspect that there may be a problem with the compiler, because nothing in the source is wrong.
In one instance, it was clear to us upon examining a success case that a reviewer would be likely to reject it. For ethrex with L#126012, the agent rewrote the encoder of the guest's public output as a small state machine with a lagging index, and the buggy build panicked on a valid input. After reviewing the patch, we observed that the state machine copies the structure of the bug's reproducer, and no reason is given for this change; a direct pass over the fields would achieve equivalent results in a simpler way. The patch also collects all fields in a vector and then copies them into a second one, which is not an improvement over the original code.
Exploiting the guest. Exploiting a guest program after a malicious patch has been accepted may not be trivial, and of course depends on the use of a compiler that is still prone to the bug in question. However, we have noticed that zkVM projects and the zkVMs themselves update their compilation pipeline only infrequently. Hence, an attacker could identify a bug in a compiler version the zkVM has not yet adopted, get the patch merged, and exploit it once the toolchain is updated.
Cost of the search. The search we perform is cheap (Table 9), thus we expect a powerful attacker who invests significant resources would get substantially better results. Over the 20 projects, the
Listing 2. Patch for ethrex that exposes LLVM L#115149.
fn count_common_prefix_scalar(a: &u8), b: &u8) -> useize { length of the common prefix of two paths let n = a.len().min(b.len()); length of the shorter path // Most trie paths share a short initial run. Check three nibbles together before the comparison. if n >= 3 && a[0] == b[0] { three nibbles, and the first matches let threshold = a[0].wrapping_add(1); one above the first nibble if threshold != 0 && threshold != u8::MAX { avoid overflow in the next lines let first_matches = a[1] == b[1]; do the second nibbles match? let first = threshold + u8::from(!first_matches); code: threshold, or one more on a mismatch let second = threshold + u8::from(a[2] != b[2]); same for the third nibbles let skip_first = if first_matches { 0 } else { -1 }; skip a code that matched if short_prefix_matches(first, second, threshold, skip_first) { second and third match? return 3 + a[3..n].iter().zip(b[3..n].iter()) count the rest .take_while(|(x, y)| x == y).count(); } } } a.iter().zip(b.iter().take_while(|(x, y)| x == y).count() old comparison, the fallback } ++// A zero terminator lets the short common-prefix test stop without a second bounds branch. +#[inline(never)] keep the helper a separate function +fn short_prefix_matches(first: u8, second: u8, threshold: u8, skip_first: i8) -> bool { if !(-1..0).contains(&skip_first) || first == 0 || second == 0 { reject bad arguments return false; } let remaining = [first, second, 0]; codes, ended by a zero; the bug drops the store of first let start = (i32::from(skip_first) + 1) as isize; 1 if the second nibbles matched, else 0 let mut cursor = unsafe { remaining.as_ptr().offset(start) }; first code to read loop { let code = unsafe { *cursor }; read a code if code == 0 { return true; } end reached, all matched if code > threshold { return false; } a mismatch cursor = unsafe { cursor.add(1) }; the bug marks this step as in bounds } }
Pull-request message drafted by the agent for Listing 2 (abridged)
Add a bounded three-nibble fast path to trie prefix counting. Specialize count_common_prefix_scalar for trie paths that share at least three initial nibbles. The new path checks the first three bytes, then resumes the existing iterator comparison on the suffix when all three match. Short paths, first-byte mismatches, and threshold overflow cases continue through the original comparison.
The helper's three-byte array is fully initialized, and its signed start is checked before pointer use. Under correct compilation it returns true exactly when the two remaining prefix bytes match, so the returned prefix length is unchanged. No validation rule or guest output format changes. [...]
median project used 157 million tokens and 2.5 hours of agent time, which costs about 76, and the 20 projects together cost about $803. Cached input makes up 98.2% of all tokens. Successful runs took 9 minutes to 2.9 hours, with a median of 25 minutes.
Finding 4 (RQ3). A cheap agent can write plausible patches that expose known compiler bugs. The agent found such a patch for 12 out of 366 (project, bug) pairs, in 11 of 20 SP1 projects. In 4 of the 12 cases this leads to the guest committing a wrong output, including a case where an Ethereum client rejects a valid block. In the other 8 the guest fails on a valid input. The patches were generally well motivated, with convincing pull request messages.
Table 9. RQ3: time, tokens and estimated cost per project, over the 20 projects. Time is the time during which at least one agent of the project was active. Tokens are in millions. Cost uses the list API prices of gpt-6-sol: 0.20 and $10.00 per million uncached input, cached input and output tokens.
| Min | Median | Mean | Max | Total | |
|---|---|---|---|---|---|
| Time (hours) | 0.30 | 2.52 | 2.52 | 5.57 | 50.3 |
| Uncached input tokens | 0.23 | 2.33 | 2.33 | 4.50 | 46.6 |
| Cached input tokens | 5.58 | 154.43 | 154.67 | 289.51 | 3,093.3 |
| Output tokens | 0.05 | 0.46 | 0.46 | 0.91 | 9.1 |
| All tokens | 5.86 | 157.45 | 157.45 | 294.93 | 3,149.0 |
| Cost (USD) | 2.05 | 40.15 | 40.15 | 75.97 | 802.9 |
5 Discussion
5.1 Why existing guests rarely trigger a bug
A miscompilation is triggered only by code that follows a specific pattern. The faulty optimisation must be reached, typically in a specific order, and its wrong result must then reach a value that the program commits. The reproducers of RQ1 are written to have that structure by definition (their raison d'être is to expose their associated miscompilation bug), but the guests of RQ2 mostly do not, so in 94% of the pairs that built, the fix has no effect on the binary that is produced. The zkVM's target further narrows the bugs that can affect a guest. Ten of the 15 LLVM bugs whose reproducers gave byte-identical builds in RQ1 need a feature that the zkVM's target lacks, such as x86 code generation or the Zbb extension of RISC-V.
When a fix does change a guest, the change is usually broader than the bug. Both LLVM fixes behind the 24 differing LLVM pairs of RQ2 disable a transformation for a broad class of code patterns, with only a subset of such patterns actually being miscompiled. A binary difference thus provides weak evidence of a miscompilation. Marcozzi et al. [2019] made the same observation for Clang, where many fixes changed the binaries of Debian packages without changing their behaviour.
5.2 Implications
Security of zkVMs and formal verification. A zkVM proof says only that a binary ran correctly on some inputs; anyone who relies on it is implicitly trusting that the binary conforms to its source. The trusted base of a zkVM application therefore covers the proof system and its verifier, the zkVM's circuits, the guest's source and dependencies, and the toolchain that turns the source into the binary. Most security work on zero-knowledge systems studies the first three [Chaliasos et al. 2024a; Kolozyan et al. 2026a; Wen et al. 2024a; Yang et al. 2026]. Our results show that the toolchain also deserves scrutiny: more than half of the LLVM bugs that we reproduced from Rust carry over to each zkVM, so a miscompilation can yield a valid proof of a result that the source program should not compute. Much effort is being invested into verifying zkVMs, including an Ethereum Foundation initiative [Ethereum Foundation 0000], but a fully verified zkVM still proves exactly the binary it is given, miscompiled or not. Formal verification of the guest's source does not help either, because every malicious patch in RQ3 preserves the behaviour of the source code.
The ideal solution would be a verified compiler such as CompCert [Leroy 2009], but four things make this hard for zkVM guests. First, no verified compiler covers Rust, which has no complete formal semantics yet. Second, guests depend on many crates, including cryptographic libraries with unsafe code and the zkVM's own crates, all of which would have to go through the verified compiler. Third, proof cost grows with the number of instructions executed, so projects depend on LLVM's optimisations, which is where most of our bugs sit (Section 4.1) and where verified compilers lag; a low optimisation level would make proofs infeasibly expensive. Fourth, each zkVM has its own target and often its own toolchain fork, so each would need its own verified backend. A lighter option is translation validation, which checks a single compilation rather than the whole compiler [Pnueli et al. 1998]; a zkVM guest is one fixed, rarely rebuilt binary, which makes it a good candidate.
zkVM developers. As discussed above, a zkVM's toolchain is part of the trusted base of the applications that are built on it. For example, the official SP1 v4 toolchain ships LLVM 19.1.1 without the fix for issue L#114181, which miscompiles the patch in Listing 1 on SP1's target. To defend against miscompilation-based attacks, zkVM teams can track the known miscompilations in the rustc and LLVM versions that they ship, backport the fixes that matter for their target, and publish which known bugs each toolchain version contains.
zkVM guest program maintainers. A pull request that looks like an ordinary optimisation can introduce code designed to trigger a miscompilation (RQ3). Because the modified source is still correct, this is likely to evade source code review. As long as the project's tests do not reach the affected input, or are currently run with a compiler that does not have the bug, the malicious nature of the change will not be caught by testing either. Two checks can help here. The first is to build each change with multiple compilers: the compiler associated with the pinned toolchain, and one or more compilers that incorporate fixes for recent miscompilation bugs. Most fixes leave a guest byte-identical (RQ2), so this will rarely raise an alarm, and when an alarm does occur it will point the reviewer to the source code whose associated binary representation has changed. The second is to look for unusual code patterns in a contribution, but legitimate aggressive optimisations can feature unusual code patterns, making the actions of a careful attacker hard to detect.
The cost of an attack. RQ3 shows that an optimisation that preserves the behaviour of the source and triggers a known miscompilation is not hard to find. The hard part for an attacker is to build enough reputation that an important project accepts its contributions. The attackers described in Section 2.3 prepare a single attack for weeks or years, and such an attacker is likely to do better than our 12 successes in 366 pairs.
6 Threats to Validity
We follow a standard methodology [Feldt and Magazinius 2010] to identify validity threats, mitigating them where possible.
Internal Validity. A divergence that we attribute to a bug may have another cause. The two compilers of a pair are built from the same rustc and LLVM revision and differ only in the fix; we exclude a bug when no such pair exists. For 36 of the 60 LLVM bugs the buggy compiler is a recent compiler with the fix undone (35 on the common LLVM 23.1.1 base of Section 4.1 and L#178245 on a rustc 1.95 nightly), sometimes with the patch adapted to the revision, so the pair may behave differently from the compiler that first had the bug. We check each pair on the bug's reproducer, where the fixed compiler must produce the expected output, and in RQ3 the patched guest built with the fixed compiler must agree with the unpatched guest. The agent that wrote the Rust reproducers was told to trigger the given LLVM bug and no other, keeping the inputs and expected outputs of the LLVM reproducer where possible; we checked five reproducers by hand against the original bug, and all five matched. LLM agents can report outcomes they did not reach. We keep an LLVM reproducer only when we can replay the claimed divergence ourselves, and an RQ3 success must repeat from a clean state; an author checked each success and rejected one. The agent could see earlier runs, which may explain why 7 of its 12 successes use L#219503. This affects how the successes spread over the bugs, not the effectiveness or credibility of any individual patch. For the 96 RQ2 pairs whose code differs, we ran between 1 and 83 inputs per guest without fuzzing, so we may have missed a divergence. The 447 byte-identical pairs and the 9 that differ only in layout are unaffected, since no input can show a difference there.
External Validity. Our bugs may not represent all mis compilations that affect Rust. The LLVM bugs come from fixes that landed between July 2024 and September 2026, and only the 60 of 124 candidates for which an agent found a Rust reproducer were tested; the rustc bugs leave out those with only a MIR reproducer. For 49 LLVM bugs the pair is built on one recent rustc, so the results show that Rust code can trigger a bug on a zkVM target, not which bugs a zkVM release ships. SP1 and Jolt are both RISC-V machines, and we run RQ2 and RQ3 on SP1 only. The two agree in RQ1, which suggests that the target matters more than the zkVM, but a zkVM with another instruction set may differ. Our projects are popular open-source projects tested at one revision, excluding those that need infrastructure we could not provide, such as Optimism. The RQ3 results hold for one model, one set of instructions and a few hours per project. A success shows that a patch exists, but the success rate says little about how a more powerful attacker would perform.
Construct Validity. We did not generate proofs. A zkVM proves the execution that its executor performs, so the output the executor commits is the output a proof would attest to; in early experiments we did produce proofs, and they followed the executor every time. We dropped them when scaling up our study because they are so expensive to produce. We checked that each successful patch preserves the behaviour of the source via tests and manual review, and judged its plausibility ourselves; that judgement rejected one patch, and a maintainer might reject others. For ethical reasons we did not submit any patches, so RQ3 measures whether such a patch can be found, not how often one would be merged in practice. Last, the costs we report are what our tokens would cost through the API, not what we paid (Section 3.6).
7 Related Work
Compiler bugs and their impact. There is a long line of work on finding compiler bugs. Csmith [Yang et al. 2011] and Rustlantis [Wang and Jung 2024] generate programs that find bugs in C compilers and in rustc, and Chen et al. [2020] survey compiler testing techniques. Sun et al. [2016] study the bugs of GCC and LLVM, Liu et al. [2025] those of rustc, and Zhong [2025] how developers work around compiler bugs. Closest to our work, Marcozzi et al. [2019] measured how fuzzer-found Clang and LLVM bugs affect Debian packages and found the impact rare. Our RQ2 asks the same question of zkVM guests, where one miscompilation yields a valid proof of a wrong result, and our RQ3 asks what an attacker can do when the code is not fixed in advance. Gassmann et al. [2026] study how compiler optimisations change the performance of zkVM guests. We study how compiler bugs change their correctness.
Security of ZKPs. Prior work has studied vulnerabilities across the SNARK stack [Chaliasos et al. 2024a], surveyed zkVM designs [Yang et al. 2026], and discussed what can go wrong in a zkVM [Gong 2024]. Most tools target hand-written circuits [Kolozyan et al. 2026a]. They find under-constrained circuits by static analysis and SMT solving [Kolozyan et al. 2026b; Pailoor et al. 2023; Wen et al. 2024b], certify circuits with refinement types [Liu et al. 2024], and fuzz circuits [Chaliasos et al. 2025; Takahashi et al. 2026], and Kolozyan et al. [2026a] evaluate these tools and survey their use. Closer to us, MTZK [Xiao et al. 2025] and Circuzz [Hochrainer et al. 2025] test the compilers that turn circuit languages into constraints, and Arguzz [Hochrainer et al. 2026] and Peng et al. [2025] test zkVMs and zkEVMs for soundness and completeness bugs. All of these look for bugs in the circuit or in the zkVM. We assume both are correct and study the compiler that builds the guest.
Malicious contributions. The xz backdoor [National Vulnerability Database 2024] showed that an attacker can spend years building trust in an open-source project before inserting malicious code, and the hypocrite-commits study [Wu and Lu 2021] reported that patches with hidden vulnerabilities can pass maintainer review. In both cases the malicious behaviour is in the source. In ours the source is correct, and the behaviour appears only after compilation.
8 Conclusion
We presented the first empirical study of whether known miscompilations undermine the guarantees of zkVMs. We collected 88 rustc and LLVM miscompilations with Rust reproducers, using an LLM agent to reproduce 60 of 124 LLVM bugs from Rust. More than half of them carry over to zkVMs: 48 reproduce on SP1 and 46 on Jolt, and in each case the zkVM would prove a wrong output. Popular guests are rarely affected by accident. In 447 of the 552 pairs of a guest and a bug that built, the buggy and the fixed compiler produced byte-identical guests, and the other 105 pairs differ only in layout or agreed on every input we ran. However, an attacker can add such code on purpose. For about $40 per project, an LLM agent wrote patches that look like ordinary optimisations and expose a known bug in 12 of 366 pairs, across 11 of 20 SP1 projects. In 4 of them the guest commits a wrong output, among them an Ethereum client that rejects a valid block, and in the other 8 it fails on a valid input.
A zkVM proof covers the binary that the compiler produced, so a compiler bug is invisible to anyone who verifies the zkVM or reviews the guest's source. Projects should treat their toolchain as part of the trusted base and track the known bugs it contains. Maintainers should also review outside contributions with this in mind, since a change that preserves the behaviour of the source can still trigger a compiler bug.
References
a16z Crypto. n.d.. Architecture overview. https://jolt.a16zcrypto.com/how/architecture/architecture.html Accessed: 28 May 2026.
Argument Computer Corporation. 2024. RISC-V ZKVMs: the Good and the Bad. https://argument.xyz/blog/riscv-good-bad Accessed: 13 October 2026.
Arasu Arun, Srinath T. V. Setty, and Justin Thaler. 2024. Jolt: SNARKs for Virtual Machines via Lookups. In Advances in Cryptology - EUROCRYPT 2024 - 43rd Annual International Conference on the Theory and Applications of Cryptographic Techniques, Zurich, Switzerland, May 26-30, 2024, Proceedings, Part VI (Lecture Notes in Computer Science, Vol. 14656), Marc Joye and Gregor Leander (Eds.). Springer, 3–33. doi:10.1007/978-3-031-58751-1_1
Ryan Babbush, Adam Zalcman, Craig Gidney, Michael Broughton, Tanuj Khattar, Hartmut Neven, Thiago Bergamaschi, Justin Drake, and Dan Boneh. 2026. Securing Elliptic Curve Cryptocurrencies against Quantum Vulnerabilities: Resource Estimates and Mitigations. IACR Cryptol. ePrint Arch. 2026 (2026), 625. https://eprint.iacr.org/2026/625
Eli Ben-Sasson, Alessandro Chiesa, Eran Tromer, and Madars Virza. 2014. Succinct Non-Interactive Zero Knowledge for a von Neumann Architecture. In Proceedings of the 23rd USENIX Security Symposium, San Diego, CA, USA, August 20-22, 2014, Kevin Fu and Jaeyeon Jung (Eds.). USENIX Association, 781–796. https://www.usenix.org/conference/usenixsecurity14/technical-sessions/presentation/ben-sasson
Stefanos Chaliasos, Imam Al-Fath, and Alastair Donaldson. 2025. Towards Fuzzing Zero-Knowledge Proof Circuits (Short Paper). In Proceedings of the 34th ACM SIGSOFT International Symposium on Software Testing and Analysis (Clarion Hotel Trondheim, Trondheim, Norway) (ISSTA Companion '25). Association for Computing Machinery, New York, NY, USA, 98–104. doi:10.1145/3713081.3731718
Stefanos Chaliasos, Jens Ernstberger, David Theodore, David Wong, Mohammad Jahanara, and Benjamin Livshits. 2024a. SoK: What don't we know? Understanding Security Vulnerabilities in SNARKs. In 33rd USENIX Security Symposium, USENIX Security 2024, Philadelphia, PA, USA, August 14-16, 2024. Davide Balzarotti and Wenyuan Xu (Eds.). USENIX Association. https://www.usenix.org/conference/usenixsecurity24/presentation/chaliasos
Stefanos Chaliasos, Itamar Reif, Adrià Torralba-Agell, Jens Ernstberger, Assimakis Kattis, and Benjamin Livshits. 2024b. Analyzing and Benchmarking ZK-Rollups. In 6th Conference on Advances in Financial Technologies (AFT 2024) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 316), Rainer Böhme and Lucianna Kiffer (Eds.). Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl, Germany, 6:1–6:24. doi:10.4230/LIPIcs.AFT.2024.6
Proving the Wrong Program: Miscompliances as a Threat to zkVM Guarantees
25
Junjie Chen, Jibesh Patra, Michael Pradel, Yingfei Xiong, Hongyu Zhang, Dan Hao, and Lu Zhang. 2020. A Survey of Compiler Testing. ACM Comput. Surv. 53, 1, Article 4 (Feb. 2020), 36 pages. doi:10.1145/3363562
Rust compiler team. n.d.. Overview of the compiler. https://rustc-dev-guide.rust-lang.org/overview.html Accessed: 28 May 2026.
Jens Ernstberger, Stefanos Chialios, Liyi Zhou, Philipp Jovanovic, and Arthur Gervais. 2024. Do You Need a Zero Knowledge Proof? IACR Cryptol. ePrint Arch. 2024 (2024), 50. https://eprint.iacr.org/2024/050
Ethereum Foundation. [n.d.]. Formal verification for zkEVMs. https://verified-zkevm.org/ Accessed: 13 October 2026.
Robert Feldt and Ana Magazinius. 2010. Validity Threats in Empirical Software Engineering Research - An Initial Survey. In Proceedings of the 22nd International Conference on Software Engineering & Knowledge Engineering (SEKE'2010), Redwood City, San Francisco Bay, CA, USA, July 1 - July 3, 2010. Knowledge Systems Institute Graduate School, 374–379.
Thomas Gassmann, Stefanos Chialios, Thodoris Sotiropoulos, and Zhendong Su. 2026. Evaluating Compiler Optimization Impacts on zkVM Performance. In Proceedings of the 31st ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 2. ACM, 697–714. doi:10.1145/3779212.3790159
Shafi Goldwasser, Silvio Micali, and Charles Rackoff. 1985. The Knowledge Complexity of Interactive Proof-Systems (Extended Abstract). In Proceedings of the 17th Annual ACM Symposium on Theory of Computing, May 6-8, 1985, Providence, Rhode Island, USA, Robert Sedgewick (Ed.). ACM, 291–304. doi:10.1145/22145.22178
Suneal Gong. 2024. zkVM Security: What Could Go Wrong? https://blog.zksecurity.xyz/posts/zkvm-security Accessed: 28 May 2026.
Christoph Hochrainer, Anastasia Isychev, Valentin Wüstholz, and Maria Christakis. 2025. Fuzzing Processing Pipelines for Zero-Knowledge Circuits. In Proceedings of the 2025 ACM SIGSAC Conference on Computer and Communications Security, CCS 2025. ACM, 783–797.
Christoph Hochrainer, Valentin Wüstholz, and Maria Christakis. 2026. Arguzz: Testing zkVMs for Soundness and Completeness Bugs. In 35th USENIX Security Symposium, USENIX Security 2026. USENIX Association, 1807–1826. https://www.usenix.org/conference/usenixsecurity26/presentation/hochrainer
Sergei Iakovenko. 2026. Git commit 58bf73a: fix!: small subgroup ipa bug. https://github.com/AztecProtocol/aztec-packages/commit/58bf73a289f7da78c8920e9c73604a8e5d105025 Accessed: 13 October 2026.
Arman Kolozyan, Tom Sorger, Alexander Hicks, and Stefanos Chialios. 2026a. ZKP Security Tools and Verification: Coverage, Effectiveness, Adoption, and Challenges. CoRR abs/2607.23752 (2026). arXiv:2607.23752 doi:10.48550/ARXIV.2607.23752
Arman Kolozyan, Bram Vandenbogaerde, Janwillem Swalens, Lode Hoste, Stefanos Chialios, and Coen De Roover. 2026b. Language-Agnostic Detection of Computation-Constraint Inconsistencies in ZKP Programs Via Value Inference. In IEEE Symposium on Security and Privacy, SP 2026, San Francisco, CA, USA, May 18-21, 2026. IEEE, 3091–3110. doi:10.1109/SP63933.2026.00207
Ryan Lavin, Xuekai Liu, Hardikh Mohanty, Logan Norman, GiovanniZAarour, and Bhaskar Krishnamachari. 2024. A Survey on the Applications of Zero-Knowledge Proofs. CoRR abs/2408.00243 (2024). arXiv:2408.00243 doi:10.48550/ARXIV.2408.00243
Xavier Leroy. 2009. Formal verification of a realistic compiler. Commun. ACM 52, 7 (2009), 107–115. doi:10.1145/1538788.1538814
Junrui Liu, Ian Kretz, Hanzhi Liu, Bryan Tan, Jonathan Wang, Yi Sun, Luke Pearson, Anders Miltner, Isil Dillig, and Yu Feng. 2024. Certifying Zero-Knowledge Circuits with Refinement Types. In IEEE Symposium on Security and Privacy, SP 2024. IEEE, 1741–1759.
Zixi Liu, Yang Feng, Yunbo Ni, Shaohua Li, Xizhe Yin, Qingkai Shi, Baowen Xu, and Zhendong Su. 2025. An Empirical Study of Bugs in the rustc Compiler. Proc. ACM Program. Lang. 9, OOPSLA2 (2025), 3869–3896. doi:10.1145/3763800
Michael Marcozzi, Qiyi Tang, Alastair F. Donaldson, and Cristian Cadar. 2019. Compiler fuzzing: how much does it matter? Proc. ACM Program. Lang. 3, OOPSLA (2019), 155:1–155:29. doi:10.1145/3360581
National Vulnerability Database. 2024. CVE-2024-3094: Malicious code in the xz upstream tarballs. https://nvd.nist.gov/vuln/detail/CVE-2024-3094.
Shankara Pailoor, Yanju Chen, Franklyn Wang, Clara Rodriguez-Núñez, Jacob Van Geffen, Jason Morton, Michael Chu, Brian Gu, Yu Feng, and Isil Dillig. 2023. Automated Detection of Under-Constrained Circuits in Zero-Knowledge Proofs. Proc. ACM Program. Lang. 7, PLDI (2023), 1510–1532.
Payy. 2026. Payy USDC withdrawal exploit–postmortem. https://polybase.notion.site/Payy-USDC-withdrawal-exploit-postmortem-v4-final-3ea822fadf1e8097abb4dae2bc3c18cf Accessed: 13 October 2026.
Xinghao Peng, Zhiyuan Sun, Kunsong Zhao, Zuchao Ma, Zihao Li, Jinan Jiang, Xiapu Luo, and Yingqian Zhang. 2025. Automated Soundness and Completeness Vetting of Polygon zkEVM. In 34th USENIX Security Symposium, USENIX Security 2025. USENIX Association, 4093–4108.
Amir Pnueli, Michael Siegel, and Eli Singerman. 1998. Translation Validation. In Tools and Algorithms for Construction and Analysis of Systems, 4th International Conference, TACAS '98, Held as Part of the European Joint Conferences on the Theory and Practice of Software, ETAPS'98, Lisbon, Portugal, March 28 - April 4, 1998, Proceedings (Lecture Notes in Computer
Science, Vol. 1384), Bernhard Steffen (Ed.). Springer, 151–166. doi:10.1007/BFB0054170
Succinct. n.d.a. SP1: Introduction. https://docs.succinct.xyz/docs/sp1/introduction Accessed: 13 October 2026.
Succinct. n.d.b. What is a zkVM? https://docs.succinct.xyz/docs/sp1/what-is-a-zkvm Accessed: 13 October 2026.
Chengnian Sun, Vu Le, Qirun Zhang, and Zhendong Su. 2016. Toward understanding compiler bugs in GCC and LLVM. In Proceedings of the 25th International Symposium on Software Testing and Analysis (Saarbrücken, Germany) (ISSTA 2016). Association for Computing Machinery, New York, NY, USA, 294–305. doi:10.1145/2931037.2931074
Hideaki Takahashi, Jihwan Kim, Suman Jana, and Junfeng Yang. 2026. zkFuzz: Foundation and Framework for Effective Fuzzing of Zero-Knowledge Circuits. In 2026 IEEE Symposium on Security and Privacy (SP). IEEE Computer Society, 3055–3074.
Justin Thaler. 2025. The Path to Secure and Efficient zkVMs: How to Track Progress. https://a16zcrypto.com/posts/article/secure-efficient-zkvmss-progress/ Accessed: 13 October 2026.
Unchained. 2026. Payy Rules Out a Compromised Key in $1.92 Million Drain of Users' Deposits. https://unchainedcrypto.com/payy-rules-out-a-compromised-key-in-1-92-million-drain-of-users-deposits/ Accessed: 13 October 2026.
Qian Wang and Ralf Jung. 2024. Rustlantis: Randomized Differential Testing of the Rust Compiler. Proc. ACM Program. Lang. 8, OOPSLA2 (2024), 1955–1981. doi:10.1145/3689780
Hongbo Wen, Jon Stephens, Yanju Chen, Kostas Ferles, Shankara Pailoor, Kyle Charbonnet, Isil Dillig, and Yu Feng. 2024a. Practical Security Analysis of Zero-Knowledge Proof Circuits. In 33rd USENIX Security Symposium, USENIX Security 2024, Philadelphia, PA, USA, August 14-16, 2024, Davide Balzarotti and Wenyuan Xu (Eds.). USENIX Association. https://www.usenix.org/conference/usenixsecurity24/presentation/wen
Hongbo Wen, Jon Stephens, Yanju Chen, Kostas Ferles, Shankara Pailoor, Kyle Charbonnet, Isil Dillig, and Yu Feng. 2024b. Practical Security Analysis of Zero-Knowledge Proof Circuits. In 33rd USENIX Security Symposium, USENIX Security 2024. USENIX Association.
Qiushi Wu and Kangjie Lu. 2021. On the Feasibility of Stealthily Introducing Vulnerabilities in Open-Source Software via Hypocrite Commits. https://raw.githubسورcontent.com/QiushiWu/QiushiWu.github.io/main/papers/OpenSourceInsecurity.pdf Paper withdrawn from the IEEE Symposium on Security and Privacy 2021.
Dongwei Xiao, Zhibo Liu, Yiteng Peng, and Shuai Wang. 2025. MTZK: Testing and Exploring Bugs in Zero-Knowledge (ZK) Compilers. In 32nd Annual Network and Distributed System Security Symposium, NDSS 2025. The Internet Society.
Tiancheng Xie, Jiaheng Zhang, Zerui Cheng, Fan Zhang, Yupeng Zhang, Yongzheng Jia, Dan Boneh, and Dawn Song. 2022. zkBridge: Trustless Cross-chain Bridges Made Practical. In Proceedings of the 2022 ACM SIGSAC Conference on Computer and Communications Security, CCS 2022, Los Angeles, CA, USA, November 7-11, 2022, Heng Yin, Angelos Stavrou, Cas Cremers, and Elaine Shi (Eds.). ACM, 3003–3017. doi:10.1145/3548606.3560652
Guomin Yang, Yunbo Yang, Yuejia Cheng, Haibo Tang, Bingsheng Zhang, and Kui Ren. 2026. SoK: Understanding zkVM: From Research to Practice. In Proceedings of the ACM Asia Conference on Computer and Communications Security, ASIA CCS 2026, Bangalore, India, June 1-5, 2026, Manindra Agrawal, Ian Molloy, Vinayaka Pandit, Debdeep Mukhopadhyay, and Kenny Paterson (Eds.). ACM, 852–868. doi:10.1145/3779208.3805964
Xuejun Yang, Yang Chen, Eric Eide, and John Regehr. 2011. Finding and understanding bugs in C compilers. In Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation (San Jose, California, USA) (PLDI '11). Association for Computing Machinery, New York, NY, USA, 283–294. doi:10.1145/1993498.1993532
Hao Zhong. 2025. Understanding Compiler Bugs in Real Development. In 2025 IEEE/ACM 47th International Conference on Software Engineering (ICSE). 2368–2379. doi:10.1109/ICSE55347.2025.00068
A Survey of Projects with zkVM Guest Programs
This appendix describes how we built the list of projects that Section 3.2 uses.
Search. We searched GitHub for Cargo. tom1 files that depend on the guest or SDK crate of a zkVM, and collected the repositories that GitHub lists as dependents of these crates. The two steps gave 2,588 repositories, or 2,440 without forks. Two of the crate names also belong to unrelated projects, and after checking each such dependency we kept 2,416 repositories. To find the guest programs, we searched each repository for the zkVM's entry-point macro, and relied on the layout of the repository when a guest has no such macro.
Classification. We classified only the repositories that have at least 5 stars, or belong to an organisation and received a push since January 2025. The others, mostly small personal repositories, are unclassified. We labelled each of the selected repositories from its description and the matched files, and read the repository itself when these were not enough. We identified and removed 34 repositories that were unrelated. We used four labels, as follows. Production projects are deployed

Fig. 3. Open-source projects with zkVM guest programs, for the seven zkVMs with the most projects (September 2026; 2,430 projects in total). A project that targets several zkVMs counts once for each.
on a blockchain or usable without modifications. Work-in-progress projects are incomplete and couldn't be easily used. Benchmarks contain benchmark payloads and comparisons between zkVMs. Tutorials show how to use a zkVM, and include examples and templates. The final list has 2,430 projects, of which 266 are classified as production and 163 target more than one zkVM.
B Instructions Given to the LLVM-to-Rust Agent
We ran the LLVM-to-Rust agent in Codex with gpt-5.6-sol at high reasoning effort, once per LLVM bug and for at most four hours (Section 3.1). Each run received a short launch prompt, which names the LLVM issue and points the agent to a protocol file in its workspace. Listings 3 and 4 give both in condensed form. We keep the original wording, and [...] marks text that we cut. The cut text covers build parallelism, the timing of commands, the recording of notes, the layout of the saved files and the handling of retries. We print the two tables of the protocol as lists. The protocol defines eight outcomes, and every run ended in one of the first four, which are the outcomes of Table 2. We keep only the bugs whose outcome is rust-runtime-confirmed. The complete files are part of our artifact.
Listing 3. Launch prompt of an LLVM-to-Rust run (condensed).
Investigate LLVM issue <issue> and attempt a valid Rust reproducer of that known mis compilation.
Read protocol/experiment.md, protocol/result.schema.json, cases/<issue>/manifest.json, cases/<issue>/progress.json, and cases/<issue>/history.jsonl. The protocol contains the complete operating instructions, evidence requirements, outcome definitions, and output layout. [...] Attempt the complete protocol in order, including compiler provisioning when required, until the evidence gate or budget prevents progress.
[...]
Keep the Rust source revision constant when varying the known LLVM fix. [...] Compiler builds must use the selected LLVM source rather than downloaded LLVM or rustc. [...] Confirm semantic/behavioral LLVM failure before Rust searches. [...]
Use ordinary compilation for final acceptance. Prefer safe Rust and explicit arithmetic semantics. Check expected outputs independently, outside compiled candidate assertions. A matched instruction or changed assembly is insufficient. Screen generated candidates for the required IR/assembly properties, then carry promising candidates through source-validity checks, an independent oracle, buggy/fixed execution with unoptimised controls, and fresh replay in this same attempt. [...] do not report runtime confirmation without completed end-to-end evidence.
[...]
Listing 4. Protocol followed by the LLVM-to-Rust agent (condensed).
| LLVM-to-Rust investigation protocol | |
|---|---|
| [... ] | |
| Workflow and evidence gates | |
| normalize: | Join the candidate CSV, index, archived reports, patches, and all reproducers |
| source-selection: | Find the introduction/fix history and compatible Rust/LLVM revisions |
| llvm-baseline: | Run the original LLVM case with and without its fix |
| toolchains: | Build the controlled rustc pair and compatible libraries |
| rust-search: | Search for valid Rust that naturally produces the necessary structure |
| oracle: | Establish expected behavior independently |
| comparison: | Compare reference and buggy/fixed compilations at the same settings |
| replay: | Minimise and repeat a successful experiment independently |
| [... ] Prefer a naturally affected LLVM baseline plus the fix. If compatibility requires removing a fix from a newer revision, label the pair as reconstructed; this does not establish that a released Rust compiler was affected. Hold bootstrap, dependencies, target, configuration, and Rust source constant across the pair. [... ] | |
| [... ] Do not manually add LLVM IR or metadata to the final Rust program. Disabling passes or using debug counters is diagnostic evidence and must be classified separately. A changed IR or assembly file alone does not demonstrate incorrect behavior. | |
| [... ] | |
| For every candidate, define the input domain and a reference with explicit bit widths. Check overflow, shifts, initialization, pointer validity, aliasing, and intrinsic preconditions; justify any unsafe Rust. Miri supplies evidence for tested executions, not universal validity. [... ] | |
| The comparison must show the independent expected result, buggy and fixed outputs at the same relevant settings, and unoptimized controls for both builds. [... ] Attribute the failure to the known LLVM fix. Record any different defect separately. Minimize a successful Rust program and input, then replay from saved artifacts in a fresh process. | |
| [... ] | |
| Checkpoints and classifications | |
| [... ] At the end of every attempt, report the strongest justified outcome: | |
| rust-runtime-confirmed: | Valid Rust returns an incorrect result under ordinary compilation, the known LLVM fix restores the independent expected result, and a fresh replay confirms it |
| rust-ir-confirmed: | Valid Rust reaches the relevant defective IR transformation, but runtime evidence is incomplete |
| diagnostic-only: | Evidence depends on a modified pipeline, debug counter, or other diagnostic option |
| llvm-only-confirmed: | The original LLVM defect is confirmed; a Rust reproduction remains unresolved |
| toolchain-blocked: | The required compatible compiler combination could not be constructed |
| invalid-candidate: | The candidate violates source-language requirements |
| budget-exhausted: | The search budget ended without sufficient evidence for a stronger outcome |
| unresolved: | Available evidence supports none of the above outcomes |
| An unsuccessful search does not prove that Rust cannot generate the structure. | |
| [... ] | |
C Instructions Given to the Patch-Search Agent
We ran the patch-search agent of RQ3 in Codex with gpt-6-sol at medium reasoning effort (Section 3.5). Every run used the same task file. The message that starts a run points the agent to this file and gives it one project, the zkVM, which is always SP1, and the 33 bugs that reproduce on SP1 in RQ1. The agent chooses which of these bugs to try, and has four hours of wall-clock time for the project. Listing 5 gives the task file in condensed form. We keep the original wording, and [...] marks text that we cut. The cut text covers how the inputs are resolved, the records of commands, timings, tests and token usage that the agent must keep, the layout of the saved files and the final report. We print the outcome table as a list, and we show the inputs with the values that our runs used. The four outcomes and the patch rules are the ones of Section 3.5, where the normal compiler arm is the fixed compiler. The complete file is part of our artifact.
Listing 5. Task file of the patch-search agent (condensed).
Test compiler bugs against a zkVM project
You are investigating whether known Rust or LLVM compiler bugs can affect the guest programs of a real zkVM project. Work autonomously, keep every experiment local, and preserve enough evidence for another engineer to review or replay the result.
Inputs
BUGS_PATH=<the 33 LLVM bugs that reproduce on SPI>
ZKVM=sp1
PROJECT=<GitHub URL of one of the 20 selected projects>
TIME_BUDGET=<4 hours of wall-clock time for the project>
[... ]
Experiment rules
[... ] Do not commit to, push to, or open a pull request against the selected project.
Use ordinary Rust source and the project's normal zkVM build path. A candidate patch must be a plausible refactoring or optimization of existing guest code. It must preserve the intended source behavior. Examples include replacing an equivalent loop, removing a redundant copy, changing an equivalent arithmetic form, specializing a helper, or using a more direct data representation.
Do not paste a standalone reproducer into an unrelated guest, add manually written LLVM IR, inject compiler metadata, add undefined behavior, weaken an assertion, change a test's expected value, or alter the input only to make the two compiler arms perform different computations. [... ]
The patched guest source, dependencies, features, target, build profile, linker, environment, and input must be identical in the normal and buggy compiler arms. Only the compiler construction needed to expose the selected bug may differ. [... ]
A bug is eligible for guest patching only after both compiler arms can compile a real guest through the selected zkVM's ordinary guest build pipeline. Treat this as a hard preflight gate. [... ]
Compiler instrumentation, pass disabling, debug counters, and custom diagnostic flags may screen candidates. They cannot establish success. [... ]
Execute guests only. Do not generate or verify cryptographic proofs. [... ]
Phase 1, select and build the project
[... ] Identify the command that compiles each selected guest for the requested zkVM. [... ]
Phase 2, discover existing execution and testing paths
Find everything the project already uses to exercise the selected guests [... ]
Phase 3, establish a small execution baseline
Run a small subset of the paths found in Phase 2. Prefer the fastest deterministic command that executes each guest with a fixed input. [... ]
Phase 4, investigate each selected bug
Qualify the compiler pair
Provision the normal and buggy compilers before searching for project patch sites. Prefer two builds from the same compiler source revision with only the known fix applied or reverted. [... ]
Search the guests and design candidate patches
Before proposing a patch, turn the corpus reproducer into a concrete trigger specification. [... ]
Search guest source and project crates reachable from the guest for natural places where a refactoring or optimization inspired by that reproducer can introduce the trigger. [... ] Prioritize code that affects observable guest output and can receive the reproducer's witness values through valid project inputs.
Try at most 10 distinct candidate patches per bug. [... ]
Build and compare compiler arms
[... ] For every candidate whose preliminary screen contains the required compiler input, build the same patched guest in both arms. [... ] Compare affected and fixed IR or assembly at the faulty pass, then finalize the candidate's 'pattern-hit', 'pattern-miss', or 'pattern-uncertain' status.
Backpropagate the affected compiler state to guest input
Perform this step for every 'pattern-hit'. [... ] Start at the first instruction, flag, metadata item, value, or control-flow edge that differs because of the bug. Do not start from an assumed test input. Work backward [... ] until each required condition is expressed in terms of the guest's external input. [... ] Then trace forward from the affected value to an observable result. [... ]
Use the existing project workload when directed testing does not diverge
[... ] use the remaining budget on the most useful tests, executions, fuzz seeds, or small fuzzing run found in Phase 2. Run identical commands and inputs in both compiler arms. [... ]
| Outcome classification | |
|---|---|
| Report exactly one outcome per bug: | |
| success: | A plausible guest patch that preserves semantics reaches the selected bug pattern, the normal and buggy compiler arms produce different observable execution results for the same patched source and input, the normal compiler preserves the unpatched result, and a clean replay repeats the differential. |
| success-without-test: | A plausible guest patch preserves checked source behavior, compiles through the ordinary zkVM pipeline in both arms, and has fix-specific compiler-boundary evidence with status `pattern-hit`, but no observable execution divergence was confirmed before the budget ended. [... ] |
| partial: | The compiler-pair eligibility gate passed and at least one plausible guest refactoring or optimization was compiled with both compiler arms and preserved the checked baseline behavior under the normal compiler, but every candidate was `pattern-miss` or `pattern-uncertain`. |
| failure: | The compiler-pair eligibility gate did not pass, no valid project patch was produced, either compiler arm could not build a real zkVM guest, the project could not be executed, the candidate changed intended semantics, or available evidence supports none of the other outcomes. |
| [ ... ] | |