Commit 075d2c4
committed
Verify
Fix bug where `internal/guest/runtime/runc/container.go` code assumed
that the logfile passed to runc would contain an error without checking.
This can result in scenarios where `cmd.Run` (or `cmd.CombinedOutput`)
returns a non-nil `err` but (due to a runc's failure to start or
write to the log file, or the JSON is invalid) `runcErr` is nil and therefore
the error returned by `errors.Wrapf` is also nil.
Those scenarios can ultimately panic since it violates invariants where
a nil error is assumed to mean a successful operation or a usable return
value.
Fix this by guarding on `runcErr == nil` and warn in those situations.
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>runc error from log file1 parent ff6ae30 commit 075d2c4
1 file changed
+20
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
| |||
145 | 150 | | |
146 | 151 | | |
147 | 152 | | |
148 | | - | |
149 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
150 | 159 | | |
151 | 160 | | |
152 | 161 | | |
| |||
361 | 370 | | |
362 | 371 | | |
363 | 372 | | |
364 | | - | |
| 373 | + | |
365 | 374 | | |
366 | 375 | | |
367 | 376 | | |
| |||
413 | 422 | | |
414 | 423 | | |
415 | 424 | | |
416 | | - | |
417 | | - | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
418 | 432 | | |
419 | 433 | | |
420 | 434 | | |
| |||
0 commit comments