Skip to content

Enable SNP for WCOW - #2507

Merged
ambarve merged 9 commits into
microsoft:mainfrom
takuro-sato:enable-snp
Sep 12, 2025
Merged

Enable SNP for WCOW#2507
ambarve merged 9 commits into
microsoft:mainfrom
takuro-sato:enable-snp

Conversation

@takuro-sato

@takuro-sato takuro-sato commented Aug 27, 2025

Copy link
Copy Markdown
Contributor

Changes

  • Add new annotations WCOWIsolationType and WCOWDisableSecureBoot
  • Change HCS json input for SNP WCOW so that it boots

TODOs for a future PR

@KenGordon KenGordon self-assigned this Aug 28, 2025
@KenGordon KenGordon removed their assignment Aug 28, 2025
@takuro-sato
takuro-sato marked this pull request as ready for review August 28, 2025 09:00
@takuro-sato
takuro-sato requested a review from a team as a code owner August 28, 2025 09:00
@KenGordon
KenGordon requested a review from MahatiC August 28, 2025 09:00
@ambarve

ambarve commented Aug 28, 2025

Copy link
Copy Markdown
Contributor

@takuro-sato could you please rebase this on Mahati's branch? There are a lot of related changes coming in from my PR, Kirtana's PR and Mahati's PR. Mahati's branch includes changes from my PR as well as Kirtana's PR.

@takuro-sato

Copy link
Copy Markdown
Contributor Author

@ambarve They are indeed related, but this PR doesn't require them. So can't we just merge it based on current main? I'm also happy to wait for the existing PRs to be merged, but I think it would be easier for me to just to wait, and rebase it on main again. (Even if I rebase it on Mahati's, I would need to rebase it on main again anyway)

Comment thread internal/oci/uvm.go Outdated
Comment thread pkg/annotations/annotations.go Outdated
Comment thread internal/uvm/create_wcow.go Outdated
doc.VirtualMachine.ComputeTopology.Memory.Backing = &memoryBacking
doc.VirtualMachine.ComputeTopology.Memory.AllowOvercommit = opts.AllowOvercommit
// EnableHotHint is not compatible with physical.
doc.VirtualMachine.ComputeTopology.Memory.EnableHotHint = opts.AllowOvercommit

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.

handleWCOWSecurityPolicy sets AllowOvercommit to false, so we don't need to explicitly set that here.

Do we not need physically backed memory for VBS mode?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe I'm missing something, but the change is only for SNP. VBS will keep having memoryBacking with this change.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@ambarve I agree with @takuro-sato - if isolation type is SNP (ok, literally "SecureNestedPaging") then the reulting doc is identical to the one the old code would generate.

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.

Sorry, I meant to ask, "Do we not need physically backed memory for SNP mode?" This new code will set the memory backing type to physical only for non SNP cases. For SNP cases it will use whatever is the default (which would be a nil pointer, I think). Is that what we want?

Similarly, I think if allow overcommit is set to true, boot will fail in VBS mode too. That's why the handleWCOWSecurityPolicy method explicitly errors out if that option is set. So we don't need to handle that in a separate if case here.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we should leave the existing behaviour as is (ie overcommit in VBS will fail in the HCS calls) so we can minimise our impact and risk of breaking things.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

BTW, we don't want to respect annotations that will 100% cause a failure is in case SF or some other control plane is setting them and so we have to do more work there. SF changes take a long time. This may also lead to us using the lcow annotation for the wcow security policy eventually.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@ambarve infact, I think main now gets only ever gets the overcommit flag as a side effect of "handleWCOWSecurityPolicy" which people may find surprising. In the LCOW case what I did was leave all the existing processing in place and do the handleSecurityPolicy part after such flags (with a comment to say that this is essential) so that the security policy handler was not essential to the non confidential path.

Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Comment thread internal/oci/uvm.go Outdated
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Co-authored-by: Amit Barve <ambarve@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Comment thread internal/oci/uvm.go
Signed-off-by: Takuro Sato <takurosato@microsoft.com>
Signed-off-by: Takuro Sato <takurosato@microsoft.com>

@KenGordon KenGordon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As discussed.

This PR changes the code to always have the default isolation type of
"SecureNestedPaging". It also updates the code so that it doesn't error out if allow
over commit is set to true in annotations, instead that value is silently overridden to
false. This commit updates the tests to follow the same logic.

Signed-off-by: Amit Barve <ambarve@microsoft.com>
@ambarve
ambarve merged commit 4722535 into microsoft:main Sep 12, 2025
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants