Skip to content

Conversation

@ambarve
Copy link
Contributor

@ambarve ambarve commented Oct 13, 2025

HasConfidentialPolicy assumed that
the UVM creation options saved in the UtilityVM struct will always be of type OptionsWCOW & OptionsLCOW. However, for LCOW we store the options as a pointer (i.e type *OptionsLCOW) whereas for WCOW we store the options as a value (i.e type OptionsWCOW). This caused the HasConfidentialPolicy method to panic when testing the policy for LCOW UtilityVM types.

Easy fix would be to just update the switch case to *OptionsLCOW instead of OptionsLCOW, but it seems better to use the same type (create options pointer) for both LCOW & WCOW to avoid such issues in future. In the long run we also want to refactor this and have a common set of methods/types for handling confidential options for LCOW & WCOW.

`HasConfidentialPolicy` assumed that
the UVM creation options saved in the UtilityVM struct will always be of type
`OptionsWCOW` & `OptionsLCOW`. However, for LCOW we store the options as a pointer (i.e
type `*OptionsLCOW`) whereas for WCOW we store the options as a value (i.e type
`OptionsWCOW`). This caused the `HasConfidentialPolicy` method to panic when testing the
policy for LCOW UtilityVM types.

Easy fix would be to just update the switch case to `*OptionsLCOW` instead of
`OptionsLCOW`, but it seems better to use the same type (create options pointer) for both
LCOW & WCOW to avoid such issues in future. In the long run we also want to refactor this
and have a common set of methods/types for handling confidential options for LCOW & WCOW.

Signed-off-by: Amit Barve <[email protected]>
@ambarve ambarve requested a review from a team as a code owner October 13, 2025 20:23
@ambarve ambarve requested a review from Copilot October 13, 2025 20:23
Copy link

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 a panic in the HasConfidentialPolicy method for LCOW (Linux Containers on Windows) by standardizing how UVM creation options are stored. The issue occurred because LCOW stored options as pointers while WCOW stored them as values, causing type assertion failures.

Key changes:

  • Updated type assertions in HasConfidentialPolicy to expect pointer types for both WCOW and LCOW
  • Modified WCOW creation to store options as a pointer instead of a value
  • Updated existing WCOW option access to use pointer dereference

Reviewed Changes

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

File Description
internal/uvm/security_policy.go Fixed type assertions to expect *OptionsWCOW and *OptionsLCOW pointer types
internal/uvm/create_wcow.go Changed storage of WCOW options from value to pointer
internal/uvm/start.go Updated WCOW option access to use pointer dereference syntax

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ambarve ambarve requested a review from jiechen0826 October 13, 2025 20:24
Copy link
Contributor

@jiechen0826 jiechen0826 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@ambarve ambarve merged commit 38c6693 into microsoft:main Oct 13, 2025
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.

3 participants