1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/pkg/archive
Stephen Benjamin 89dd10b06e archive: fix race condition in cmdStream
There is a race condition in pkg/archive when using `cmd.Start` for pigz
and xz where the `*bufio.Reader` could be returned to the pool while the
command is still writing to it, and then picked up and used by a new
command.

The command is wrapped in a `CommandContext` where the process will be
killed when the context is cancelled, however this is not instantaneous,
so there's a brief window while the command is still running but the
`*bufio.Reader` was already returned to the pool.

wrapReadCloser calls `cancel()`, and then `readBuf.Close()` which
eventually returns the buffer to the pool. However, because cmdStream
runs `cmd.Wait` in a go routine that we never wait for to finish, it is
not safe to return the reader to the pool yet.  We need to ensure we
wait for `cmd.Wait` to finish!

Signed-off-by: Stephen Benjamin <stephen@redhat.com>
2019-09-11 07:37:14 -04:00
..
testdata
archive.go archive: fix race condition in cmdStream 2019-09-11 07:37:14 -04:00
archive_linux.go pkg/archive: support overlayfs in userns (Ubuntu kernel only) 2018-12-11 07:18:37 +09:00
archive_linux_test.go pkg/archive: add TestReexecUserNSOverlayWhiteoutConverter 2018-12-11 07:18:37 +09:00
archive_other.go pkg/archive: support overlayfs in userns (Ubuntu kernel only) 2018-12-11 07:18:37 +09:00
archive_test.go archive: fix race condition in cmdStream 2019-09-11 07:37:14 -04:00
archive_unix.go pkg/archive: keep walkRoot clean if source is / 2019-06-14 03:57:58 +00:00
archive_unix_test.go pkg/archive: annotate tests that requires initial userns 2018-12-11 07:18:37 +09:00
archive_windows.go Add ADD/COPY --chown flag support to Windows 2018-08-13 21:59:11 -07:00
archive_windows_test.go LCOW: lazycontext: Use correct lstat, fix archive check 2018-06-27 13:29:21 -07:00
changes.go pkg/archive fixes, and port most unit tests to Windows 2018-11-26 10:20:40 -08:00
changes_linux.go Update overlay2 to use naive diff for changes 2018-06-20 11:07:36 -07:00
changes_other.go
changes_posix_test.go
changes_test.go pkg/archive fixes, and port most unit tests to Windows 2018-11-26 10:20:40 -08:00
changes_unix.go pkg/archive fixes, and port most unit tests to Windows 2018-11-26 10:20:40 -08:00
changes_windows.go pkg/archive fixes, and port most unit tests to Windows 2018-11-26 10:20:40 -08:00
copy.go pkg/archive:CopyTo(): fix for long dest filename 2019-01-24 18:10:52 -08:00
copy_unix.go
copy_unix_test.go pkg/archive:CopyTo(): fix for long dest filename 2019-01-24 18:10:52 -08:00
copy_windows.go
diff.go Merge pull request #39699 from thaJeztah/mkdirall_dropin 2019-08-27 16:27:53 -07:00
diff_test.go pkg/archive fixes, and port most unit tests to Windows 2018-11-26 10:20:40 -08:00
example_changes.go
README.md
time_linux.go
time_unsupported.go
utils_test.go
whiteouts.go
wrap.go
wrap_test.go Update tests to use gotest.tools 👼 2018-06-13 09:04:30 +02:00

This code provides helper functions for dealing with archive files.