summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-containers/containerd/containerd-opencontainers/CVE-2025-64329.patch80
-rw-r--r--recipes-containers/containerd/containerd-opencontainers_git.bb1
2 files changed, 81 insertions, 0 deletions
diff --git a/recipes-containers/containerd/containerd-opencontainers/CVE-2025-64329.patch b/recipes-containers/containerd/containerd-opencontainers/CVE-2025-64329.patch
new file mode 100644
index 00000000..a3cc5e85
--- /dev/null
+++ b/recipes-containers/containerd/containerd-opencontainers/CVE-2025-64329.patch
@@ -0,0 +1,80 @@
1From c575d1b5f4011f33b32f71ace75367a92b08c750 Mon Sep 17 00:00:00 2001
2From: wheat2018 <1151937289@qq.com>
3Date: Tue, 13 Aug 2024 15:56:31 +0800
4Subject: [PATCH] fix goroutine leak of container Attach
5
6The monitor goroutine (runs (*ContainerIO).Attach.func1) of Attach will
7never finish if it attaches to a container without any stdout or stderr
8output. Wait for http context cancel and break the pipe actively to
9address the issue.
10
11Signed-off-by: wheat2018 <1151937289@qq.com>
12Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
13(cherry picked from commit a0d0f0ef68935338d2c710db164fa7820f692530)
14Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
15
16Excluded pkg/cri/sbserver/container_attach.go changes as the file not
17present in our current vrsion 1.6.19
18
19Upstream-Status: Backport [https://github.com/containerd/containerd/commit/c575d1b5f4011f33b32f71ace75367a92b08c750]
20CVE: CVE-2025-64329
21Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
22---
23 pkg/cri/io/container_io.go | 14 +++++++++++---
24 pkg/cri/server/container_attach.go | 2 +-
25 2 files changed, 12 insertions(+), 4 deletions(-)
26
27diff --git a/pkg/cri/io/container_io.go b/pkg/cri/io/container_io.go
28index 70bc8b789..e1584100f 100644
29--- a/pkg/cri/io/container_io.go
30+++ b/pkg/cri/io/container_io.go
31@@ -17,6 +17,7 @@
32 package io
33
34 import (
35+ "context"
36 "errors"
37 "io"
38 "strings"
39@@ -134,7 +135,7 @@ func (c *ContainerIO) Pipe() {
40
41 // Attach attaches container stdio.
42 // TODO(random-liu): Use pools.Copy in docker to reduce memory usage?
43-func (c *ContainerIO) Attach(opts AttachOptions) {
44+func (c *ContainerIO) Attach(ctx context.Context, opts AttachOptions) {
45 var wg sync.WaitGroup
46 key := util.GenerateID()
47 stdinKey := streamKey(c.id, "attach-"+key, Stdin)
48@@ -175,8 +176,15 @@ func (c *ContainerIO) Attach(opts AttachOptions) {
49 }
50
51 attachStream := func(key string, close <-chan struct{}) {
52- <-close
53- logrus.Infof("Attach stream %q closed", key)
54+ select {
55+ case <-close:
56+ logrus.Infof("Attach stream %q closed", key)
57+ case <-ctx.Done():
58+ logrus.Infof("Attach client of %q cancelled", key)
59+ // Avoid writeGroup heap up
60+ c.stdoutGroup.Remove(key)
61+ c.stderrGroup.Remove(key)
62+ }
63 // Make sure stdin gets closed.
64 if stdinStreamRC != nil {
65 stdinStreamRC.Close()
66diff --git a/pkg/cri/server/container_attach.go b/pkg/cri/server/container_attach.go
67index a95215051..3625229f9 100644
68--- a/pkg/cri/server/container_attach.go
69+++ b/pkg/cri/server/container_attach.go
70@@ -79,6 +79,6 @@ func (c *criService) attachContainer(ctx context.Context, id string, stdin io.Re
71 },
72 }
73 // TODO(random-liu): Figure out whether we need to support historical output.
74- cntr.IO.Attach(opts)
75+ cntr.IO.Attach(ctx, opts)
76 return nil
77 }
78--
792.25.1
80
diff --git a/recipes-containers/containerd/containerd-opencontainers_git.bb b/recipes-containers/containerd/containerd-opencontainers_git.bb
index 264d37a6..05683d26 100644
--- a/recipes-containers/containerd/containerd-opencontainers_git.bb
+++ b/recipes-containers/containerd/containerd-opencontainers_git.bb
@@ -11,6 +11,7 @@ SRC_URI = "git://github.com/containerd/containerd;branch=release/1.6;protocol=ht
11 file://0001-build-don-t-use-gcflags-to-define-trimpath.patch \ 11 file://0001-build-don-t-use-gcflags-to-define-trimpath.patch \
12 file://CVE-2024-40635.patch \ 12 file://CVE-2024-40635.patch \
13 file://CVE-2024-25621.patch \ 13 file://CVE-2024-25621.patch \
14 file://CVE-2025-64329.patch \
14 " 15 "
15 16
16# Apache-2.0 for containerd 17# Apache-2.0 for containerd