!309 [sync] PR-305: sync from upstream

From: @openeuler-sync-bot 
Reviewed-by: @xuxuepeng 
Signed-off-by: @xuxuepeng
This commit is contained in:
openeuler-ci-bot 2024-04-12 01:50:21 +00:00 committed by Gitee
commit 8993bdcecf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
9 changed files with 222 additions and 13 deletions

View File

@ -1,7 +1,7 @@
From 3bcb8f3f60abb6ab6cde999cadb6a836744d4104 Mon Sep 17 00:00:00 2001 From 3bcb8f3f60abb6ab6cde999cadb6a836744d4104 Mon Sep 17 00:00:00 2001
From: jikai <jikai11@huawei.com> From: jikai <jikai11@huawei.com>
Date: Thu, 11 Jan 2024 19:00:19 +0800 Date: Thu, 11 Jan 2024 19:00:19 +0800
Subject: [PATCH 1/3] add systemd-cgroup field in isulad and shim config Subject: [PATCH 1/8] add systemd-cgroup field in isulad and shim config
Signed-off-by: jikai <jikai11@huawei.com> Signed-off-by: jikai <jikai11@huawei.com>
--- ---
@ -38,5 +38,5 @@ index 2383b43..15dbe91 100644
} }
} }
-- --
2.33.0 2.34.1

View File

@ -1,7 +1,7 @@
From 30558b07c80895e748e4754010d3bfa99f1a52da Mon Sep 17 00:00:00 2001 From 30558b07c80895e748e4754010d3bfa99f1a52da Mon Sep 17 00:00:00 2001
From: xuxuepeng <xuxuepeng1@huawei.com> From: xuxuepeng <xuxuepeng1@huawei.com>
Date: Mon, 19 Feb 2024 23:41:50 +0800 Date: Mon, 19 Feb 2024 23:41:50 +0800
Subject: [PATCH 2/3] Add http-parser as third party component Subject: [PATCH 2/8] Add http-parser as third party component
Signed-off-by: xuxuepeng <xuxuepeng1@huawei.com> Signed-off-by: xuxuepeng <xuxuepeng1@huawei.com>
--- ---
@ -3118,5 +3118,5 @@ index 0000000..df88252
+#endif +#endif
+#endif +#endif
-- --
2.33.0 2.34.1

View File

@ -1,7 +1,7 @@
From 19655a5df138acda0a57b0411bc69f82511a32b4 Mon Sep 17 00:00:00 2001 From 19655a5df138acda0a57b0411bc69f82511a32b4 Mon Sep 17 00:00:00 2001
From: jikai <jikai11@huawei.com> From: jikai <jikai11@huawei.com>
Date: Wed, 13 Mar 2024 15:21:09 +0800 Date: Wed, 13 Mar 2024 15:21:09 +0800
Subject: [PATCH 4/5] add enable pod events field Subject: [PATCH 3/8] add enable pod events field
Signed-off-by: jikai <jikai11@huawei.com> Signed-off-by: jikai <jikai11@huawei.com>
--- ---
@ -23,5 +23,5 @@ index 46cf9e2..bbacfd6 100644
} }
} }
-- --
2.25.1 2.34.1

View File

@ -1,7 +1,7 @@
From 299f54b13a85855540e6d28e9c9bfefb7bc66f14 Mon Sep 17 00:00:00 2001 From 299f54b13a85855540e6d28e9c9bfefb7bc66f14 Mon Sep 17 00:00:00 2001
From: jikai <jikai11@huawei.com> From: jikai <jikai11@huawei.com>
Date: Fri, 12 Jan 2024 11:30:34 +0800 Date: Fri, 12 Jan 2024 11:30:34 +0800
Subject: [PATCH 3/3] add swap usage fields in shim stats and container info Subject: [PATCH 4/8] add swap usage fields in shim stats and container info
Signed-off-by: jikai <jikai11@huawei.com> Signed-off-by: jikai <jikai11@huawei.com>
--- ---
@ -49,5 +49,5 @@ index 35cfe64..9d92a81 100644
} }
}, },
-- --
2.33.0 2.34.1

