runc:fix init error return logic

This commit is contained in:
zhongjiawei 2023-09-18 15:43:50 +08:00
parent 3ccd284b74
commit 8feee0899f
4 changed files with 54 additions and 2 deletions

View File

@ -1 +1 @@
18c0c57644a490630eb21eec622d493d3e1e6164
09a056364fa76117ea9b193cb4266265e5683db3

View File

@ -0,0 +1,45 @@
From 3067c7503547e7c1f2499a69b1713051515743e0 Mon Sep 17 00:00:00 2001
From: Kir Kolyshkin <kolyshkin@gmail.com>
Date: Wed, 9 Aug 2023 12:04:26 +0900
Subject: [PATCH] libct/init: unify init, fix its error logic
Fix init error handling logic.
The main issues at hand are:
- the "unable to convert _LIBCONTAINER_INITPIPE" error from
StartInitialization is never shown;
- errors from WriteSync and WriteJSON are never shown;
Generally, our goals are:
- if there's any error, do our best to show it;
- but only show each error once;
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
---
libcontainer/factory_linux.go | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libcontainer/factory_linux.go b/libcontainer/factory_linux.go
index a1fa7de..86a127c 100644
--- a/libcontainer/factory_linux.go
+++ b/libcontainer/factory_linux.go
@@ -296,13 +296,14 @@ func (l *LinuxFactory) StartInitialization() (err error) {
// We have an error during the initialization of the container's init,
// send it back to the parent process in the form of an initError.
if werr := writeSync(pipe, procError); werr != nil {
- fmt.Fprintln(os.Stderr, err)
+ fmt.Fprintln(os.Stderr, werr)
return
}
if werr := utils.WriteJSON(pipe, &initError{Message: err.Error()}); werr != nil {
- fmt.Fprintln(os.Stderr, err)
+ fmt.Fprintln(os.Stderr, werr)
return
}
+ err = nil
}()
// Only init processes have FIFOFD.
--
2.33.0

View File

@ -3,7 +3,7 @@
Name: docker-runc
Version: 1.1.8
Release: 4
Release: 5
Summary: runc is a CLI tool for spawning and running containers according to the OCI specification.
License: ASL 2.0
@ -54,6 +54,12 @@ install -p -m 755 runc $RPM_BUILD_ROOT/%{_bindir}/runc
%{_bindir}/runc
%changelog
* Mon Sep 18 2023 zhongjiawei<zhongjiawei1@huawei.com> - 1.1.8-5
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix init error return logic
* Tue Sep 12 2023 zhongjiawei<zhongjiawei1@huawei.com> - 1.1.8-4
- Type:bugfix
- ID:NA

View File

@ -25,3 +25,4 @@ patch/0025-runc-make-runc-spec-compatible-1.0.0.rc3.patch
patch/0026-runc-Fixed-init-state-error-variable.patch
patch/0027-runc-libct-fix-shared-pidns-detection.patch
patch/0028-runc-nsenter-cloned_binary-remove-bindfd-logic-entirely.patch
patch/0029-runc-libct-init-unify-init-fix-its-error-logic.patch