!198 [sync] PR-192: runc:fix the bug when runc syscall.Exec cmd not exist cause panic

From: @openeuler-sync-bot 
Reviewed-by: @duguhaotian 
Signed-off-by: @duguhaotian
This commit is contained in:
openeuler-ci-bot 2023-10-27 01:30:59 +00:00 committed by Gitee
commit cdd1fdd721
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 28 additions and 3 deletions

View File

@ -1,4 +1,4 @@
From a6670de912095206f356b8b7b486d237d1012c88 Mon Sep 17 00:00:00 2001
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
@ -17,7 +17,8 @@ Generally, our goals are:
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
---
libcontainer/factory_linux.go | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
main_unix.go | 7 +++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libcontainer/factory_linux.go b/libcontainer/factory_linux.go
index e4ef518..0b2aa74 100644
@ -40,6 +41,24 @@ index e4ef518..0b2aa74 100644
}()
defer func() {
if e := recover(); e != nil {
diff --git a/main_unix.go b/main_unix.go
index 0479949..24e64b9 100644
--- a/main_unix.go
+++ b/main_unix.go
@@ -37,10 +37,9 @@ var initCommand = cli.Command{
factory, _ := libcontainer.New("")
if err := factory.StartInitialization(); err != nil {
fmt.Fprintf(os.Stderr, "libcontainer: container start initialization failed: %s", err)
- // as the error is sent back to the parent there is no need to log
- // or write it to stderr because the parent process will handle this
- os.Exit(1)
}
- panic("libcontainer: container init failed to exec")
+ fmt.Fprint(os.Stderr, "libcontainer: container init failed to exec")
+ os.Exit(1)
+ return nil
},
}
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: docker-runc
Version: 1.0.0.rc3
Release: 217
Release: 218
Summary: runc is a CLI tool for spawning and running containers according to the OCI specification.
License: ASL 2.0
@ -41,6 +41,12 @@ install -p -m 755 runc $RPM_BUILD_ROOT/%{_bindir}/runc
%{_bindir}/runc
%changelog
* Thu Oct 26 2023 zhongjiawei<zhongjiawei1@huawei.com> - 1.0.0.rc3-218
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix the bug when runc syscall.Exec cmd not exist cause panic
* Tue Oct 24 2023 zhongjiawei<zhongjiawei1@huawei.com> - 1.0.0.rc3-217
- Type:bugfix
- ID:NA