Commit 9b47baa
committed
Fix Windows COPY --parents with SeBackupPrivilege
Fixes copying from Windows container mount roots by using SeBackupPrivilege
to handle protected system files ('System Volume Information' and 'WcSandboxState')
that cause 'Access is denied' errors when reading file metadata.
Implementation:
- Uses process-wide EnableProcessPrivileges (not thread-local RunWithPrivileges)
- Process-wide elevation required because copy.Copy spawns goroutines in different threads
- Matches approach used in exporters (commit e7ceb63) but adapted for multi-threaded context
- Simple wrapper around copy.Copy with privilege elevation and restoration
Test changes:
- Enabled testCopyRelativeParents for Windows with nanoserver:ltsc2022
- Added Windows-specific test implementations for 7 target stages
- Enabled testCopyParentsMissingDirectory on Windows
- Modified path patterns to include explicit pivot points (/./):
- Without pivots, COPY --parents defaults to '/' causing mount root access
The access denied errors occur during os.Lstat() when reading file metadata.
SeBackupPrivilege allows reading this metadata even with restrictive ACLs on
Windows container volumes.
Fixes #6635
Signed-off-by: Dawei Wei <[email protected]>1 parent 975d8f0 commit 9b47baa
File tree
4 files changed
+131
-7
lines changed- frontend/dockerfile
- solver/llbsolver/file
4 files changed
+131
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | 79 | | |
81 | 80 | | |
82 | | - | |
| 81 | + | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
159 | 213 | | |
160 | 214 | | |
161 | 215 | | |
| |||
182 | 236 | | |
183 | 237 | | |
184 | 238 | | |
185 | | - | |
186 | 239 | | |
187 | 240 | | |
188 | | - | |
| 241 | + | |
| 242 | + | |
189 | 243 | | |
190 | 244 | | |
191 | 245 | | |
| |||
234 | 288 | | |
235 | 289 | | |
236 | 290 | | |
237 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
238 | 328 | | |
239 | 329 | | |
240 | 330 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
| 264 | + | |
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
0 commit comments