Skip to content

cvm guest vsm: protections applied to overlay pages shouldn't affect bitmaps #1557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 20, 2025

Conversation

sluck-msft
Copy link
Contributor

The bitmaps track VTL 1 protections on VTL 0, and the permissions applied to the overlay pages are imposed by VTL 2. So applying protections to overlay pages, either on registration or deregistration, shouldn't change the bitmaps.

Tested:
SNP +/- guest vsm

@sluck-msft sluck-msft requested a review from a team as a code owner June 19, 2025 23:25
@sluck-msft sluck-msft added the backport_2505 Change should be backported to the release/2505 branch label Jun 19, 2025
Copy link

if vtl == GuestVtl::Vtl0 {
// Only VTL 0 vtl permissions are explicitly tracked
if calling_vtl == Vtl::Vtl1 && target_vtl == GuestVtl::Vtl0 {
// Only VTL 1 permissions imposed on VTL 0 are explicitly tracked
self.vtl0.update_permission_bitmaps(range, protections);
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we call update_permission_bitmaps in one other spot below, does it need a similar guard?

Copy link
Contributor Author

@sluck-msft sluck-msft Jun 20, 2025

Choose a reason for hiding this comment

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

That's the one in change_host_visibility? I think we want to remove the permissions there because it's the encrypted mapping and needs to reflect the underlying partition-wide mapping, I can add a comment.

.expect("should be able to apply default protections");
self.apply_protections(
range,
if self.vtl1_protections_enabled() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels odd. I feel like this should be another caller_vtl being passed in, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My thinking is this:

  1. For change_host_visibility, the calling VTL is itself the "target" vtl (although that doesn't make much sense for host visibility since it applies partition-wide). This is different from modify_vtl_protection_mask, where it should only be a higher VTL targeting a lower VTL.
  2. When changing from shared to private, we apply the default protections on the page. Either there's a VTL 1 that configured default protections, and therefore we're applying the protections on behalf of VTL 1, or there's no VTL 1 (or it hasn't yet configured default protections) and we're applying the protections on behalf of VTL 2.

@sluck-msft sluck-msft merged commit 02adecc into microsoft:main Jun 20, 2025
28 checks passed
sluck-msft added a commit to sluck-msft/openvmm that referenced this pull request Jun 20, 2025
…bitmaps (microsoft#1557)

The bitmaps track VTL 1 protections on VTL 0, and the permissions
applied to the overlay pages are imposed by VTL 2. So applying
protections to overlay pages, either on registration or deregistration,
shouldn't change the bitmaps.

Tested:
SNP +/- guest vsm
sluck-msft added a commit that referenced this pull request Jun 23, 2025
…ect … (#1567)

…bitmaps (#1557)

The bitmaps track VTL 1 protections on VTL 0, and the permissions
applied to the overlay pages are imposed by VTL 2. So applying
protections to overlay pages, either on registration or deregistration,
shouldn't change the bitmaps.

Tested:
SNP +/- guest vsm
@benhillis
Copy link
Member

Backported in #1567

@benhillis benhillis added backported_2505 PR that has been backported to release/2505 and removed backport_2505 Change should be backported to the release/2505 branch labels Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported_2505 PR that has been backported to release/2505
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants