Skip to content

Fix C-WCOW dm-verity hash mismatch vs cplat runtime - #37

Merged
KenGordon merged 1 commit into
mainfrom
cwcow-confcom-fix
Jun 24, 2026
Merged

Fix C-WCOW dm-verity hash mismatch vs cplat runtime#37
KenGordon merged 1 commit into
mainfrom
cwcow-confcom-fix

Conversation

@EmanuelOprea

Copy link
Copy Markdown
Collaborator

Problem

dmverity-vhd produced per-layer and merged block-CIM dm-verity hashes that did not match the values the cplat runtime (containerd blockcim snapshotter) computes at pull time, which blocks hash-locked confidential Windows (C-WCOW) containers.

Two inputs to the dm-verity hash differed between confcom and the runtime:

  1. CIM name — the CIM name is part of the dm-verity-hashed content. confcom named each layer CIM <layerDigest>.cim while the runtime names every layer CIM layer.cim. Fixed by using the constant layer.cim.

  2. Parent-layer order — hcsshim's processNonBaseLayer merges each layer's registry delta against parentLayerPaths[0], and MergeBlockCIMLayersWithOpts expects source CIMs topmost-first (base last). The runtime supplies parents immediate-parent-first (containerd parent-chain order), producing a cumulative/chained registry merge; confcom accumulated them base-first (a flat merge against the original base), diverging from the 3rd layer onward. Fixed by adding orderedParentsForMerge() and applying it in tarToCim and generateMergedCim.

Change

Single file: cmd/dmverity-vhd/cim.go (+31/-3). No behavioral change beyond aligning the two hash inputs with the runtime.

dmverity-vhd produced per-layer and merged block-CIM dm-verity hashes that
did not match the values the cplat runtime (containerd blockcim snapshotter)
computes at pull time, which blocks hash-locked confidential Windows
containers. Two inputs to the hash differed:

1. CIM name: the CIM name is part of the dm-verity-hashed content. confcom
   named each layer CIM "<layerDigest>.cim" while the runtime names every
   layer CIM "layer.cim". Use the constant "layer.cim" to match.

2. Parent-layer order: hcsshim's processNonBaseLayer merges each layer's
   registry delta against parentLayerPaths[0], and MergeBlockCIMLayersWithOpts
   expects source CIMs topmost-first (base last). The runtime supplies parents
   immediate-parent-first (containerd parent-chain order), producing a
   cumulative/chained registry merge; confcom accumulated them base-first
   (a flat merge against the original base), diverging from the 3rd layer on.
   Add orderedParentsForMerge() and apply it in tarToCim and generateMergedCim.
@KenGordon
KenGordon merged commit b94a987 into main Jun 24, 2026
10 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.

2 participants