From 14dc79a9775036a5c8cecff53ce5ce9c5b350bea Mon Sep 17 00:00:00 2001 From: jingxiaolu Date: Wed, 7 Dec 2022 09:43:56 +0800 Subject: [PATCH] add read lock in load/import/pull to fix GC preempts to exit subprocess Signed-off-by: jingxiaolu --- VERSION-vendor | 2 +- git-commit | 2 +- isula-build.spec | 8 ++- ...-load-import-and-pull-to-fix-the-pro.patch | 57 +++++++++++++++++++ series.conf | 1 + 5 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 patch/0128-add-read-lock-in-load-import-and-pull-to-fix-the-pro.patch diff --git a/VERSION-vendor b/VERSION-vendor index f523c77..1d41aa7 100644 --- a/VERSION-vendor +++ b/VERSION-vendor @@ -1 +1 @@ -0.9.6-14 +0.9.6-15 diff --git a/git-commit b/git-commit index 71bfd16..5481fd8 100644 --- a/git-commit +++ b/git-commit @@ -1 +1 @@ -e4b5a3bee5a69df32fb60b5eb8c28e1e8a39b59b +a5b09eac902299ff56b460324b6cb4db18a16a25 diff --git a/isula-build.spec b/isula-build.spec index d699f30..6965e67 100644 --- a/isula-build.spec +++ b/isula-build.spec @@ -2,7 +2,7 @@ Name: isula-build Version: 0.9.6 -Release: 14 +Release: 15 Summary: A tool to build container images License: Mulan PSL V2 URL: https://gitee.com/openeuler/isula-build @@ -85,6 +85,12 @@ fi /usr/share/bash-completion/completions/isula-build %changelog +* Wed Dec 07 2022 jingxiaolu - 0.9.6-15 +- Type:bugfix +- CVE:NA +- SUG:restart +- DESC:add read lock in load/import/pull to fix GC preempts to exit subprocess + * Wed Nov 23 2022 Lixiang - 0.9.6-14 - Type:bugfix - CVE:NA diff --git a/patch/0128-add-read-lock-in-load-import-and-pull-to-fix-the-pro.patch b/patch/0128-add-read-lock-in-load-import-and-pull-to-fix-the-pro.patch new file mode 100644 index 0000000..b7f06e5 --- /dev/null +++ b/patch/0128-add-read-lock-in-load-import-and-pull-to-fix-the-pro.patch @@ -0,0 +1,57 @@ +From f8952b39aa9251b7a46fcaf894a1afd9c0a2d5de Mon Sep 17 00:00:00 2001 +From: daisicheng +Date: Tue, 6 Dec 2022 10:41:34 +0800 +Subject: [PATCH] add read lock in load, import and pull to fix the problem + that GC preempts to exit subprocess + +--- + daemon/import.go | 3 +++ + daemon/load.go | 3 +++ + daemon/pull.go | 3 +++ + 3 files changed, 9 insertions(+) + +diff --git a/daemon/import.go b/daemon/import.go +index 21ab729..a0a475d 100644 +--- a/daemon/import.go ++++ b/daemon/import.go +@@ -38,6 +38,9 @@ import ( + + // Import an image from a tarball + func (b *Backend) Import(req *pb.ImportRequest, stream pb.Control_ImportServer) error { ++ b.daemon.RLock() ++ defer b.daemon.RUnlock() ++ + var ( + srcRef types.ImageReference + ctx = stream.Context() +diff --git a/daemon/load.go b/daemon/load.go +index 2d0c154..c071374 100644 +--- a/daemon/load.go ++++ b/daemon/load.go +@@ -79,6 +79,9 @@ func (b *Backend) getLoadOptions(req *pb.LoadRequest) (LoadOptions, error) { + + // Load loads the image + func (b *Backend) Load(req *pb.LoadRequest, stream pb.Control_LoadServer) error { ++ b.daemon.RLock() ++ defer b.daemon.RUnlock() ++ + logrus.WithFields(logrus.Fields{ + "LoadID": req.GetLoadID(), + }).Info("LoadRequest received") +diff --git a/daemon/pull.go b/daemon/pull.go +index 90be2a9..dc8af03 100644 +--- a/daemon/pull.go ++++ b/daemon/pull.go +@@ -40,6 +40,9 @@ type pullOptions struct { + + // Pull receives a pull request and pull the image from remote repository + func (b *Backend) Pull(req *pb.PullRequest, stream pb.Control_PullServer) error { ++ b.daemon.RLock() ++ defer b.daemon.RUnlock() ++ + logrus.WithFields(logrus.Fields{ + "PullID": req.GetPullID(), + "ImageName": req.GetImageName(), +-- +2.34.1 + diff --git a/series.conf b/series.conf index 3af2a63..3000d90 100644 --- a/series.conf +++ b/series.conf @@ -36,3 +36,4 @@ patch/0124-add-the-constraints-and-limitations-of-the-doc.patch patch/0125-fix-the-possible-file-leakage-problem-in-util-cipher.patch patch/0126-improve-security-compile-option-of-isula-build-binar.patch patch/0127-Fix-the-problem-that-the-var-lib-isula-build-storage.patch +patch/0128-add-read-lock-in-load-import-and-pull-to-fix-the-pro.patch