View File

@ -1,7 +1,7 @@
From 5adb5c82cb48f55fec1d6750e0648a0ffc5a372c Mon Sep 17 00:00:00 2001 From 5adb5c82cb48f55fec1d6750e0648a0ffc5a372c Mon Sep 17 00:00:00 2001
From: jikai <jikai11@huawei.com> From: jikai <jikai11@huawei.com>
Date: Mon, 18 Mar 2024 20:23:58 +0800 Date: Mon, 18 Mar 2024 20:23:58 +0800
Subject: [PATCH 5/5] Add oomkilled field in inspect.json Subject: [PATCH 5/8] Add oomkilled field in inspect.json
Signed-off-by: jikai <jikai11@huawei.com> Signed-off-by: jikai <jikai11@huawei.com>
--- ---
@ -23,5 +23,5 @@ index 9c76c33..89cb871 100644
"type": "integer" "type": "integer"
}, },
-- --
2.25.1 2.34.1

View File

@ -0,0 +1,27 @@
From ffe13775740957f55c4a87cdee63481b1e6f4adb Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Mon, 8 Apr 2024 11:38:21 +0800
Subject: [PATCH 6/8] add runtime in process-state
Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
src/json/schema/shim/client/process-state.json | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/json/schema/shim/client/process-state.json b/src/json/schema/shim/client/process-state.json
index 15dbe91..bfa8416 100644
--- a/src/json/schema/shim/client/process-state.json
+++ b/src/json/schema/shim/client/process-state.json
@@ -178,6 +178,9 @@
"resizeFifo": {
"type": "string"
},
+ "runtime": {
+ "type": "string"
+ },
"runtimeArgs": {
"type": "array",
"items": {
--
2.34.1

View File

@ -0,0 +1,148 @@
From 27b2deef3e4d64b44a7a4cdfd76ac99bfad80f64 Mon Sep 17 00:00:00 2001
From: zhongtao <zhongtao17@huawei.com>
Date: Tue, 9 Apr 2024 10:34:32 +0800
Subject: [PATCH 7/8] restore bufsize to prevent log loss
Signed-off-by: zhongtao <zhongtao17@huawei.com>
---
src/constants.h | 3 ---
src/runtime/conf.c | 2 +-
src/runtime/error.c | 12 ++++++------
src/runtime/lcrcontainer.c | 2 +-
src/runtime/lcrcontainer_execute.c | 4 ++--
src/third_party/libocispec/read_file.c | 5 -----
6 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/src/constants.h b/src/constants.h
index b62026d..d29a872 100644
--- a/src/constants.h
+++ b/src/constants.h
@@ -54,9 +54,6 @@ extern "C" {
#define DEBUG_DIRECTORY_MODE 0750
-/* buffer constants defined here */
-#define ISULA_PAGE_BUFSIZE 4096
-
#ifdef __cplusplus
}
#endif
diff --git a/src/runtime/conf.c b/src/runtime/conf.c
index b9da377..de07353 100644
--- a/src/runtime/conf.c
+++ b/src/runtime/conf.c
@@ -2931,7 +2931,7 @@ static struct isula_linked_list *trans_oci_linux_sysctl(const json_map_string_st
isula_linked_list_init(conf);
for (i = 0; i < sysctl->len; i++) {
- char sysk[ISULA_PAGE_BUFSIZE] = { 0 };
+ char sysk[BUFSIZ] = { 0 };
int nret = snprintf(sysk, sizeof(sysk), "lxc.sysctl.%s", sysctl->keys[i]);
if (nret < 0 || (size_t)nret >= sizeof(sysk)) {
ERROR("Failed to print string");
diff --git a/src/runtime/error.c b/src/runtime/error.c
index 7eb4832..d0bfcce 100644
--- a/src/runtime/error.c
+++ b/src/runtime/error.c
@@ -66,12 +66,12 @@ void clear_error_message(engine_error_t *error)
void lcr_set_error_message(lcr_errno_t errcode, const char *format, ...)
{
int ret = 0;
- char errbuf[ISULA_PAGE_BUFSIZE + 1] = { 0 };
+ char errbuf[BUFSIZ + 1] = { 0 };
va_list argp;
va_start(argp, format);
- ret = vsnprintf(errbuf, ISULA_PAGE_BUFSIZE, format, argp);
+ ret = vsnprintf(errbuf, BUFSIZ, format, argp);
va_end(argp);
clear_error_message(&g_lcr_error);
if (ret < 0) {
@@ -85,14 +85,14 @@ void lcr_set_error_message(lcr_errno_t errcode, const char *format, ...)
void lcr_try_set_error_message(lcr_errno_t errcode, const char *format, ...)
{
int ret = 0;
- char errbuf[ISULA_PAGE_BUFSIZE + 1] = { 0 };
+ char errbuf[BUFSIZ + 1] = { 0 };
va_list argp;
if (g_lcr_error.errmsg != NULL || g_lcr_error.errcode != LCR_SUCCESS) {
return;
}
va_start(argp, format);
- ret = vsnprintf(errbuf, ISULA_PAGE_BUFSIZE, format, argp);
+ ret = vsnprintf(errbuf, BUFSIZ, format, argp);
va_end(argp);
clear_error_message(&g_lcr_error);
if (ret < 0) {
@@ -106,13 +106,13 @@ void lcr_try_set_error_message(lcr_errno_t errcode, const char *format, ...)
void lcr_append_error_message(lcr_errno_t errcode, const char *format, ...)
{
int ret = 0;
- char errbuf[ISULA_PAGE_BUFSIZE + 1] = { 0 };
+ char errbuf[BUFSIZ + 1] = { 0 };
char *result = NULL;
va_list argp;
va_start(argp, format);
- ret = vsnprintf(errbuf, ISULA_PAGE_BUFSIZE, format, argp);
+ ret = vsnprintf(errbuf, BUFSIZ, format, argp);
va_end(argp);
if (ret < 0) {
g_lcr_error.errcode = LCR_ERR_FORMAT;
diff --git a/src/runtime/lcrcontainer.c b/src/runtime/lcrcontainer.c
index f93afb8..2f0c9dd 100644
--- a/src/runtime/lcrcontainer.c
+++ b/src/runtime/lcrcontainer.c
@@ -227,7 +227,7 @@ static bool wait_start_pid(pid_t pid, int rfd, const char *name, const char *pat
{
int ret;
ssize_t size_read = 0;
- char buffer[ISULA_PAGE_BUFSIZE] = { 0 };
+ char buffer[BUFSIZ] = { 0 };
ret = isula_wait_pid(pid);
if (ret == 0) {
diff --git a/src/runtime/lcrcontainer_execute.c b/src/runtime/lcrcontainer_execute.c
index 5c327f5..251fb85 100644
--- a/src/runtime/lcrcontainer_execute.c
+++ b/src/runtime/lcrcontainer_execute.c
@@ -927,7 +927,7 @@ bool do_attach(const char *name, const char *path, const struct lcr_exec_request
bool ret = false;
pid_t pid = 0;
ssize_t size_read = 0;
- char buffer[ISULA_PAGE_BUFSIZE + 1] = {0};
+ char buffer[BUFSIZ + 1] = {0};
int pipefd[2] = {-1, -1};
int status = 0;
@@ -980,7 +980,7 @@ bool do_attach(const char *name, const char *path, const struct lcr_exec_request
*exit_code = do_attach_get_exit_code(status);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
- size_read = read(pipefd[0], buffer, ISULA_PAGE_BUFSIZE);
+ size_read = read(pipefd[0], buffer, BUFSIZ);
/* if we read errmsg means the runtime failed to exec */
if (size_read > 0) {
ERROR("Runtime error: %s", buffer);
diff --git a/src/third_party/libocispec/read_file.c b/src/third_party/libocispec/read_file.c
index 41bb650..b7c0232 100644
--- a/src/third_party/libocispec/read_file.c
+++ b/src/third_party/libocispec/read_file.c
@@ -21,11 +21,6 @@
#include <limits.h>
#include <stdio.h>
-#ifndef BUFSIZ
-// default use BUFSIZ from stdio.h
-#define BUFSIZ 8096
-#endif
-
#ifndef JSON_MAX_SIZE
#define JSON_MAX_SIZE (10LL * 1024LL * 1024LL)
#endif
--
2.34.1

View File

@ -0,0 +1,25 @@
From f1d0acce748fdccb750424b75f5de8fd760fb98e Mon Sep 17 00:00:00 2001
From: luofeng14 <luofeng13@huawei.com>
Date: Wed, 10 Apr 2024 11:29:29 +0800
Subject: [PATCH 8/8] support clang build
---
cmake/set_build_flags.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/set_build_flags.cmake b/cmake/set_build_flags.cmake
index 7d4c9fc..5374f33 100644
--- a/cmake/set_build_flags.cmake
+++ b/cmake/set_build_flags.cmake
@@ -21,7 +21,7 @@
#
# set common FLAGS
-set(CMAKE_C_FLAGS "-fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -Wall -fPIE")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -Wall -fPIE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'")
include(CheckCXXCompilerFlag)
--
2.34.1

View File

@ -1,5 +1,5 @@
%global _version 2.1.4 %global _version 2.1.4
%global _release 4 %global _release 5
%global _inner_name isula_libutils %global _inner_name isula_libutils
%global enable_lxc 1 %global enable_lxc 1
@ -15,9 +15,12 @@ BuildRoot: %{_tmppath}/lcr-%{version}
Patch0001: 0001-add-systemd-cgroup-field-in-isulad-and-shim-config.patch Patch0001: 0001-add-systemd-cgroup-field-in-isulad-and-shim-config.patch
Patch0002: 0002-Add-http-parser-as-third-party-component.patch Patch0002: 0002-Add-http-parser-as-third-party-component.patch
Patch0003: 0003-add-swap-usage-fields-in-shim-stats-and-container-in.patch Patch0003: 0003-add-enable-pod-events-field.patch
Patch0004: 0004-add-enable-pod-events-field.patch Patch0004: 0004-add-swap-usage-fields-in-shim-stats-and-container-in.patch
Patch0005: 0005-Add-oomkilled-field-in-inspect.json.patch Patch0005: 0005-Add-oomkilled-field-in-inspect.json.patch
Patch0006: 0006-add-runtime-in-process-state.patch
Patch0007: 0007-restore-bufsize-to-prevent-log-loss.patch
Patch0008: 0008-support-clang-build.patch
%define lxcver_lower 4.0.3-2022102400 %define lxcver_lower 4.0.3-2022102400
%define lxcver_upper 5.0.3 %define lxcver_upper 5.0.3
@ -134,6 +137,12 @@ rm -rf %{buildroot}
%{_includedir}/lcr/utils_compile.h %{_includedir}/lcr/utils_compile.h
%changelog %changelog
* Thu Apr 11 2024 jikai<jikai11@huawei.com> - 2.1.4-5
- Type:enhancement
- CVE:NA
- SUG:NA
- DESC:sync from upstream
* Sat Mar 30 2024 zhongtao<zhongtao17@huawei.com> - 2.1.4-4 * Sat Mar 30 2024 zhongtao<zhongtao17@huawei.com> - 2.1.4-4
- Type:bugfix - Type:bugfix
- CVE:NA - CVE:NA