page_table: relocate the page table region's own identity mapping - #135
Merged
Merged
Conversation
The page table region is declared relocatable by its own header and the spec requires it stay identity mapped (VA = PA). `build` moved the region and fixed up the root, but only fixed up leaf entries against the caller-supplied ranges, which per the documented contract describe other regions. A leaf mapping the page table region was therefore left at its pre-relocation VA, leaving the relocated root unmapped. This was masked whenever the leaf covering the page table region also happened to overlap a caller-supplied range, so it only reproduced when the region started exactly on a large page boundary. Fix it up in `build`, which already knows the region and its offset, so consumers cannot get this wrong. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Chris Oo (chris-oo)
approved these changes
Sep 3, 2026
Ben Hillis (benhillis)
requested a review
from Brian Perkins (Brian-Perkins)
September 3, 2026 21:35
Brian Perkins (Brian-Perkins)
approved these changes
Sep 3, 2026
This was referenced Sep 3, 2026
Ben Hillis (benhillis)
added a commit
to microsoft/openvmm
that referenced
this pull request
Sep 4, 2026
Updates IGVM to microsoft/igvm#135 so relocation also fixes the page table region's own identity mapping. Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> Copilot-Session: ee248446-5a9b-4674-9840-636045767f48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The page table region is declared relocatable by its own
IGVM_VHS_PAGE_TABLE_RELOCATIONheader, and the spec requires the page table to stay identity mapped (VA = PA):buildmoves the region and fixes up the root, but only fixed up leaf entries against the caller-suppliedrelocation_offsets, which per its own doc comment describe other ranges. A leaf entry mapping the page table region was therefore left at its pre-relocation VA, so the relocated root ended up unmapped.This was masked whenever the leaf covering the page table region also happened to overlap a caller-supplied range, which is the common case. It only reproduces when the region starts exactly on a large page boundary and so has no overlap — for a 2 MiB leaf that is roughly 1 in 512, decided by unrelated image growth.
Found via OpenHCL, where it triple faulted VTL2 on the first page table access with no IDT loaded:
Fixed in
build, which already knows the region (gpa,size) and its offset, so consumers cannot get this wrong.Adds
builder_relocates_own_region, which relocates a page table whose only leaf maps the region itself with no caller-supplied ranges, and asserts the new location is identity mapped and the stale mapping is gone. Without the fix it fails with the relocated root unmapped.