diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-17 07:36:31 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-17 07:36:31 +0000 |
commit | 5de4bc645d087edfbc848d43ac0019a6535a3c73 (patch) | |
tree | 7354cf7f0504f1020c7c3165c77c21ef9257cbb4 /0026-Fix-PR-runc.patch | |
parent | 4a79e40e226e2077b5e8cc274610e473b148f507 (diff) |
automatic import of iSuladopeneuler20.03
Diffstat (limited to '0026-Fix-PR-runc.patch')
-rw-r--r-- | 0026-Fix-PR-runc.patch | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/0026-Fix-PR-runc.patch b/0026-Fix-PR-runc.patch new file mode 100644 index 0000000..0467a7c --- /dev/null +++ b/0026-Fix-PR-runc.patch @@ -0,0 +1,108 @@ +From 39d7fd140e8b590a925e5cdf8ace20b0161328c8 Mon Sep 17 00:00:00 2001 +From: sailorvii <chenw66@chinaunicom.cn> +Date: Mon, 27 Feb 2023 02:33:46 +0000 +Subject: [PATCH 26/53] =?UTF-8?q?Fix=20PR=20runc=E8=BF=90=E8=A1=8C?= + =?UTF-8?q?=E5=A4=B1=E8=B4=A5.?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The environment NOTIFY_SOCKET is used when runc start but not runc create. +As the source code: https://github.com/opencontainers/runc/blob/main/start.go#L35. + +So move the related code to the right location. +--- + .../modules/runtime/isula/isula_rt_ops.c | 27 +++++++++---------- + 1 file changed, 13 insertions(+), 14 deletions(-) + +diff --git a/src/daemon/modules/runtime/isula/isula_rt_ops.c b/src/daemon/modules/runtime/isula/isula_rt_ops.c +index 6f2b4f7d..60742d42 100644 +--- a/src/daemon/modules/runtime/isula/isula_rt_ops.c ++++ b/src/daemon/modules/runtime/isula/isula_rt_ops.c +@@ -760,12 +760,6 @@ static int shim_create(bool fg, const char *id, const char *workdir, const char + goto realexec; + } + +- // clear NOTIFY_SOCKET from the env to adapt runc create +- if (unsetenv("NOTIFY_SOCKET") != 0) { +- (void)dprintf(exec_fd[1], "%s: unset env NOTIFY_SOCKET failed %s", id, strerror(errno)); +- exit(EXIT_FAILURE); +- } +- + pid = fork(); + if (pid < 0) { + (void)dprintf(exec_fd[1], "%s: fork shim-process failed %s", id, strerror(errno)); +@@ -945,7 +939,7 @@ int rt_isula_start(const char *id, const char *runtime, const rt_start_params_t + char shim_pid_file_name[PATH_MAX] = { 0 }; + pid_t pid = 0; + pid_t shim_pid = -1; +- int ret = 0; ++ int ret = -1; + int splice_ret = 0; + proc_t *proc = NULL; + proc_t *p_proc = NULL; +@@ -967,28 +961,24 @@ int rt_isula_start(const char *id, const char *runtime, const rt_start_params_t + + pid = get_container_process_pid(workdir); + if (pid < 0) { +- ret = -1; + ERROR("%s: failed wait init pid", id); + goto out; + } + + file_read_int(shim_pid_file_name, &shim_pid); + if (shim_pid < 0) { +- ret = -1; + ERROR("%s: failed to read isulad shim pid", id); + goto out; + } + + proc = util_get_process_proc_info(pid); + if (proc == NULL) { +- ret = -1; + ERROR("%s: failed to read pidinfo", id); + goto out; + } + + p_proc = util_get_process_proc_info(shim_pid); + if (p_proc == NULL) { +- ret = -1; + ERROR("%s: failed to read isulad shim pidinfo", id); + goto out; + } +@@ -998,20 +988,29 @@ int rt_isula_start(const char *id, const char *runtime, const rt_start_params_t + pid_info->ppid = shim_pid; + pid_info->pstart_time = p_proc->start_time; + ++ // clear NOTIFY_SOCKET from the env to adapt runc start ++ if (unsetenv("NOTIFY_SOCKET") != 0) { ++ ERROR("%s: unset env NOTIFY_SOCKET failed %s", id); ++ } ++ + if (runtime_call_simple(workdir, runtime, "start", NULL, 0, id, NULL) != 0) { + ERROR("call runtime start id failed"); +- ret = -1; + goto out; + } + ++ ret = 0; + out: + if (ret != 0) { + show_shim_runtime_errlog(workdir); + shim_kill_force(workdir); + } + +- free(proc); +- free(p_proc); ++ if (proc != NULL) { ++ free(proc); ++ } ++ if (p_proc != NULL) { ++ free(p_proc); ++ } + + return ret; + } +-- +2.25.1 + |