Commit 869709c
committed
cmd/containerd-shim-runhcs-v1: serialize confidential container bring-up
Starting the containers of a multi-container container group in a single
confidential WCOW UVM concurrently reliably crashes the guest: the guest
resets and the GCS bridge drops ("bridge closed: use of closed network
connection"), and all containers end up Exited.
Root cause is concurrent container bring-up into one confidential UVM.
createContainer runs on its own goroutine per container, so two containers'
hcsoci.CreateContainer calls overlap. CreateContainer performs the container
bring-up: block-CIM mount, scratch SCSI attach, CombineLayers/hive-merge and
the guest container create. The host-side device hot-adds (uvm.modify ->
hcsSystem.Modify) go straight to the VM worker and do not travel over the GCS
bridge, so nothing serializes them; overlapping mount/device operations into
the confidential guest put it into a bad state and it resets.
Serialize the bring-up with a per-UVM lock held across CreateContainer, taken
only for confidential UVMs (HasConfidentialPolicy). This makes the container
starts effectively one-at-a-time into a given confidential UVM. createContainer
is shared with LCOW, hence the generic name and the confidential-only guard.
Validated on a confidential WCOW UVM (VBS): concurrent multi-container groups
that previously crashed every time (2x nanoserver, 2x mount-host,
1x mount-host + 2x nanoserver) now come up cleanly and repeatably; removing the
lock reproduces the crash on the same image.
Signed-off-by: Emanuel Oprea <emanueloprea@microsoft.com>1 parent ef47025 commit 869709c
3 files changed
Lines changed: 37 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
174 | 186 | | |
175 | 187 | | |
176 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
13 | 29 | | |
14 | 30 | | |
15 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
147 | 156 | | |
148 | 157 | | |
149 | 158 | | |
| |||
0 commit comments