Skip to content

Move stack guard page management into the guest #665

@syntactically

Description

@syntactically

Currently, the guest is configured with a fixed-size stack, and the host sets up a guard page which is mapped readonly at stage 2, triggering an exit to the host if it is written to.

We should move stack management into the guest entirely, which also allows the guest to switch to a dynamically-sized stack/heap allocation tradeoff. This would involve

  • Removing the guest stack region inside of the host
  • Setting up an initial guard page could still happen in the host, but almost certainly makes more sense to move to the guest. In any case, stage 1 (rather than stage 2) permissions should be used, and the exception taken on write should be routed to Stage 1.
  • Adding a small interrupt-handler stack that should be kept around and switched to on exceptions, so that the code to map a new stack page can run when the main stack needs to grow.
  • The guest needs an interrupt handler that detects accesses to the stack guard page and grows the guest stack/shrinks the guest heap as necessary

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions