Skip to content

openhcl: fix lower vtl permissions guard drop order and new failures (#4205) - #4213

Merged
Chris Oo (chris-oo) merged 1 commit into
microsoft:release/1.8.2607from
chris-oo:lower-vtl-guard-1.8
Aug 13, 2026
Merged

openhcl: fix lower vtl permissions guard drop order and new failures (#4205)#4213
Chris Oo (chris-oo) merged 1 commit into
microsoft:release/1.8.2607from
chris-oo:lower-vtl-guard-1.8

Conversation

@chris-oo

Copy link
Copy Markdown
Member

Fix two bugs in lower vtl permissiosn guard. One is around drop ordering, where we must restore VTL protections to allocated pages before returning them to allocation pools, and the other is to handle partial failures on construction by rolling back protections.

Clean cherry pick of (#4205).

…icrosoft#4205)

Fix two bugs in lower vtl permissiosn guard. One is around drop
ordering, where we must restore VTL protections to allocated pages
before returning them to allocation pools, and the other is to handle
partial failures on construction by rolling back protections.
Copilot AI lite review requested due to automatic review settings August 11, 2026 18:14
@chris-oo
Chris Oo (chris-oo) requested a review from a team as a code owner August 11, 2026 18:14
@github-actions github-actions Bot added release_1.8.2607 Targets the release/1.8.2607 branch. unsafe Related to unsafe code labels Aug 11, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Unsafe Code Detected

This PR modifies files containing unsafe Rust code. Extra scrutiny is required during review.

For more on why we check whole files, instead of just diffs, check out the Rustonomicon

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.

Pull request overview

Fixes correctness issues in the OpenHCL lower_vtl_permissions_guard around (1) ensuring VTL protections are restored before pages are returned to allocation pools, and (2) improving behavior when lowering permissions fails partway through guard construction.

Changes:

  • Track successfully-updated PFNs during PagesAccessibleToLowerVtl construction to enable rollback on partial failures.
  • Reorder LowerVtlDmaBuffer fields so the VTL guard is dropped before the underlying MemoryBlock.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
openhcl/lower_vtl_permissions_guard/src/lib.rs Tracks updated pages during guard construction to support rollback on partial failures.
openhcl/lower_vtl_permissions_guard/src/device_dma.rs Reorders fields to ensure VTL protections are restored before freeing the DMA MemoryBlock.

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

Comment on lines 45 to 49
for pfn in pages {
vtl_protect
guard
.vtl_protect
.modify_vtl_page_setting(*pfn, hvdef::HV_MAP_GPA_PERMISSIONS_ALL)
.context("failed to update VTL protections on page")?;
@github-actions

Copy link
Copy Markdown

@chris-oo
Chris Oo (chris-oo) merged commit b85db1e into microsoft:release/1.8.2607 Aug 13, 2026
185 of 193 checks passed
@chris-oo
Chris Oo (chris-oo) deleted the lower-vtl-guard-1.8 branch August 13, 2026 16:18
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. unsafe Related to unsafe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants