Skip to main content

Module layout

Module layout 

Source
Expand description

Functionality to establish a sandbox’s memory layout. This module describes the virtual and physical addresses of a number of special regions in the hyperlight VM, although we hope to reduce the number of these over time.

A snapshot freshly created from an empty VM will result in roughly the following physical layout:

+—————————————––+ | Guest Page Tables | +—————————————––+ | Init Data | (GuestBlob size) +—————————————––+ | PEB Struct | (HyperlightPEB size) +—————————————––+ | Guest Code | +—————————————––+ 0x1_000 | NULL guard page | +—————————————––+ 0x0_000

Everything except for the guest page tables is currently identity-mapped; the guest page tables themselves are mapped at [hyperlight_common::layout::SNAPSHOT_PT_GVA] = 0xffff_8000_0000_0000.

  • InitData - some extra data that can be loaded onto the sandbox during initialization.

The guest heap is outside this layout. The guest maps heap pages from scratch on first touch.

There is also a scratch region at the top of physical memory, which is mostly laid out as a large undifferentiated blob of memory. The copied page tables start at the scratch base, which moves with the scratch size. The transport arena’s address does not depend on the scratch size:

+—————————————––+ (top of physical memory) | Exception Stack, Metadata | +—————————————––+ (reserved pages below) | Guard page (not in the guest page tables) | +—————————————––+ (SCRATCH_TRANSPORT_GAP_PAGES) | Transport Arena | +—————————————––+ | Scratch Memory | +—————————————––+ | Guest Page Tables | +—————————————––+ (scratch size)