Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Trail of Bits 11 min read Case study hardMaster

Porting the Solana eBPF JIT compiler to ARM64

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.

Assumes: eBPF basicsJIT compilationARM64 and x86 calling conventionsRust unsafe code

Related posts

  • Rewriting Bun in Rust

    Bun mediumAdept

    Bun, a 535k-line Zig JavaScript runtime, was mechanically ported to Rust over 11 days using about 50 continuously running Claude Code workflows. The motivation was a steady stream of use-after-free, double-free and leak bugs that came from mixing JavaScriptCore's garbage-collected values with manually managed Zig memory. The port was done all at once in a deliberately Zig-shaped style, guided by a porting guide and a lifetimes map, and validated against Bun's language-independent TypeScript test suite. Adversarial review in separate context windows caught bugs such as Box drops before async uv_close, negative-time timespec errors, and eager unwrap_or evaluation; cleanup toward idiomatic, less-unsafe Rust is planned after v1.4.

  • Fuzzing rust-minidump for Embarrassment and Crashes – Part 2

    Mozilla Hacks mediumAdept

    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. They include an ARM64 stackwalker infinite loop that grew backtraces until OOM, a flipped comparison that silently emptied the MinidumpLinuxMaps RangeMap, OOMs from Vec::with_capacity on untrusted list lengths, and several integer overflows. The OOM fix checks that the remaining section bytes can actually hold the claimed item count, which bounds reservations to O(n) in the dump size. Rust's debug-build overflow panics and liberal assertions made each bug deterministically reproducible as a tiny checked-in test, and well-scoped issue reports with fixes made the fuzzing contributions genuinely useful to maintainers.

  • Synadia and TigerBeetle Pledge $512,000 to the Zig Software Foundation

    TigerBeetle easyNovice

    Synadia and TigerBeetle are jointly donating $512,000 to the Zig Software Foundation over two years, with no strings attached. The post explains why TigerBeetle chose Zig over Rust and C in 2020. TigerBeetle uses static allocation per NASA's Power of Ten rules and runs single-threaded because transaction contention defeats partitioning, so Rust's borrow checker mattered less than Zig's bounds checking, checked arithmetic by default and absence of hidden allocations or control flow. Three bugs the borrow checker would have prevented were caught by fuzzing on 1,000 dedicated cores, and the upgrade to Zig 0.15.2 made debug builds 2x faster and LLVM release builds 1.6x faster.

  • Using Hermes’s Quicksort to run Doom: A tale of JavaScript exploitation

    Meta Engineering hardMaster

    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. Meta's security team escalated it to arbitrary read/write. They underflowed the unsigned j index to swap values outside the vector, groomed adjacent mmap'd ArrayBuffer allocations, and corrupted a malloc chunk size to get overlapping buffers. They then reclaimed one buffer as a GenGC heap segment so ArrayBuffer data pointers could be overwritten. The escalation raised the bounty from a typical $500–$3,000 to $12,000, and the exploit was demonstrated by running Doom inside Hermes.

  • The V8 Sandbox

    V8 hardMaster

    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. It is now included in Chrome's VRP as of Chrome 123. V8 exploits usually stem from 2nd-order logic bugs, often in JIT compilers, which neither Rust nor memory tagging can prevent. The sandbox therefore replaces raw pointers and 64-bit sizes on the heap with 40-bit offsets from a 1TB reserved region, plus a pointer-table indirection for external objects. Overhead is about 1% on Speedometer and JetStream, and the design is testable through a memory-corruption API and a sandbox-violation detection mode used for fuzzing.

The quest for software engineering knowledge.

Look:
Layout: