From f13a2bf9227d184d28d3b8b4ca0b7c0ee0f3ae8a Mon Sep 17 00:00:00 2001 From: jikai Date: Thu, 11 Apr 2024 09:19:36 +0000 Subject: [PATCH] sync from upstream Signed-off-by: jikai (cherry picked from commit 9329d5ff84b86110a33336bc9dccb83e3830a32d) --- ...roup-field-in-isulad-and-shim-config.patch | 4 +- ...http-parser-as-third-party-component.patch | 4 +- ... => 0003-add-enable-pod-events-field.patch | 4 +- ...ields-in-shim-stats-and-container-in.patch | 4 +- ...-Add-oomkilled-field-in-inspect.json.patch | 4 +- 0006-add-runtime-in-process-state.patch | 27 ++++ ...-restore-bufsize-to-prevent-log-loss.patch | 148 ++++++++++++++++++ 0008-support-clang-build.patch | 25 +++ lcr.spec | 15 +- 9 files changed, 222 insertions(+), 13 deletions(-) rename 0004-add-enable-pod-events-field.patch => 0003-add-enable-pod-events-field.patch (92%) rename 0003-add-swap-usage-fields-in-shim-stats-and-container-in.patch => 0004-add-swap-usage-fields-in-shim-stats-and-container-in.patch (96%) create mode 100644 0006-add-runtime-in-process-state.patch create mode 100644 0007-restore-bufsize-to-prevent-log-loss.patch create mode 100644 0008-support-clang-build.patch diff --git a/0001-add-systemd-cgroup-field-in-isulad-and-shim-config.patch b/0001-add-systemd-cgroup-field-in-isulad-and-shim-config.patch index 048dd9c..013df06 100644 --- a/0001-add-systemd-cgroup-field-in-isulad-and-shim-config.patch +++ b/0001-add-systemd-cgroup-field-in-isulad-and-shim-config.patch @@ -1,7 +1,7 @@ From 3bcb8f3f60abb6ab6cde999cadb6a836744d4104 Mon Sep 17 00:00:00 2001 From: jikai 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 --- @@ -38,5 +38,5 @@ index 2383b43..15dbe91 100644 } } -- -2.33.0 +2.34.1 diff --git a/0002-Add-http-parser-as-third-party-component.patch b/0002-Add-http-parser-as-third-party-component.patch index db2f774..5c5c190 100644 --- a/0002-Add-http-parser-as-third-party-component.patch +++ b/0002-Add-http-parser-as-third-party-component.patch @@ -1,7 +1,7 @@ From 30558b07c80895e748e4754010d3bfa99f1a52da Mon Sep 17 00:00:00 2001 From: xuxuepeng 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 --- @@ -3118,5 +3118,5 @@ index 0000000..df88252 +#endif +#endif -- -2.33.0 +2.34.1 diff --git a/0004-add-enable-pod-events-field.patch b/0003-add-enable-pod-events-field.patch similarity index 92% rename from 0004-add-enable-pod-events-field.patch rename to 0003-add-enable-pod-events-field.patch index bad0202..0aa6b02 100644 --- a/0004-add-enable-pod-events-field.patch +++ b/0003-add-enable-pod-events-field.patch @@ -1,7 +1,7 @@ From 19655a5df138acda0a57b0411bc69f82511a32b4 Mon Sep 17 00:00:00 2001 From: jikai 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 --- @@ -23,5 +23,5 @@ index 46cf9e2..bbacfd6 100644 } } -- -2.25.1 +2.34.1 diff --git a/0003-add-swap-usage-fields-in-shim-stats-and-container-in.patch b/0004-add-swap-usage-fields-in-shim-stats-and-container-in.patch similarity index 96% rename from 0003-add-swap-usage-fields-in-shim-stats-and-container-in.patch rename to 0004-add-swap-usage-fields-in-shim-stats-and-container-in.patch index 964fcd2..a6ffd48 100644 --- a/0003-add-swap-usage-fields-in-shim-stats-and-container-in.patch +++ b/0004-add-swap-usage-fields-in-shim-stats-and-container-in.patch @@ -1,7 +1,7 @@ From 299f54b13a85855540e6d28e9c9bfefb7bc66f14 Mon Sep 17 00:00:00 2001 From: jikai 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 --- @@ -49,5 +49,5 @@ index 35cfe64..9d92a81 100644 } }, -- -2.33.0 +2.34.1 diff --git a/0005-Add-oomkilled-field-in-inspect.json.patch b/0005-Add-oomkilled-field-in-inspect.json.patch index 62330cf..dbcea54 100644 --- a/0005-Add-oomkilled-field-in-inspect.json.patch +++ b/0005-Add-oomkilled-field-in-inspect.json.patch @@ -1,7 +1,7 @@ From 5adb5c82cb48f55fec1d6750e0648a0ffc5a372c Mon Sep 17 00:00:00 2001 From: jikai 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 --- @@ -23,5 +23,5 @@ index 9c76c33..89cb871 100644 "type": "integer" }, -- -2.25.1 +2.34.1 diff --git a/0006-add-runtime-in-process-state.patch b/0006-add-runtime-in-process-state.patch new file mode 100644 index 0000000..7ef68f1 --- /dev/null +++ b/0006-add-runtime-in-process-state.patch @@ -0,0 +1,27 @@ +From ffe13775740957f55c4a87cdee63481b1e6f4adb Mon Sep 17 00:00:00 2001 +From: zhongtao +Date: Mon, 8 Apr 2024 11:38:21 +0800 +Subject: [PATCH 6/8] add runtime in process-state + +Signed-off-by: zhongtao +--- + 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 + diff --git a/0007-restore-bufsize-to-prevent-log-loss.patch b/0007-restore-bufsize-to-prevent-log-loss.patch new file mode 100644 index 0000000..9828cd9 --- /dev/null +++ b/0007-restore-bufsize-to-prevent-log-loss.patch @@ -0,0 +1,148 @@ +From 27b2deef3e4d64b44a7a4cdfd76ac99bfad80f64 Mon Sep 17 00:00:00 2001 +From: zhongtao +Date: Tue, 9 Apr 2024 10:34:32 +0800 +Subject: [PATCH 7/8] restore bufsize to prevent log loss + +Signed-off-by: zhongtao +--- + 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 + #include + +-#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 + diff --git a/0008-support-clang-build.patch b/0008-support-clang-build.patch new file mode 100644 index 0000000..217e58e --- /dev/null +++ b/0008-support-clang-build.patch @@ -0,0 +1,25 @@ +From f1d0acce748fdccb750424b75f5de8fd760fb98e Mon Sep 17 00:00:00 2001 +From: luofeng14 +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 + diff --git a/lcr.spec b/lcr.spec index 016fe99..0454cdc 100644 --- a/lcr.spec +++ b/lcr.spec @@ -1,5 +1,5 @@ %global _version 2.1.4 -%global _release 4 +%global _release 5 %global _inner_name isula_libutils %global enable_lxc 1 @@ -15,9 +15,12 @@ BuildRoot: %{_tmppath}/lcr-%{version} Patch0001: 0001-add-systemd-cgroup-field-in-isulad-and-shim-config.patch Patch0002: 0002-Add-http-parser-as-third-party-component.patch -Patch0003: 0003-add-swap-usage-fields-in-shim-stats-and-container-in.patch -Patch0004: 0004-add-enable-pod-events-field.patch +Patch0003: 0003-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 +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_upper 5.0.3 @@ -134,6 +137,12 @@ rm -rf %{buildroot} %{_includedir}/lcr/utils_compile.h %changelog +* Thu Apr 11 2024 jikai - 2.1.4-5 +- Type:enhancement +- CVE:NA +- SUG:NA +- DESC:sync from upstream + * Sat Mar 30 2024 zhongtao - 2.1.4-4 - Type:bugfix - CVE:NA