Skip to content

[Bug] Page table walker in exception handler causes stack overflow on AArch64 and x86_64 debug builds #1925

Open

Description

@andreiltd

We are currently reserving 2 additional scratch pages for exception handler, but the measured stack usage peak for debug builds is much larger than that:

+----------------------------------------------------+
¦ Architecture ¦ Guest ¦   Debug peak ¦ Release peak ¦
+--------------+-------+--------------+--------------¦
¦ AArch64      ¦ Rust  ¦ 38,896 bytes ¦  6,720 bytes ¦
+--------------+-------+--------------+--------------¦
¦ AArch64      ¦ C     ¦ 39,024 bytes ¦  6,576 bytes ¦
+--------------+-------+--------------+--------------¦
¦ x86_64       ¦ Rust  ¦ 10,944 bytes ¦  1,952 bytes ¦
+--------------+-------+--------------+--------------¦
¦ x86_64       ¦ C     ¦ 10,944 bytes ¦  1,904 bytes ¦
+----------------------------------------------------+

In the short term we should increase the reservation to 12 pages, long term the walker code should be reviewed, checked for deep recursion and optimized for stack usage. 40K on arm is unexpected but x86 also doesn't fit using current budget.

Activity

  1. self-assigned this
    on Oct 12, 2026
  2. syntactically commented on Oct 12, 2026

    @syntactically
    Member

    Good catch! Definitely we should start by changing the reservation, probably taking account of the fairly large difference between debug and release.

    It is possible that something has changed and the walker code is no longer being optimised as well as it should be; the current iterator-based approach is reliant on Rust monomorphise+inline optimisations, and while I checked when I added it that it was being optimised into a tight loop, it is entirely possible that that was brittle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions