mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-05 07:24:20 +01:00
IoCopy is a tricky function (I don't claim to fully understand its contract), but here is what I see: The goroutine that runs it spawns 3 goroutines - one for each stream to handle (stdin/stdout/stderr). The goroutine then waits for the stream goroutines to exit. The idea is that when the process exits and is closed, the stdout goroutine will be unblocked and close stdin - this should unblock the stdin goroutine. The stderr goroutine will exit at the same time as the stdout goroutine. The iocopy routine then closes all tty.io streams. The problem is that the stdout goroutine decrements the WaitGroup before closing the stdin stream, which causes the iocopy goroutine to race to close the streams. Move the wg.Done() of the stdout routine past the close so that *this* race becomes impossible. I can't guarantee that this doesn't affect some unspecified behavior. Fixes: #5031 Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Kata golang packages
This repository contains a number of packages in addition to the
virtcontainers package:
| Package name | Description |
|---|---|
katatestutils |
Unit test utilities. |
katautils |
Utilities. |
sev |
AMD SEV confidential guest utilities. |
signals |
Signal handling functions. |