-
Notifications
You must be signed in to change notification settings - Fork 132
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
cvm guest vsm: protections applied to overlay pages shouldn't affect bitmaps #1557
Conversation
1b3dfe9
to
059bace
Compare
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking is this:
- 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.
- 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.
…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
Backported in #1567 |
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