From 5af98954589f879a5356476c566c4fbd9efb0fbb Mon Sep 17 00:00:00 2001 From: zhangxiaoyu Date: Tue, 21 Feb 2023 14:55:30 +0800 Subject: [PATCH] upgrade from upstream Signed-off-by: zhangxiaoyu --- ...memory_swap_limit_in_bytes-into-host.patch | 51 +++++++++++++++++++ 0003-fix-update-cpu-rt-period-failed.patch | 35 +++++++++++++ ...riting-config-line-with-wrong-length.patch | 40 +++++++++++++++ lcr.spec | 11 +++- 4 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 0002-add-unified-and-memory_swap_limit_in_bytes-into-host.patch create mode 100644 0003-fix-update-cpu-rt-period-failed.patch create mode 100644 0004-fix-writing-config-line-with-wrong-length.patch diff --git a/0002-add-unified-and-memory_swap_limit_in_bytes-into-host.patch b/0002-add-unified-and-memory_swap_limit_in_bytes-into-host.patch new file mode 100644 index 0000000..e5ba946 --- /dev/null +++ b/0002-add-unified-and-memory_swap_limit_in_bytes-into-host.patch @@ -0,0 +1,51 @@ +From 9bd736bc14da91bfc6ca8bf38f05218e5703adf5 Mon Sep 17 00:00:00 2001 +From: "ilya.kuksenok" +Date: Tue, 7 Feb 2023 13:51:44 +0300 +Subject: [PATCH 2/4] add unified and memory_swap_limit_in_bytes into + host-config + +--- + .gitignore | 2 ++ + src/json/schema/host-config.json | 8 +++++++- + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/.gitignore b/.gitignore +index 0995486..973ceef 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -1,3 +1,5 @@ + *.pyc + build + .vscode ++.idea ++cmake-build-debug +diff --git a/src/json/schema/host-config.json b/src/json/schema/host-config.json +index c308558..0367a76 100644 +--- a/src/json/schema/host-config.json ++++ b/src/json/schema/host-config.json +@@ -139,9 +139,15 @@ + "Memory": { + "type": "int64" + }, ++ "Unified": { ++ "$ref": "defs.json#/definitions/mapStringString" ++ }, + "OomScoreAdj": { + "type": "integer" + }, ++ "MemorySwapLimitInBytes":{ ++ "type": "int64" ++ }, + "BlkioWeight": { + "type": "uint16" + }, +@@ -292,4 +298,4 @@ + "type": "string" + } + } +-} +\ No newline at end of file ++} +-- +2.25.1 + diff --git a/0003-fix-update-cpu-rt-period-failed.patch b/0003-fix-update-cpu-rt-period-failed.patch new file mode 100644 index 0000000..fdc15b9 --- /dev/null +++ b/0003-fix-update-cpu-rt-period-failed.patch @@ -0,0 +1,35 @@ +From d332dbb9050510f91445625b56952fd533ec530a Mon Sep 17 00:00:00 2001 +From: songbuhuang <544824346@qq.com> +Date: Wed, 8 Feb 2023 10:53:25 +0800 +Subject: [PATCH 3/4] fix update cpu-rt period failed + +Signed-off-by: songbuhuang <544824346@qq.com> +--- + src/lcrcontainer_execute.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/lcrcontainer_execute.c b/src/lcrcontainer_execute.c +index 3f5860f..ff4685b 100644 +--- a/src/lcrcontainer_execute.c ++++ b/src/lcrcontainer_execute.c +@@ -360,13 +360,14 @@ static bool update_resources_cpu_v1(struct lxc_container *c, const struct lcr_cg + goto err_out; + } + +- if (update_resources_cpu_rt_period(c, cr) != 0) { +- goto err_out; +- } + if (update_resources_cpu_rt_runtime(c, cr) != 0) { + goto err_out; + } + ++ if (update_resources_cpu_rt_period(c, cr) != 0) { ++ goto err_out; ++ } ++ + ret = true; + err_out: + return ret; +-- +2.25.1 + diff --git a/0004-fix-writing-config-line-with-wrong-length.patch b/0004-fix-writing-config-line-with-wrong-length.patch new file mode 100644 index 0000000..641b948 --- /dev/null +++ b/0004-fix-writing-config-line-with-wrong-length.patch @@ -0,0 +1,40 @@ +From 4df2c0f530bfa62b98e22ea87a01fa567cf01ef3 Mon Sep 17 00:00:00 2001 +From: zhangxiaoyu +Date: Thu, 9 Feb 2023 10:18:01 +0800 +Subject: [PATCH 4/4] fix writing config line with wrong length + +Signed-off-by: zhangxiaoyu +--- + src/lcrcontainer_extend.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/src/lcrcontainer_extend.c b/src/lcrcontainer_extend.c +index f6d1465..fb43b22 100644 +--- a/src/lcrcontainer_extend.c ++++ b/src/lcrcontainer_extend.c +@@ -841,7 +841,6 @@ static int lcr_spec_write_config(FILE *fp, const struct lcr_list *lcr_conf) + } + + nret = snprintf(line, len, "%s = %s", item->name, item->value); +- + if (nret < 0 || (size_t)nret >= len) { + ERROR("Sprintf failed"); + goto cleanup; +@@ -853,11 +852,10 @@ static int lcr_spec_write_config(FILE *fp, const struct lcr_list *lcr_conf) + goto cleanup; + } + +- nret = strlen(line_encode); +- +- line_encode[nret] = '\n'; ++ len = strlen(line_encode); ++ line_encode[len] = '\n'; + +- if (fwrite(line_encode, 1, len, fp) != len) { ++ if (fwrite(line_encode, 1, len + 1, fp) != len + 1) { + ERROR("Write file failed: %s", strerror(errno)); + goto cleanup; + } +-- +2.25.1 + diff --git a/lcr.spec b/lcr.spec index 78f18dd..6808aaf 100644 --- a/lcr.spec +++ b/lcr.spec @@ -1,5 +1,5 @@ %global _version 2.1.1 -%global _release 2 +%global _release 3 %global _inner_name isula_libutils Name: lcr @@ -13,6 +13,9 @@ License: LGPLv2.1+ BuildRoot: %{_tmppath}/lcr-%{version} Patch0001: 0001-add-libisula.pc.patch +Patch0002: 0002-add-unified-and-memory_swap_limit_in_bytes-into-host.patch +Patch0003: 0003-fix-update-cpu-rt-period-failed.patch +Patch0004: 0004-fix-writing-config-line-with-wrong-length.patch %define lxcver_lower 4.0.3-2022102400 %define lxcver_upper 4.0.3-2022102500 @@ -126,6 +129,12 @@ rm -rf %{buildroot} %{_includedir}/%{_inner_name}/*.h %changelog +* Tue Feb 21 2023 zhangxiaoyu - 2.1.1-3 +- Type:enhancement +- CVE:NA +- SUG:NA +- DESC:upgrade from upstream + * Tue Feb 07 2023 zhangxiaoyu - 2.1.1-2 - Type:enhancement - CVE:NA