Postgres JIT Compiler Bug Investigation
Unraveling a Postgres segfault that uncovered an Arm64 JIT compiler bug | Datadog

Unraveling a Postgres segfault that uncovered an Arm64 JIT compiler bug | Datadog

1/15/2025 · Anthonin Bonnefoy, Mitch Ward, Gillian McGarvey

What this post added

The post details the process of identifying and debugging a segmentation fault in Postgres JIT compilation on Arm64. It covers isolating the issue to a specific query, reproducing it by matching production environment characteristics (including Arm64 architecture), and using a debug build of Postgres with LLVM and GDB to analyze the JIT-generated assembly code. The core contribution is the identification of an infinite loop in the Arm64 JIT compiler's execution of certain expressions, leading to the segfault, and the subsequent contribution of an upstream fix to LLVM.

Read the original post ↗