---
title: "Porting the Solana eBPF JIT compiler to ARM64"
description: "Solana's RBPF JIT compiler, which translates eBPF smart contracts to native code on validators, was ported from x86-only to ARM64, and its x86 backend gained Windows support."
url: "https://swe.quest/articles/porting-the-solana-ebpf-jit-compiler-to-arm64-2640f585a04d44ad"
canonical: "https://blog.trailofbits.com/2022/10/12/solana-jit-compiler-ebpf-arm64/"
source: "Trail of Bits"
published: "2022-10-12"
difficulty: "hard"
kind: "Case study"
reading_minutes: 11
tags: ["compilers","runtimes","rust","sandboxing","memory-safety"]
---

# Porting the Solana eBPF JIT compiler to ARM64

A post on [Trail of Bits](https://swe.quest/sources/trail-of-bits.md), published 2022-10-12, 11 min read, Case study. Original: [https://blog.trailofbits.com/2022/10/12/solana-jit-compiler-ebpf-arm64/](https://blog.trailofbits.com/2022/10/12/solana-jit-compiler-ebpf-arm64/)

## Summary

Solana's RBPF JIT compiler, which translates eBPF smart contracts to native code on validators, was ported from x86-only to ARM64, and its x86 backend gained Windows support. The port rewrote the register map, calling convention, shared subroutines (address translation, exceptions, indirect calls, instruction metering) and per-opcode translations. ARM64's fixed 4-byte instructions mean immediates often need several instructions, and the M1 enforces 16-byte stack alignment where QEMU does not. Running the port under MSAN exposed an uninitialized-memory bug: unsafe code read a Rust enum discriminant that was only a u8, so 7 bytes of stack garbage landed in JIT code and weakened its code-reuse mitigations. The fix adds #\[repr(u64)\] and layout tests, and both new targets remain behind feature gates until reviewed.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Compilers](https://swe.quest/tags/compilers.md) (Compilers & runtimes)
- [Runtimes & VMs](https://swe.quest/tags/runtimes.md) (Compilers & runtimes)
- [Rust](https://swe.quest/tags/rust.md) (Languages)
- [Sandboxing & isolation](https://swe.quest/tags/sandboxing.md) (Security)
- [Memory safety](https://swe.quest/tags/memory-safety.md) (Security)

## Prerequisites

- eBPF basics ([easy posts on Linux](https://swe.quest/tags/linux.md?difficulty=easy))
- JIT compilation ([easy posts on Compilers](https://swe.quest/tags/compilers.md?difficulty=easy))
- ARM64 and x86 calling conventions
- Rust unsafe code ([easy posts on Rust](https://swe.quest/tags/rust.md?difficulty=easy))

## Keywords

Solana, RBPF, eBPF, ARM64, x86\_64, MemorySanitizer, Windows x64 ABI, Apple M1

## Related posts

- [Rewriting Bun in Rust](https://swe.quest/articles/rewriting-bun-in-rust-9aa67adf0dcbde60.md): Bun · 2026-07-08 · Medium · 29 min read · Rust, Zig, AI for coding, Refactoring & migrations, Memory safety
  Bun, a 535k-line Zig JavaScript runtime, was mechanically ported to Rust over 11 days using about 50 continuously running Claude Code workflows.
- [Fuzzing rust-minidump for Embarrassment and Crashes – Part 2](https://swe.quest/articles/fuzzing-rust-minidump-for-embarrassment-and-crashes-part-2-036e58ccd9566822.md): Mozilla Hacks · 2022-06-23 · Medium · 16 min read · Testing, Rust, Debugging, Vulnerability research
  Fuzzing rust-minidump with cargo-fuzz and libfuzzer turned up a series of real bugs in a Rust rewrite of Breakpad's minidump processor that had otherwise shipped cleanly.
- [Synadia and TigerBeetle Pledge $512,000 to the Zig Software Foundation](https://swe.quest/articles/synadia-and-tigerbeetle-pledge-512-000-to-the-zig-software-foundation-124e30142ae18e3c.md): TigerBeetle · 2025-10-25 · Easy · 8 min read · Zig, Language design, Memory safety, Open source
  Synadia and TigerBeetle are jointly donating $512,000 to the Zig Software Foundation over two years, with no strings attached.
- [Using Hermes’s Quicksort to run Doom: A tale of JavaScript exploitation](https://swe.quest/articles/using-hermes-s-quicksort-to-run-doom-a-tale-of-javascript-exploitation-218717db846741cf.md): Meta Engineering · 2022-07-20 · Hard · 12 min read · Vulnerability research, Runtimes & VMs, JavaScript, Memory safety, C & C++
  A fuzzer-found bug in Hermes's stable Quicksort let a comparator callback grow the array during Array.prototype.sort, so the fixed-size index vector was read out of bounds.
- [The V8 Sandbox](https://swe.quest/articles/the-v8-sandbox-705346b1934809ad.md): V8 · 2024-04-04 · Hard · 11 min read · Sandboxing & isolation, Runtimes & VMs, Memory safety, Browsers, Vulnerability research
  The V8 Sandbox is a lightweight, in-process software sandbox that isolates the V8 heap so memory corruption from engine bugs cannot spread to the rest of the renderer process.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
