Compare commits

..
3 Commits
Author SHA1 Message Date
Raj Chaudhuri c3cc2107c6 Add release 2.8.5 2024-04-06 09:05:57 +05:30
Raj Chaudhuri ac180cfc10 Upgraded dependency
- Details in reweave/CHANGELOG.md
2024-04-05 20:19:51 +05:30
Raj Chaudhuri ff91a56fc4 Scan results on 2024-03-30 2024-03-30 10:17:47 +05:30
15 changed files with 147 additions and 111 deletions

No files matched your search

+7
View File
@@ -1,3 +1,10 @@
## Release 2.8.5
This release has upgraded dependencies based on CVE recommendations.
* Build with Go version 1.21.9
* A dependency has been updated
## Release 2.8.4 ## Release 2.8.4
The alpine base image used by `weave-kube` and `weave-npc` was upgraded to version 3.19.1 in the previous release. In this version, the default iptables backend is nftables, and the legacy backend is not included. Our scripts and programs assume legacy as the default backend, and change to nft if autodetected, or if we ask for it. So, the build Dockerfile (reweave/build/Dockerfile) was changed to also install the Alpine `iptables-legacy` package , and change the `iptables-{save,restore}` symbolic links to point to the legacy backend by default. The alpine base image used by `weave-kube` and `weave-npc` was upgraded to version 3.19.1 in the previous release. In this version, the default iptables backend is nftables, and the legacy backend is not included. Our scripts and programs assume legacy as the default backend, and change to nft if autodetected, or if we ask for it. So, the build Dockerfile (reweave/build/Dockerfile) was changed to also install the Alpine `iptables-legacy` package , and change the `iptables-{save,restore}` symbolic links to point to the legacy backend by default.
+1 -1
View File
@@ -10,7 +10,7 @@ require (
github.com/containernetworking/cni v1.1.2 github.com/containernetworking/cni v1.1.2
github.com/containernetworking/plugins v1.2.0 github.com/containernetworking/plugins v1.2.0
github.com/coreos/go-iptables v0.6.0 github.com/coreos/go-iptables v0.6.0
github.com/docker/docker v24.0.7+incompatible github.com/docker/docker v24.0.9+incompatible
github.com/docker/libnetwork v0.8.0-dev.2.0.20180212220201-119badbd737b github.com/docker/libnetwork v0.8.0-dev.2.0.20180212220201-119badbd737b
github.com/docker/machine v0.14.0 github.com/docker/machine v0.14.0
github.com/fsouza/go-dockerclient v1.10.0 github.com/fsouza/go-dockerclient v1.10.0
+2 -2
View File
@@ -85,8 +85,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/distribution v2.8.2-beta.1+incompatible h1:gILO60VLD2v28ozemv4aAwDb8ds5U2O/vD/sBXbd7Rw= github.com/docker/distribution v2.8.2-beta.1+incompatible h1:gILO60VLD2v28ozemv4aAwDb8ds5U2O/vD/sBXbd7Rw=
github.com/docker/distribution v2.8.2-beta.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.2-beta.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= github.com/docker/docker v24.0.9+incompatible h1:HPGzNmwfLZWdxHqK9/II92pyi1EpYKsAqcl4G0Of9v0=
github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v24.0.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
+14 -1
View File
@@ -2,7 +2,20 @@
All changes made to the weave net codebase during the reweave effort will be documented in this file. All changes made to the weave net codebase during the reweave effort will be documented in this file.
## 2.8.4 ## 2.8.5
* Changed version in `reweave/Makefile` to 2.8.5
* Modified reweave and main CHANGELOG.md
## 2.8.5-beta1 (ac180cfc)
### Changed
* Upgraded github.com/docker/docker to 24.0.9+incompatible
* Ran `go mod vendor`
* Modified `reweave/build/Dockerfile`, to cater for timeouts and other errors during `apt` operations
## 2.8.4 (c3afe552)
### Changed ### Changed
+1 -1
View File
@@ -1,4 +1,4 @@
IMAGE_VERSION ?= 2.8.4 IMAGE_VERSION ?= 2.8.5
REGISTRY_USER ?= rajchaudhuri REGISTRY_USER ?= rajchaudhuri
ALPINE_BASEIMAGE ?= alpine:3.19.1 ALPINE_BASEIMAGE ?= alpine:3.19.1
+4 -2
View File
@@ -7,7 +7,7 @@ ARG ALPINE_BASEIMAGE=alpine:3.19.1
# It will be built only once for a given build platform. Subsequent # It will be built only once for a given build platform. Subsequent
# stages will start from this and cross-compile for each target # stages will start from this and cross-compile for each target
# architecture. # architecture.
FROM --platform=${BUILDPLATFORM} golang:1.21.6-bullseye AS builderbase FROM --platform=${BUILDPLATFORM} golang:1.21.9-bullseye AS builderbase
# Support Raspberry Pi 2 and newer # Support Raspberry Pi 2 and newer
ENV GOARM 7 ENV GOARM 7
@@ -23,8 +23,10 @@ ENV DEB_CROSSPLATFORMS \
# Install the build-essential and crossbuild-essential-ARCH packages # Install the build-essential and crossbuild-essential-ARCH packages
RUN <<EOCROSSCOMPILERS RUN <<EOCROSSCOMPILERS
set -e
echo 'Acquire::Retries "6";' > /etc/apt/apt.conf.d/80-retries
for platform in ${DEB_CROSSPLATFORMS}; do dpkg --add-architecture $platform; done for platform in ${DEB_CROSSPLATFORMS}; do dpkg --add-architecture $platform; done
apt-get update apt-get update
apt-get install -y build-essential apt-get install -y build-essential
for platform in ${DEB_CROSSPLATFORMS}; do apt-get install -y crossbuild-essential-${platform}; done for platform in ${DEB_CROSSPLATFORMS}; do apt-get install -y crossbuild-essential-${platform}; done
apt-get clean apt-get clean
+1 -1
View File
@@ -1 +1 @@
{"schemaVersion": 1, "label": "Vulnerabilty count", "message": "19", "color": "orange"} {"schemaVersion": 1, "label": "Vulnerabilty count", "message": "17", "color": "orange"}
+74 -85
View File
@@ -1,9 +1,9 @@
# Vulnerability Report # Vulnerability Report
``` ```
Report date: 2024-03-20 Report date: 2024-04-06
Unique vulnerability count: 19 Unique vulnerability count: 17
Images version: 2.8.4 Images version: 2.8.5
``` ```
## Scanner Details ## Scanner Details
@@ -23,101 +23,90 @@ Supported DB Schema: 5
## Vulnerabilities ## Vulnerabilities
### weave-kube: (19) ### weave-kube: (17)
``` ```
NAME INSTALLED FIXED-IN TYPE VULNERABILITY SEVERITY NAME INSTALLED FIXED-IN TYPE VULNERABILITY SEVERITY
busybox 1.36.1-r15 apk CVE-2023-42366 Medium busybox 1.36.1-r15 apk CVE-2023-42366 Medium
busybox 1.36.1-r15 apk CVE-2023-42365 Medium busybox 1.36.1-r15 apk CVE-2023-42365 Medium
busybox 1.36.1-r15 apk CVE-2023-42364 Medium busybox 1.36.1-r15 apk CVE-2023-42364 Medium
busybox 1.36.1-r15 apk CVE-2023-42363 Medium busybox 1.36.1-r15 apk CVE-2023-42363 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42366 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42366 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42365 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42365 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42364 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42364 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42363 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42363 Medium
curl 8.5.0-r0 apk CVE-2024-0853 Medium curl 8.5.0-r0 apk CVE-2024-0853 Medium
libuv 1.47.0-r0 apk CVE-2024-24806 High curl 8.5.0-r0 apk CVE-2024-2466 Unknown
ssl_client 1.36.1-r15 apk CVE-2023-42366 Medium curl 8.5.0-r0 apk CVE-2024-2398 Unknown
ssl_client 1.36.1-r15 apk CVE-2023-42365 Medium curl 8.5.0-r0 apk CVE-2024-2004 Unknown
ssl_client 1.36.1-r15 apk CVE-2023-42364 Medium libuv 1.47.0-r0 apk CVE-2024-24806 High
ssl_client 1.36.1-r15 apk CVE-2023-42363 Medium ssl_client 1.36.1-r15 apk CVE-2023-42366 Medium
stdlib go1.21.6 go-module CVE-2024-24785 Unknown ssl_client 1.36.1-r15 apk CVE-2023-42365 Medium
stdlib go1.21.6 go-module CVE-2024-24784 Unknown ssl_client 1.36.1-r15 apk CVE-2023-42364 Medium
stdlib go1.21.6 go-module CVE-2024-24783 Unknown ssl_client 1.36.1-r15 apk CVE-2023-42363 Medium
stdlib go1.21.6 go-module CVE-2023-45290 Unknown
stdlib go1.21.6 go-module CVE-2023-45289 Unknown
``` ```
### weave-npc: (17) ### weave-npc: (12)
``` ```
NAME INSTALLED FIXED-IN TYPE VULNERABILITY SEVERITY NAME INSTALLED FIXED-IN TYPE VULNERABILITY SEVERITY
busybox 1.36.1-r15 apk CVE-2023-42366 Medium busybox 1.36.1-r15 apk CVE-2023-42366 Medium
busybox 1.36.1-r15 apk CVE-2023-42365 Medium busybox 1.36.1-r15 apk CVE-2023-42365 Medium
busybox 1.36.1-r15 apk CVE-2023-42364 Medium busybox 1.36.1-r15 apk CVE-2023-42364 Medium
busybox 1.36.1-r15 apk CVE-2023-42363 Medium busybox 1.36.1-r15 apk CVE-2023-42363 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42366 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42366 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42365 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42365 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42364 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42364 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42363 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42363 Medium
ssl_client 1.36.1-r15 apk CVE-2023-42366 Medium ssl_client 1.36.1-r15 apk CVE-2023-42366 Medium
ssl_client 1.36.1-r15 apk CVE-2023-42365 Medium ssl_client 1.36.1-r15 apk CVE-2023-42365 Medium
ssl_client 1.36.1-r15 apk CVE-2023-42364 Medium ssl_client 1.36.1-r15 apk CVE-2023-42364 Medium
ssl_client 1.36.1-r15 apk CVE-2023-42363 Medium ssl_client 1.36.1-r15 apk CVE-2023-42363 Medium
stdlib go1.21.6 go-module CVE-2024-24785 Unknown
stdlib go1.21.6 go-module CVE-2024-24784 Unknown
stdlib go1.21.6 go-module CVE-2024-24783 Unknown
stdlib go1.21.6 go-module CVE-2023-45290 Unknown
stdlib go1.21.6 go-module CVE-2023-45289 Unknown
``` ```
### weave: (19) ### weave: (17)
``` ```
NAME INSTALLED FIXED-IN TYPE VULNERABILITY SEVERITY NAME INSTALLED FIXED-IN TYPE VULNERABILITY SEVERITY
busybox 1.36.1-r15 apk CVE-2023-42366 Medium busybox 1.36.1-r15 apk CVE-2023-42366 Medium
busybox 1.36.1-r15 apk CVE-2023-42365 Medium busybox 1.36.1-r15 apk CVE-2023-42365 Medium
busybox 1.36.1-r15 apk CVE-2023-42364 Medium busybox 1.36.1-r15 apk CVE-2023-42364 Medium
busybox 1.36.1-r15 apk CVE-2023-42363 Medium busybox 1.36.1-r15 apk CVE-2023-42363 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42366 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42366 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42365 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42365 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42364 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42364 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42363 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42363 Medium
curl 8.5.0-r0 apk CVE-2024-0853 Medium curl 8.5.0-r0 apk CVE-2024-0853 Medium
libuv 1.47.0-r0 apk CVE-2024-24806 High curl 8.5.0-r0 apk CVE-2024-2466 Unknown
ssl_client 1.36.1-r15 apk CVE-2023-42366 Medium curl 8.5.0-r0 apk CVE-2024-2398 Unknown
ssl_client 1.36.1-r15 apk CVE-2023-42365 Medium curl 8.5.0-r0 apk CVE-2024-2004 Unknown
ssl_client 1.36.1-r15 apk CVE-2023-42364 Medium libuv 1.47.0-r0 apk CVE-2024-24806 High
ssl_client 1.36.1-r15 apk CVE-2023-42363 Medium ssl_client 1.36.1-r15 apk CVE-2023-42366 Medium
stdlib go1.21.6 go-module CVE-2024-24785 Unknown ssl_client 1.36.1-r15 apk CVE-2023-42365 Medium
stdlib go1.21.6 go-module CVE-2024-24784 Unknown ssl_client 1.36.1-r15 apk CVE-2023-42364 Medium
stdlib go1.21.6 go-module CVE-2024-24783 Unknown ssl_client 1.36.1-r15 apk CVE-2023-42363 Medium
stdlib go1.21.6 go-module CVE-2023-45290 Unknown
stdlib go1.21.6 go-module CVE-2023-45289 Unknown
``` ```
### weaveexec: (19) ### weaveexec: (17)
``` ```
NAME INSTALLED FIXED-IN TYPE VULNERABILITY SEVERITY NAME INSTALLED FIXED-IN TYPE VULNERABILITY SEVERITY
busybox 1.36.1-r15 apk CVE-2023-42366 Medium busybox 1.36.1-r15 apk CVE-2023-42366 Medium
busybox 1.36.1-r15 apk CVE-2023-42365 Medium busybox 1.36.1-r15 apk CVE-2023-42365 Medium
busybox 1.36.1-r15 apk CVE-2023-42364 Medium busybox 1.36.1-r15 apk CVE-2023-42364 Medium
busybox 1.36.1-r15 apk CVE-2023-42363 Medium busybox 1.36.1-r15 apk CVE-2023-42363 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42366 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42366 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42365 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42365 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42364 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42364 Medium
busybox-binsh 1.36.1-r15 apk CVE-2023-42363 Medium busybox-binsh 1.36.1-r15 apk CVE-2023-42363 Medium
curl 8.5.0-r0 apk CVE-2024-0853 Medium curl 8.5.0-r0 apk CVE-2024-0853 Medium
libuv 1.47.0-r0 apk CVE-2024-24806 High curl 8.5.0-r0 apk CVE-2024-2466 Unknown
ssl_client 1.36.1-r15 apk CVE-2023-42366 Medium curl 8.5.0-r0 apk CVE-2024-2398 Unknown
ssl_client 1.36.1-r15 apk CVE-2023-42365 Medium curl 8.5.0-r0 apk CVE-2024-2004 Unknown
ssl_client 1.36.1-r15 apk CVE-2023-42364 Medium libuv 1.47.0-r0 apk CVE-2024-24806 High
ssl_client 1.36.1-r15 apk CVE-2023-42363 Medium ssl_client 1.36.1-r15 apk CVE-2023-42366 Medium
stdlib go1.21.6 go-module CVE-2024-24785 Unknown ssl_client 1.36.1-r15 apk CVE-2023-42365 Medium
stdlib go1.21.6 go-module CVE-2024-24784 Unknown ssl_client 1.36.1-r15 apk CVE-2023-42364 Medium
stdlib go1.21.6 go-module CVE-2024-24783 Unknown ssl_client 1.36.1-r15 apk CVE-2023-42363 Medium
stdlib go1.21.6 go-module CVE-2023-45290 Unknown
stdlib go1.21.6 go-module CVE-2023-45289 Unknown
``` ```
+1 -1
View File
@@ -27,7 +27,7 @@ for im in ${IMAGE_LIST};do
done done
#UNIQUECOUNT=$(tail -n +2 -q "${SCANDIR}/weave-npc-list-vulns.txt" "${SCANDIR}/weave-kube-list-vulns.txt" | sort -u | wc -l) #UNIQUECOUNT=$(tail -n +2 -q "${SCANDIR}/weave-npc-list-vulns.txt" "${SCANDIR}/weave-kube-list-vulns.txt" | sort -u | wc -l)
UNIQUECOUNT=$(tail -n +2 -q "${SCANDIR}"/*-list-vulns.txt | sort -u | wc -l) UNIQUECOUNT=$(tail -n +2 -q "${SCANDIR}"/*-list-vulns.txt | sed -e "s/\s\{2,\}/,/g" | sort -u | wc -l)
BADGECOLOR="blue" BADGECOLOR="blue"
if [ "$UNIQUECOUNT" -gt "0" ]; then if [ "$UNIQUECOUNT" -gt "0" ]; then
+1 -3
View File
@@ -3011,8 +3011,6 @@ definitions:
Name: "journald" Name: "journald"
- Type: "Log" - Type: "Log"
Name: "json-file" Name: "json-file"
- Type: "Log"
Name: "logentries"
- Type: "Log" - Type: "Log"
Name: "splunk" Name: "splunk"
- Type: "Log" - Type: "Log"
@@ -5334,7 +5332,7 @@ definitions:
type: "array" type: "array"
items: items:
type: "string" type: "string"
example: ["awslogs", "fluentd", "gcplogs", "gelf", "journald", "json-file", "logentries", "splunk", "syslog"] example: ["awslogs", "fluentd", "gcplogs", "gelf", "journald", "json-file", "splunk", "syslog"]
RegistryServiceConfig: RegistryServiceConfig:
+6 -2
View File
@@ -66,8 +66,12 @@ func (cli *Client) ContainerWait(ctx context.Context, containerID string, condit
// //
// If there's a JSON parsing error, read the real error message // If there's a JSON parsing error, read the real error message
// off the body and send it to the client. // off the body and send it to the client.
_, _ = io.ReadAll(io.LimitReader(stream, containerWaitErrorMsgLimit)) if errors.As(err, new(*json.SyntaxError)) {
errC <- errors.New(responseText.String()) _, _ = io.ReadAll(io.LimitReader(stream, containerWaitErrorMsgLimit))
errC <- errors.New(responseText.String())
} else {
errC <- err
}
return return
} }
+4 -10
View File
@@ -11,17 +11,11 @@ import (
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"strconv" "strconv"
"sync"
"syscall" "syscall"
"github.com/opencontainers/runc/libcontainer/user" "github.com/opencontainers/runc/libcontainer/user"
) )
var (
entOnce sync.Once
getentCmd string
)
func mkdirAs(path string, mode os.FileMode, owner Identity, mkAll, chownExisting bool) error { func mkdirAs(path string, mode os.FileMode, owner Identity, mkAll, chownExisting bool) error {
path, err := filepath.Abs(path) path, err := filepath.Abs(path)
if err != nil { if err != nil {
@@ -162,10 +156,10 @@ func getentGroup(name string) (user.Group, error) {
} }
func callGetent(database, key string) (io.Reader, error) { func callGetent(database, key string) (io.Reader, error) {
entOnce.Do(func() { getentCmd, _ = resolveBinary("getent") }) getentCmd, err := resolveBinary("getent")
// if no `getent` command on host, can't do anything else // if no `getent` command within the execution environment, can't do anything else
if getentCmd == "" { if err != nil {
return nil, fmt.Errorf("unable to find getent command") return nil, fmt.Errorf("unable to find getent command: %w", err)
} }
command := exec.Command(getentCmd, database, key) command := exec.Command(getentCmd, database, key)
// we run getent within container filesystem, but without /dev so /dev/null is not available for exec to mock stdin // we run getent within container filesystem, but without /dev so /dev/null is not available for exec to mock stdin
+21
View File
@@ -3,11 +3,15 @@ package ioutils // import "github.com/docker/docker/pkg/ioutils"
import ( import (
"context" "context"
"io" "io"
"runtime/debug"
"sync/atomic"
// make sure crypto.SHA256, crypto.sha512 and crypto.SHA384 are registered // make sure crypto.SHA256, crypto.sha512 and crypto.SHA384 are registered
// TODO remove once https://github.com/opencontainers/go-digest/pull/64 is merged. // TODO remove once https://github.com/opencontainers/go-digest/pull/64 is merged.
_ "crypto/sha256" _ "crypto/sha256"
_ "crypto/sha512" _ "crypto/sha512"
"github.com/sirupsen/logrus"
) )
// ReadCloserWrapper wraps an io.Reader, and implements an io.ReadCloser // ReadCloserWrapper wraps an io.Reader, and implements an io.ReadCloser
@@ -16,10 +20,15 @@ import (
type ReadCloserWrapper struct { type ReadCloserWrapper struct {
io.Reader io.Reader
closer func() error closer func() error
closed atomic.Bool
} }
// Close calls back the passed closer function // Close calls back the passed closer function
func (r *ReadCloserWrapper) Close() error { func (r *ReadCloserWrapper) Close() error {
if !r.closed.CompareAndSwap(false, true) {
subsequentCloseWarn("ReadCloserWrapper")
return nil
}
return r.closer() return r.closer()
} }
@@ -87,6 +96,7 @@ type cancelReadCloser struct {
cancel func() cancel func()
pR *io.PipeReader // Stream to read from pR *io.PipeReader // Stream to read from
pW *io.PipeWriter pW *io.PipeWriter
closed atomic.Bool
} }
// NewCancelReadCloser creates a wrapper that closes the ReadCloser when the // NewCancelReadCloser creates a wrapper that closes the ReadCloser when the
@@ -146,6 +156,17 @@ func (p *cancelReadCloser) closeWithError(err error) {
// Close closes the wrapper its underlying reader. It will cause // Close closes the wrapper its underlying reader. It will cause
// future calls to Read to return io.EOF. // future calls to Read to return io.EOF.
func (p *cancelReadCloser) Close() error { func (p *cancelReadCloser) Close() error {
if !p.closed.CompareAndSwap(false, true) {
subsequentCloseWarn("cancelReadCloser")
return nil
}
p.closeWithError(io.EOF) p.closeWithError(io.EOF)
return nil return nil
} }
func subsequentCloseWarn(name string) {
logrus.Error("subsequent attempt to close " + name)
if logrus.GetLevel() >= logrus.DebugLevel {
logrus.Errorf("stack trace: %s", string(debug.Stack()))
}
}
+9 -1
View File
@@ -1,6 +1,9 @@
package ioutils // import "github.com/docker/docker/pkg/ioutils" package ioutils // import "github.com/docker/docker/pkg/ioutils"
import "io" import (
"io"
"sync/atomic"
)
// NopWriter represents a type which write operation is nop. // NopWriter represents a type which write operation is nop.
type NopWriter struct{} type NopWriter struct{}
@@ -29,9 +32,14 @@ func (f *NopFlusher) Flush() {}
type writeCloserWrapper struct { type writeCloserWrapper struct {
io.Writer io.Writer
closer func() error closer func() error
closed atomic.Bool
} }
func (r *writeCloserWrapper) Close() error { func (r *writeCloserWrapper) Close() error {
if !r.closed.CompareAndSwap(false, true) {
subsequentCloseWarn("WriteCloserWrapper")
return nil
}
return r.closer() return r.closer()
} }
+1 -1
View File
@@ -95,7 +95,7 @@ github.com/davecgh/go-spew/spew
## explicit ## explicit
github.com/docker/distribution/digestset github.com/docker/distribution/digestset
github.com/docker/distribution/reference github.com/docker/distribution/reference
# github.com/docker/docker v24.0.7+incompatible # github.com/docker/docker v24.0.9+incompatible
## explicit ## explicit
github.com/docker/docker/api github.com/docker/docker/api
github.com/docker/docker/api/types github.com/docker/docker/api/types