Skip to content

Conversation

smalis-msft
Copy link
Contributor

@smalis-msft smalis-msft commented Sep 15, 2025

This fixes some oversights and edge cases in underhill_mem that were pointed out during an audit of our memory protections code.

  1. We need to remove permissions when unaccepting pages on SNP
  2. We need to completely forbid changing permissions on individual overlay pages to avoid a potential race condition (does not apply to the default permissions case)
  3. We need to be careful around changing the default permissions when pages are locked, since we don't restore default permissions when they're unlocked
  4. Remove a stale comment

Fixes #1021

@smalis-msft smalis-msft requested a review from a team as a code owner September 15, 2025 21:54
@Copilot Copilot AI review requested due to automatic review settings September 15, 2025 21:54
@smalis-msft smalis-msft changed the title WIP: uh_mem: Fix a number of oversights WIP: uh_mem: Fix a number of oversights and edge cases Sep 15, 2025
@smalis-msft smalis-msft added the backport_2505 Change should be backported to the release/2505 branch label Sep 15, 2025
@smalis-msft smalis-msft changed the title WIP: uh_mem: Fix a number of oversights and edge cases WIP: uh_mem: Fix a few oversights and edge cases Sep 15, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes several security and correctness issues in the underhill_mem memory protection subsystem, addressing edge cases around SNP memory unacceptance, overlay page permissions, and locked page handling.

  • Adds permission revocation before unaccepting pages on SNP to close a security window
  • Prevents permission changes on individual overlay pages to avoid race conditions
  • Refactors locked page checking logic to be more robust

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
openhcl/underhill_mem/src/lib.rs Main fixes for SNP unacceptance, overlay page validation, and locked page handling logic
openhcl/underhill_mem/src/init.rs Removes outdated comment about HCL Arc usage

Copy link

@smalis-msft smalis-msft added the release-ci-required Add to a PR to trigger PR gates in release mode label Sep 16, 2025
@smalis-msft smalis-msft changed the title WIP: uh_mem: Fix a few oversights and edge cases uh_mem: Fix a few oversights and edge cases Sep 18, 2025
@smalis-msft smalis-msft added release-ci-required Add to a PR to trigger PR gates in release mode and removed release-ci-required Add to a PR to trigger PR gates in release mode labels Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport_2505 Change should be backported to the release/2505 branch release-ci-required Add to a PR to trigger PR gates in release mode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validate TLB flushes with memory protections
3 participants