LOGBOOK

HELP

Quiz Entry - updated: 2026.07.10

What is the "red zone" in x86-64?

The red zone is a 128-byte area below %rsp that a leaf function may use as scratch space without bothering to adjust the stack pointer.

The 128-byte red zone below %rsp usable by leaf functions without adjusting %rsp.

* The 128-byte red zone below %rsp lets a leaf function use scratch space without adjusting %rsp; System V only, user-space leaf functions only. *

It's an ABI optimization: a function that calls nobody else can simply scribble in the 128 bytes just past the top of the stack, skipping the sub/add on %rsp it would otherwise need.

%rsp -> +-----------------+
        | 128-byte        |  ← red zone: usable without sub $N,%rsp
        | red zone        |
        +-----------------+
leaf_func:
    movq %rdi, -8(%rsp)    # use red zone directly — no allocation
    movq %rsi, -16(%rsp)
    ...
    ret

Strict conditions:

  • Leaf functions only — a call would push a return address right over the red zone.
  • User space only — kernel code can't use it (interrupts would clobber it).
  • System V ABI only — Windows x64 has no red zone.

Important: the red zone is purely an ABI convention, not a hardware feature — the chip knows nothing about it; the compiler and OS just agree that signal handlers and the kernel won't touch those 128 bytes for user leaf code.

Go deeper:

From Quiz: REVE1 / The Processor Interface | Updated: Jul 10, 2026