Skip to content

loader: fix page table relocation identity mapping - #4384

Closed
Ben Hillis (benhillis) wants to merge 2 commits into
microsoft:release/1.8.2607from
benhillis:backport/1.8.2607/pt-align-fix
Closed

loader: fix page table relocation identity mapping#4384
Ben Hillis (benhillis) wants to merge 2 commits into
microsoft:release/1.8.2607from
benhillis:backport/1.8.2607/pt-align-fix

Conversation

@benhillis

Copy link
Copy Markdown
Member

Backport of the page table relocation fix to release/1.8.2607. Opened ahead of the main PR because 1.8 is currently red.

A relocating loader must keep the page table region identity mapped (VA = PA) after it moves it. Both the OpenVMM loader and the Hyper-V loader only fixed up identity map entries against the IGVM_VHS_RELOCATABLE_REGION range, so a page table region starting exactly on a large page boundary kept its pre-relocation VA, leaving the relocated root unmapped:

triple fault vtl=Vtl2 vp=0x0
  faulting instruction "mov r13,[r12+0FF8h]"
  r12=0x1a4a00000  cr3=0x1a4a00000  cr2=0x80  idtr base=0 limit=ffff

Latent — the region start is the running total of everything loaded before it, so unrelated image growth decides whether it lands on the boundary. 1.8 landed on 0xca00000 and every test that relocates VTL2 failed.

Two commits:

  1. Loader fix. Include the page table region in the relocation map so its own identity mapping is fixed up. Correct at any alignment.
  2. Image-side mitigation. Pad by a page so the region never starts on a large page boundary. Needed because already-shipped Hyper-V loaders have the same defect and cannot be fixed from here. The two regions stay disjoint, as the spec requires.

The upstream crate fix is microsoft/igvm#135, which fixes this for all consumers of PageTableRelocationBuilder; the Hyper-V loader needs an equivalent fix separately.

Ben Hillis and others added 2 commits September 3, 2026 13:28
The page table region is declared relocatable by its own
IGVM_VHS_PAGE_TABLE_RELOCATION header and must remain identity mapped
(VA = PA), but the loader only fixed up entries against the
IGVM_VHS_RELOCATABLE_REGION range. The leaf mapping the page tables kept
its pre-relocation VA, so the relocated root was unmapped and the first
page table access triple faulted VTL2 with no IDT loaded.

This only tripped when the page table region started exactly on a large
page boundary; otherwise the leaf covering it happened to also overlap
the relocation region and was fixed up by luck.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Deployed loaders only fix up identity map entries that overlap the
relocation region, so a page table region starting exactly on a large
page boundary is left identity mapped at its pre-relocation address and
VTL2 triple faults on the relocated root.

The loader side is fixed separately, but images must keep booting on
loaders that already shipped. Pad by a page so the region always shares a
large page with the relocation region. The two regions stay disjoint, as
the spec requires.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 3, 2026 22:12
@benhillis
Ben Hillis (benhillis) requested a review from a team as a code owner September 3, 2026 22:12
@github-actions github-actions Bot added the release_1.8.2607 Targets the release/1.8.2607 branch. label Sep 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It affects low-level boot/relocation and page-table correctness, which is difficult to validate fully without targeted runtime testing on the failing scenarios described.

Pull request overview

This PR backports a fix for IGVM page table relocation where the relocated page table root could become unmapped if the page table region started exactly on a large-page boundary (leaving the large-page identity-map leaf entry un-fixed-up).

Changes:

  • Pad the paravisor memory layout (x86_64 + aarch64) by 4K when the pre-page-table offset lands on a large-page boundary, ensuring the relocation region and page-table region share the same large-page leaf mapping.
  • Update the OpenVMM IGVM x86 loader relocation fixups to include the page table region itself, so its identity mapping is also adjusted during relocation.
File summaries
File Description
vm/loader/src/paravisor.rs Adds a 4K padding mitigation so page tables won’t start on a large-page boundary (x86 + arm paths).
openvmm/openvmm_core/src/worker/vm_loaders/igvm.rs Extends relocation fixup range map to include the page table region itself during page table rebuild/import.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

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

Labels

release_1.8.2607 Targets the release/1.8.2607 branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants