!193 sync patches from upstream
From: @wangfengtu Reviewed-by: @duguhaotian Signed-off-by: @duguhaotian
This commit is contained in:
commit
9118a7bda6
@ -1,7 +1,7 @@
|
||||
From 717a0c83e3032c2255b257531cfd160b98cd8180 Mon Sep 17 00:00:00 2001
|
||||
From: gaohuatao <gaohuatao@huawei.com>
|
||||
Date: Tue, 16 Nov 2021 11:30:03 +0800
|
||||
Subject: [PATCH] add self def runtime for shimv2
|
||||
Subject: [PATCH 01/14] add self def runtime for shimv2
|
||||
|
||||
Signed-off-by: gaohuatao <gaohuatao@huawei.com>
|
||||
---
|
||||
@ -181,5 +181,5 @@ index 8801bea6..0f9ef044 100644
|
||||
|
||||
create_request->image = util_strdup_s(image.c_str());
|
||||
--
|
||||
2.20.1
|
||||
2.25.1
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
From 2e6f54021ee4b2b81fb0119714f1c4fffb4a031f Mon Sep 17 00:00:00 2001
|
||||
From: WangFengTu <wangfengtu@huawei.com>
|
||||
Date: Fri, 19 Nov 2021 15:11:23 +0800
|
||||
Subject: [PATCH] fix memleak when use multiple --volumes-from
|
||||
Subject: [PATCH 02/14] fix memleak when use multiple --volumes-from
|
||||
|
||||
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
||||
---
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
From 1b3922edcd0c254b39d57d91b9e027069cd8c82f Mon Sep 17 00:00:00 2001
|
||||
From: chengzrz <czrzrichard@gmail.com>
|
||||
Date: Mon, 22 Nov 2021 15:34:04 +0800
|
||||
Subject: [PATCH] Modified the procedure of running a pod to adapt to kata 2.0
|
||||
Subject: [PATCH 03/14] Modified the procedure of running a pod to adapt to
|
||||
kata 2.0
|
||||
|
||||
Signed-off-by: chengzrz <czrzrichard@gmail.com>
|
||||
---
|
||||
58
0004-add-new-function-mock-for-ut.patch
Normal file
58
0004-add-new-function-mock-for-ut.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From 1d89d1d6fce7a3f89ce2a984500dede6529c8f53 Mon Sep 17 00:00:00 2001
|
||||
From: haozi007 <liuhao27@huawei.com>
|
||||
Date: Fri, 26 Nov 2021 09:45:20 +0000
|
||||
Subject: [PATCH 04/14] add new function mock for ut
|
||||
|
||||
Signed-off-by: haozi007 <liuhao27@huawei.com>
|
||||
---
|
||||
test/mocks/namespace_mock.cc | 10 ++++++++++
|
||||
test/mocks/namespace_mock.h | 1 +
|
||||
test/specs/specs/specs_ut.cc | 1 +
|
||||
3 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/test/mocks/namespace_mock.cc b/test/mocks/namespace_mock.cc
|
||||
index 5c0cba6c..da24e406 100644
|
||||
--- a/test/mocks/namespace_mock.cc
|
||||
+++ b/test/mocks/namespace_mock.cc
|
||||
@@ -47,3 +47,13 @@ char *get_container_process_label(const char *path)
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
+
|
||||
+int get_network_namespace_path(const host_config *host_spec,
|
||||
+ const container_config_v2_common_config_network_settings *network_settings,
|
||||
+ const char *type, char **dest_path)
|
||||
+{
|
||||
+ if (g_namespace_mock != nullptr) {
|
||||
+ return g_namespace_mock->GetNetworkNamespacePath(host_spec, network_settings, type, dest_path);
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/test/mocks/namespace_mock.h b/test/mocks/namespace_mock.h
|
||||
index b835e028..80e75b0b 100644
|
||||
--- a/test/mocks/namespace_mock.h
|
||||
+++ b/test/mocks/namespace_mock.h
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
MOCK_METHOD1(ConnectedContainer, char *(const char *mode));
|
||||
MOCK_METHOD3(GetShareNamespacePath, int(const char *type, const char *src_path, char **dest_path));
|
||||
MOCK_METHOD1(GetContainerProcessLabel, char *(const char *path));
|
||||
+ MOCK_METHOD4(GetNetworkNamespacePath, int(const host_config *, const container_config_v2_common_config_network_settings *, const char *, char **));
|
||||
};
|
||||
|
||||
void MockNamespace_SetMock(MockNamespace *mock);
|
||||
diff --git a/test/specs/specs/specs_ut.cc b/test/specs/specs/specs_ut.cc
|
||||
index 2f2a2524..c4014e2e 100644
|
||||
--- a/test/specs/specs/specs_ut.cc
|
||||
+++ b/test/specs/specs/specs_ut.cc
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "mock.h"
|
||||
#include "isula_libutils/oci_runtime_spec.h"
|
||||
#include "specs_api.h"
|
||||
+#include "specs_namespace.h"
|
||||
#include "isula_libutils/host_config.h"
|
||||
#include "isula_libutils/container_config.h"
|
||||
#include "oci_ut_common.h"
|
||||
--
|
||||
2.25.1
|
||||
|
||||
28
0005-delete-isulad-h-flag.patch
Normal file
28
0005-delete-isulad-h-flag.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From 07b81da5e3d357c34cf7f5379ba507a16617a5ed Mon Sep 17 00:00:00 2001
|
||||
From: gaohuatao <gaohuatao@huawei.com>
|
||||
Date: Sat, 27 Nov 2021 11:14:40 +0800
|
||||
Subject: [PATCH 05/14] delete isulad h flag
|
||||
|
||||
Signed-off-by: gaohuatao <gaohuatao@huawei.com>
|
||||
---
|
||||
src/cmd/isulad/isulad_commands.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/cmd/isulad/isulad_commands.c b/src/cmd/isulad/isulad_commands.c
|
||||
index d0ab029c..c2826c83 100644
|
||||
--- a/src/cmd/isulad/isulad_commands.c
|
||||
+++ b/src/cmd/isulad/isulad_commands.c
|
||||
@@ -213,8 +213,8 @@ int parse_args(struct service_arguments *args, int argc, const char **argv)
|
||||
|
||||
if (args->argc > 0) {
|
||||
printf("unresolved arguments: %s;\t"
|
||||
- "run `%s --help` or `%s -h` for help.\n",
|
||||
- args->argv[0], argv[0], argv[0]);
|
||||
+ "run `%s --help` for help.\n",
|
||||
+ args->argv[0], argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
From d3d44e344d2ea2213c7d595c957e8ebf0a661fd2 Mon Sep 17 00:00:00 2001
|
||||
From: chengzrz <czrzrichard@gmail.com>
|
||||
Date: Sat, 27 Nov 2021 11:31:13 +0800
|
||||
Subject: [PATCH 06/14] Fix memory leak in ClearCniNetwork when calling
|
||||
get_sandbox_key
|
||||
|
||||
Signed-off-by: chengzrz <czrzrichard@gmail.com>
|
||||
---
|
||||
src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc b/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
|
||||
index eb1cd09f..0a577849 100644
|
||||
--- a/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
|
||||
+++ b/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
|
||||
@@ -748,6 +748,7 @@ auto PodSandboxManagerServiceImpl::ClearCniNetwork(const std::string &realSandbo
|
||||
ERROR("Failed to umount directory %s:%s", netnsPath, strerror(errno));
|
||||
}
|
||||
}
|
||||
+ free(netnsPath);
|
||||
}
|
||||
free_container_inspect(inspect_data);
|
||||
return 0;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
26
0007-fix-cri-libwebsockets-sync_close_sem-memory-leak.patch
Normal file
26
0007-fix-cri-libwebsockets-sync_close_sem-memory-leak.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 23ab9ac224056a2efef00b20cfc973c8e98a1e1d Mon Sep 17 00:00:00 2001
|
||||
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
Date: Fri, 26 Nov 2021 09:51:52 +0800
|
||||
Subject: [PATCH 07/14] fix cri libwebsockets sync_close_sem memory leak
|
||||
|
||||
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
---
|
||||
src/daemon/entry/cri/websocket/service/ws_server.cc | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/daemon/entry/cri/websocket/service/ws_server.cc b/src/daemon/entry/cri/websocket/service/ws_server.cc
|
||||
index 509f821e..e4b3a1b4 100644
|
||||
--- a/src/daemon/entry/cri/websocket/service/ws_server.cc
|
||||
+++ b/src/daemon/entry/cri/websocket/service/ws_server.cc
|
||||
@@ -191,6 +191,8 @@ void WebsocketServer::CloseWsSession(int socketID)
|
||||
}
|
||||
(void)sem_wait(session->sync_close_sem);
|
||||
(void)sem_destroy(session->sync_close_sem);
|
||||
+ delete session->sync_close_sem;
|
||||
+ session->sync_close_sem = nullptr;
|
||||
close(session->pipes.at(0));
|
||||
delete session->session_mutex;
|
||||
session->session_mutex = nullptr;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
96
0008-fix-cpu-variant-get-error.patch
Normal file
96
0008-fix-cpu-variant-get-error.patch
Normal file
@ -0,0 +1,96 @@
|
||||
From 198daf0e54215f76ddb62caa8bea41ff6625db40 Mon Sep 17 00:00:00 2001
|
||||
From: WangFengTu <wangfengtu@huawei.com>
|
||||
Date: Sat, 27 Nov 2021 14:15:34 +0800
|
||||
Subject: [PATCH 08/14] fix cpu variant get error
|
||||
|
||||
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
||||
---
|
||||
src/utils/cutils/utils.c | 14 +++++---------
|
||||
src/utils/cutils/utils_file.c | 6 +++++-
|
||||
src/utils/cutils/utils_file.h | 5 +++++
|
||||
3 files changed, 15 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/utils/cutils/utils.c b/src/utils/cutils/utils.c
|
||||
index a3e192fe..511cde96 100644
|
||||
--- a/src/utils/cutils/utils.c
|
||||
+++ b/src/utils/cutils/utils.c
|
||||
@@ -1299,12 +1299,11 @@ restart:
|
||||
static char *get_cpu_variant()
|
||||
{
|
||||
char *variant = NULL;
|
||||
- char *cpuinfo = NULL;
|
||||
+ char cpuinfo[1024] = { 0 };
|
||||
char *start_pos = NULL;
|
||||
char *end_pos = NULL;
|
||||
|
||||
- cpuinfo = util_read_text_file("/proc/cpuinfo");
|
||||
- if (cpuinfo == NULL) {
|
||||
+ if (util_file2str("/proc/cpuinfo", cpuinfo, sizeof(cpuinfo)) < 0) {
|
||||
ERROR("read /proc/cpuinfo failed");
|
||||
return NULL;
|
||||
}
|
||||
@@ -1312,7 +1311,7 @@ static char *get_cpu_variant()
|
||||
start_pos = strstr(cpuinfo, "CPU architecture");
|
||||
if (start_pos == NULL) {
|
||||
ERROR("can not found the key \"CPU architecture\" when try to get cpu variant");
|
||||
- goto out;
|
||||
+ return NULL;
|
||||
}
|
||||
end_pos = strchr(start_pos, '\n');
|
||||
if (end_pos != NULL) {
|
||||
@@ -1321,17 +1320,14 @@ static char *get_cpu_variant()
|
||||
start_pos = strchr(start_pos, ':');
|
||||
if (start_pos == NULL) {
|
||||
ERROR("can not found delimiter \":\" when try to get cpu variant");
|
||||
- goto out;
|
||||
+ return NULL;
|
||||
}
|
||||
+ start_pos += 1; // skip char ":"
|
||||
util_trim_newline(start_pos);
|
||||
start_pos = util_trim_space(start_pos);
|
||||
|
||||
variant = util_strings_to_lower(start_pos);
|
||||
|
||||
-out:
|
||||
- free(cpuinfo);
|
||||
- cpuinfo = NULL;
|
||||
-
|
||||
return variant;
|
||||
}
|
||||
|
||||
diff --git a/src/utils/cutils/utils_file.c b/src/utils/cutils/utils_file.c
|
||||
index f4fa4ece..00825bea 100644
|
||||
--- a/src/utils/cutils/utils_file.c
|
||||
+++ b/src/utils/cutils/utils_file.c
|
||||
@@ -815,7 +815,11 @@ char *util_add_path(const char *path, const char *name)
|
||||
return new_path;
|
||||
}
|
||||
|
||||
-/* note: This function can only read small text file. */
|
||||
+/* notes:
|
||||
+ * 1. Do not use this function to read proc file because proc file in armv8 does not
|
||||
+ * support fseek and the result of this function is nill string which is unexpected.
|
||||
+ * 2. This function can only read small text file.
|
||||
+ */
|
||||
char *util_read_text_file(const char *path)
|
||||
{
|
||||
char *buf = NULL;
|
||||
diff --git a/src/utils/cutils/utils_file.h b/src/utils/cutils/utils_file.h
|
||||
index a7fbbb6b..1465ca7e 100644
|
||||
--- a/src/utils/cutils/utils_file.h
|
||||
+++ b/src/utils/cutils/utils_file.h
|
||||
@@ -68,6 +68,11 @@ char *util_path_dir(const char *path);
|
||||
|
||||
char *util_add_path(const char *path, const char *name);
|
||||
|
||||
+/* notes:
|
||||
+ * 1. Do not use this function to read proc file because proc file in armv8 does not
|
||||
+ * support fseek and the result of this function is nill string which is unexpected.
|
||||
+ * 2. This function can only read small text file.
|
||||
+ */
|
||||
char *util_read_text_file(const char *path);
|
||||
|
||||
int64_t util_file_size(const char *filename);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
40
0009-fix-unit-test-error-of-registry-in-armv8.patch
Normal file
40
0009-fix-unit-test-error-of-registry-in-armv8.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From 688254c48fd4a672081d11e1f50ff70e807402f3 Mon Sep 17 00:00:00 2001
|
||||
From: WangFengTu <wangfengtu@huawei.com>
|
||||
Date: Mon, 29 Nov 2021 11:41:44 +0800
|
||||
Subject: [PATCH 09/14] fix unit test error of registry in armv8
|
||||
|
||||
use the data same as x86 to do unit test in armv8
|
||||
|
||||
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
||||
---
|
||||
test/image/oci/registry/data/oci/index | 2 +-
|
||||
test/image/oci/registry/data/v2/manifest_list | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/test/image/oci/registry/data/oci/index b/test/image/oci/registry/data/oci/index
|
||||
index d713bde3..c3f09482 100644
|
||||
--- a/test/image/oci/registry/data/oci/index
|
||||
+++ b/test/image/oci/registry/data/oci/index
|
||||
@@ -20,7 +20,7 @@ Etag: "sha256:bd28e852703450d93220e6733a9f0901b92cd558911528b03fdba56156ae0a02"
|
||||
"size": 527
|
||||
},
|
||||
{
|
||||
- "digest": "sha256:134252904112f8563a17a360957d9ad192e5c1e77463e04be74e71cffd4b41ba",
|
||||
+ "digest": "sha256:106429d73f57137cc587d2d4f1ad7ffb8c4cedcb564d3fb44a8769e602a4a4ec",
|
||||
"mediaType": "application/vnd.oci.image.manifest.v1+json",
|
||||
"platform": {
|
||||
"architecture": "arm64",
|
||||
diff --git a/test/image/oci/registry/data/v2/manifest_list b/test/image/oci/registry/data/v2/manifest_list
|
||||
index b4cf93c5..c1962e3e 100644
|
||||
--- a/test/image/oci/registry/data/v2/manifest_list
|
||||
+++ b/test/image/oci/registry/data/v2/manifest_list
|
||||
@@ -8,4 +8,4 @@ Docker-Content-Digest: sha256:9ddee63a712cea977267342e8750ecbc60d3aab25f04ceacfa
|
||||
Docker-Distribution-Api-Version: registry/2.0
|
||||
Etag: "sha256:9ddee63a712cea977267342e8750ecbc60d3aab25f04ceacfa795e6fce341793"
|
||||
|
||||
-{"manifests":[{"digest":"sha256:2131f09e4044327fd101ca1fd4043e6f3ad921ae7ee901e9142e6e36b354a907","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"amd64","os":"linux"},"size":527},{"digest":"sha256:ea84577ce8331aaceefd586104ba283201b89b5a614b10ec44b9884722db49d8","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v5"},"size":527},{"digest":"sha256:296361e74fe78e932cdd807743b5e37469518194f95c042135a6c3320ca52ef1","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v6"},"size":527},{"digest":"sha256:5cbe4404234f93a5401b58e0c50408d5c9caace822b70867e4f3e787be83eee9","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v7"},"size":527},{"digest":"sha256:134252904112f8563a17a360957d9ad192e5c1e77463e04be74e71cffd4b41ba","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm64","os":"linux","variant":"v8"},"size":527},{"digest":"sha256:414aeb860595d7078cbe87abaeed05157d6b44907fbd7db30e1cfba9b6902448","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"386","os":"linux"},"size":527},{"digest":"sha256:116dccaef9ca8b121565a39bd568ede437f084c94bb0642d2aba6b441e38d2f8","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"mips64le","os":"linux"},"size":527},{"digest":"sha256:5477c332ec926f8221e82a6c9e37dd9d84a401e3b5f71ba7d498956552c880ac","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"ppc64le","os":"linux"},"size":528},{"digest":"sha256:c304d497f3e0f87f8457401787df738f6f6e62b367bfd7c5f73f5b880b30ab4f","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"s390x","os":"linux"},"size":528}],"mediaType":"application\/vnd.docker.distribution.manifest.list.v2+json","schemaVersion":2}
|
||||
\ No newline at end of file
|
||||
+{"manifests":[{"digest":"sha256:2131f09e4044327fd101ca1fd4043e6f3ad921ae7ee901e9142e6e36b354a907","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"amd64","os":"linux"},"size":527},{"digest":"sha256:ea84577ce8331aaceefd586104ba283201b89b5a614b10ec44b9884722db49d8","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v5"},"size":527},{"digest":"sha256:296361e74fe78e932cdd807743b5e37469518194f95c042135a6c3320ca52ef1","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v6"},"size":527},{"digest":"sha256:5cbe4404234f93a5401b58e0c50408d5c9caace822b70867e4f3e787be83eee9","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm","os":"linux","variant":"v7"},"size":527},{"digest":"sha256:2131f09e4044327fd101ca1fd4043e6f3ad921ae7ee901e9142e6e36b354a907","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"arm64","os":"linux","variant":"v8"},"size":527},{"digest":"sha256:414aeb860595d7078cbe87abaeed05157d6b44907fbd7db30e1cfba9b6902448","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"386","os":"linux"},"size":527},{"digest":"sha256:116dccaef9ca8b121565a39bd568ede437f084c94bb0642d2aba6b441e38d2f8","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"mips64le","os":"linux"},"size":527},{"digest":"sha256:5477c332ec926f8221e82a6c9e37dd9d84a401e3b5f71ba7d498956552c880ac","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"ppc64le","os":"linux"},"size":528},{"digest":"sha256:c304d497f3e0f87f8457401787df738f6f6e62b367bfd7c5f73f5b880b30ab4f","mediaType":"application\/vnd.docker.distribution.manifest.v2+json","platform":{"architecture":"s390x","os":"linux"},"size":528}],"mediaType":"application\/vnd.docker.distribution.manifest.list.v2+json","schemaVersion":2}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
From 7e4b7304134eb0f85b83b02aeeee3c10b2303446 Mon Sep 17 00:00:00 2001
|
||||
From: chengzrz <czrzrichard@gmail.com>
|
||||
Date: Mon, 29 Nov 2021 14:41:47 +0800
|
||||
Subject: [PATCH 10/14] Modified cmakelist of storage_layer and added a new
|
||||
mock function in isulad_config_mock to fix errors that happen when compiling
|
||||
with UT option turned on
|
||||
|
||||
Signed-off-by: chengzrz <czrzrichard@gmail.com>
|
||||
---
|
||||
test/image/oci/storage/layers/CMakeLists.txt | 4 ++++
|
||||
test/mocks/isulad_config_mock.cc | 8 ++++++++
|
||||
test/mocks/isulad_config_mock.h | 1 +
|
||||
3 files changed, 13 insertions(+)
|
||||
|
||||
diff --git a/test/image/oci/storage/layers/CMakeLists.txt b/test/image/oci/storage/layers/CMakeLists.txt
|
||||
index 4cae382c..3fe8ab7c 100644
|
||||
--- a/test/image/oci/storage/layers/CMakeLists.txt
|
||||
+++ b/test/image/oci/storage/layers/CMakeLists.txt
|
||||
@@ -22,6 +22,8 @@ add_executable(${DRIVER_EXE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/utils/sha256/sha256.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/common/err_msg.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/common/selinux_label.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/config/daemon_arguments.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/config/isulad_config.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/layer_store/graphdriver/driver.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/deviceset.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/layer_store/graphdriver/devmapper/driver_devmapper.c
|
||||
@@ -89,6 +91,8 @@ add_executable(${LAYER_EXE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/utils/tar/util_archive.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/utils/tar/util_gzip.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/utils/sha256/sha256.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/config/daemon_arguments.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/config/isulad_config.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/common/err_msg.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/common/selinux_label.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/layer_store/layer.c
|
||||
diff --git a/test/mocks/isulad_config_mock.cc b/test/mocks/isulad_config_mock.cc
|
||||
index a333c176..eb6970d7 100644
|
||||
--- a/test/mocks/isulad_config_mock.cc
|
||||
+++ b/test/mocks/isulad_config_mock.cc
|
||||
@@ -170,3 +170,11 @@ isulad_daemon_constants *get_isulad_daemon_constants()
|
||||
}
|
||||
return &g_isulad_daemon_constants;
|
||||
}
|
||||
+
|
||||
+char *conf_get_isulad_userns_remap()
|
||||
+{
|
||||
+ if (g_isulad_conf_mock != nullptr) {
|
||||
+ return g_isulad_conf_mock->ConfGetIsuladUsernsRemap();
|
||||
+ }
|
||||
+ return nullptr;
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/test/mocks/isulad_config_mock.h b/test/mocks/isulad_config_mock.h
|
||||
index b91b5465..7af20ca5 100644
|
||||
--- a/test/mocks/isulad_config_mock.h
|
||||
+++ b/test/mocks/isulad_config_mock.h
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
MOCK_METHOD0(ConfGetUseDecryptedKeyFlag, bool (void));
|
||||
MOCK_METHOD0(InitIsuladDaemonConstants, int (void));
|
||||
MOCK_METHOD0(GetIsuladDaemonConstants, isulad_daemon_constants * (void));
|
||||
+ MOCK_METHOD0(ConfGetIsuladUsernsRemap, char *(void));
|
||||
};
|
||||
|
||||
void MockIsuladConf_SetMock(MockIsuladConf *mock);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
120
0011-add-fuzz-build-in-CI.patch
Normal file
120
0011-add-fuzz-build-in-CI.patch
Normal file
@ -0,0 +1,120 @@
|
||||
From db952e8122e584dbb24d28d36abc2ac1b8ad0c77 Mon Sep 17 00:00:00 2001
|
||||
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
Date: Mon, 29 Nov 2021 16:07:39 +0800
|
||||
Subject: [PATCH 11/14] add fuzz build in CI
|
||||
|
||||
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
---
|
||||
CI/make-and-install.sh | 9 +++++++++
|
||||
CMakeLists.txt | 4 ++--
|
||||
test/fuzz/CMakeLists.txt | 25 +++++++++++++++++++------
|
||||
3 files changed, 30 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/CI/make-and-install.sh b/CI/make-and-install.sh
|
||||
index 602878bf..3fd88b84 100755
|
||||
--- a/CI/make-and-install.sh
|
||||
+++ b/CI/make-and-install.sh
|
||||
@@ -74,12 +74,21 @@ rm -rf build
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_UT=ON -DENABLE_SHIM_V2=ON ..
|
||||
make -j $(nproc)
|
||||
+make install
|
||||
ctest -T memcheck --output-on-failure
|
||||
if [[ $? -ne 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
echo_success "===================RUN DT-LLT TESTCASES END========================="
|
||||
|
||||
+# build fuzz
|
||||
+cd $ISULAD_COPY_PATH
|
||||
+rm -rf build
|
||||
+mkdir build
|
||||
+cd build
|
||||
+cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_FUZZ=ON ..
|
||||
+make -j $(nproc)
|
||||
+
|
||||
# build rest version
|
||||
cd $ISULAD_COPY_PATH
|
||||
rm -rf build
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 0f7d6b9c..8fc03f2d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -86,9 +86,9 @@ IF(ENABLE_UT)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
|
||||
ENDIF(ENABLE_UT)
|
||||
|
||||
-IF(ENABLE_FUZZ)
|
||||
+IF(ENABLE_FUZZ AND (NOT ENABLE_UT))
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
|
||||
-ENDIF(ENABLE_FUZZ)
|
||||
+ENDIF(ENABLE_FUZZ AND (NOT ENABLE_UT))
|
||||
|
||||
# install all files
|
||||
install(FILES ${CMAKE_BINARY_DIR}/conf/isulad.pc
|
||||
diff --git a/test/fuzz/CMakeLists.txt b/test/fuzz/CMakeLists.txt
|
||||
index 816dd3cf..61ab47d7 100644
|
||||
--- a/test/fuzz/CMakeLists.txt
|
||||
+++ b/test/fuzz/CMakeLists.txt
|
||||
@@ -20,9 +20,18 @@ SET(EXE1 im_config_image_exist_fuzz)
|
||||
SET(EXE2 im_get_image_count_fuzz)
|
||||
SET(EXE3 test_volume_mount_spec_fuzz)
|
||||
SET(EXE4 test_volume_parse_volume_fuzz)
|
||||
-add_executable(${EXE0} im_oci_image_exist_fuzz.cc)
|
||||
-add_executable(${EXE1} im_config_image_exist_fuzz.cc)
|
||||
-add_executable(${EXE2} im_get_image_count_fuzz.cc)
|
||||
+add_executable(${EXE0}
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
|
||||
+ im_oci_image_exist_fuzz.cc)
|
||||
+add_executable(${EXE1}
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
|
||||
+ im_config_image_exist_fuzz.cc)
|
||||
+add_executable(${EXE2}
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
|
||||
+ im_get_image_count_fuzz.cc)
|
||||
add_executable(${EXE3}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/path.c
|
||||
@@ -36,6 +45,8 @@ add_executable(${EXE3}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils_verify.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/sha256/sha256.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils_mount_spec.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
|
||||
test_volume_mount_spec_fuzz.cc
|
||||
)
|
||||
add_executable(${EXE4}
|
||||
@@ -51,6 +62,8 @@ add_executable(${EXE4}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils_verify.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/sha256/sha256.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/modules/spec/parse_volume.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/isulad_config.c
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src/daemon/config/daemon_arguments.c
|
||||
test_volume_parse_volume_fuzz.cc
|
||||
)
|
||||
|
||||
@@ -96,15 +109,15 @@ target_include_directories(${EXE4} PUBLIC
|
||||
|
||||
set_target_properties(${EXE0} PROPERTIES LINKER_LANGUAGE CXX)
|
||||
set_target_properties(${EXE0} PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=trace-pc")
|
||||
-target_link_libraries(${EXE0} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img)
|
||||
+target_link_libraries(${EXE0} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img -lgcov)
|
||||
|
||||
set_target_properties(${EXE1} PROPERTIES LINKER_LANGUAGE CXX)
|
||||
set_target_properties(${EXE1} PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=trace-pc")
|
||||
-target_link_libraries(${EXE1} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img)
|
||||
+target_link_libraries(${EXE1} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img -lgcov)
|
||||
|
||||
set_target_properties(${EXE2} PROPERTIES LINKER_LANGUAGE CXX)
|
||||
set_target_properties(${EXE2} PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=trace-pc")
|
||||
-target_link_libraries(${EXE2} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img)
|
||||
+target_link_libraries(${EXE2} ${CMAKE_THREAD_LIBS_INIT} ${ISULA_LIBUTILS_LIBRARY} ${LIB_FUZZING_ENGINE} pthread rt -lisulad_img -lgcov)
|
||||
|
||||
set_target_properties(${EXE3} PROPERTIES LINKER_LANGUAGE CXX)
|
||||
set_target_properties(${EXE3} PROPERTIES LINK_FLAGS "-fsanitize=address -fsanitize-coverage=trace-pc")
|
||||
--
|
||||
2.25.1
|
||||
|
||||
26
0012-print-valgrind-log.patch
Normal file
26
0012-print-valgrind-log.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From cd3cda2bf3880d1e805406cba6e5c6510ef8832b Mon Sep 17 00:00:00 2001
|
||||
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
Date: Wed, 1 Dec 2021 10:14:33 +0800
|
||||
Subject: [PATCH 12/14] print valgrind log
|
||||
|
||||
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
---
|
||||
CI/test_cases/helpers.sh | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CI/test_cases/helpers.sh b/CI/test_cases/helpers.sh
|
||||
index 27f04749..dd1bf943 100755
|
||||
--- a/CI/test_cases/helpers.sh
|
||||
+++ b/CI/test_cases/helpers.sh
|
||||
@@ -146,7 +146,7 @@ function check_valgrind_log() {
|
||||
cat $valgrind_log | grep "are definitely lost" | grep "==$pid=="
|
||||
if [ $? -eq 0 ];then
|
||||
echo "Memory leak may checked by valgrind, see valgrind log file: $valgrind_log"
|
||||
- sed -n '/definitely lost/,// p' $valgrind_log
|
||||
+ cat $valgrind_log
|
||||
exit 1
|
||||
fi
|
||||
return 0
|
||||
--
|
||||
2.25.1
|
||||
|
||||
32
0013-fix-cri-version-memory-leak.patch
Normal file
32
0013-fix-cri-version-memory-leak.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From 3750c2f7d6c13289bbfbb278e0e09667468286d0 Mon Sep 17 00:00:00 2001
|
||||
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
Date: Thu, 2 Dec 2021 15:24:11 +0800
|
||||
Subject: [PATCH 13/14] fix cri version memory leak
|
||||
|
||||
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
---
|
||||
src/daemon/entry/cri/cri_runtime_versioner_service_impl.cc | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/daemon/entry/cri/cri_runtime_versioner_service_impl.cc b/src/daemon/entry/cri/cri_runtime_versioner_service_impl.cc
|
||||
index 4316b190..6c4ba515 100644
|
||||
--- a/src/daemon/entry/cri/cri_runtime_versioner_service_impl.cc
|
||||
+++ b/src/daemon/entry/cri/cri_runtime_versioner_service_impl.cc
|
||||
@@ -44,10 +44,10 @@ void RuntimeVersionerServiceImpl::Version(const std::string &apiVersion,
|
||||
} else {
|
||||
error.SetError("Failed to call version callback");
|
||||
}
|
||||
- free_container_version_response(response);
|
||||
- return;
|
||||
+ } else {
|
||||
+ VersionResponseToGRPC(response, versionResponse);
|
||||
}
|
||||
|
||||
- VersionResponseToGRPC(response, versionResponse);
|
||||
+ free_container_version_response(response);
|
||||
}
|
||||
} // namespace CRI
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.25.1
|
||||
|
||||
25
0014-fix-undefined-reference-in-libisulad_img.so.patch
Normal file
25
0014-fix-undefined-reference-in-libisulad_img.so.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 861a635c95254c7429bc8c23552f529c5a083762 Mon Sep 17 00:00:00 2001
|
||||
From: WangFengTu <wangfengtu@huawei.com>
|
||||
Date: Thu, 2 Dec 2021 15:24:31 +0800
|
||||
Subject: [PATCH 14/14] fix undefined reference in libisulad_img.so
|
||||
|
||||
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
|
||||
---
|
||||
src/daemon/modules/image/CMakeLists.txt | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/daemon/modules/image/CMakeLists.txt b/src/daemon/modules/image/CMakeLists.txt
|
||||
index 86b7d8a6..0a004835 100644
|
||||
--- a/src/daemon/modules/image/CMakeLists.txt
|
||||
+++ b/src/daemon/modules/image/CMakeLists.txt
|
||||
@@ -71,6 +71,7 @@ add_library(${LIB_ISULAD_IMG} ${LIBTYPE}
|
||||
${CMAKE_SOURCE_DIR}/src/utils/tar/isulad_tar.c
|
||||
${CMAKE_SOURCE_DIR}/src/utils/tar/util_archive.c
|
||||
${CMAKE_SOURCE_DIR}/src/utils/tar/util_gzip.c
|
||||
+ ${CMAKE_SOURCE_DIR}/src/daemon/config/isulad_config.c
|
||||
)
|
||||
|
||||
target_include_directories(${LIB_ISULAD_IMG} PUBLIC
|
||||
--
|
||||
2.25.1
|
||||
|
||||
21
iSulad.spec
21
iSulad.spec
@ -1,5 +1,5 @@
|
||||
%global _version 2.0.10
|
||||
%global _release 6
|
||||
%global _release 7
|
||||
%global is_systemd 1
|
||||
%global enable_shimv2 1
|
||||
|
||||
@ -14,7 +14,18 @@ BuildRoot: {_tmppath}/iSulad-%{version}
|
||||
|
||||
Patch0001: 0001-add-self-def-runtime-for-shimv2.patch
|
||||
Patch0002: 0002-fix-memleak-when-use-multiple-volumes-from.patch
|
||||
Patch0003: 0003-modified-the-procedure-of-running-a-pod-to-adapt-to.patch
|
||||
Patch0003: 0003-Modified-the-procedure-of-running-a-pod-to-adapt-to-.patch
|
||||
Patch0004: 0004-add-new-function-mock-for-ut.patch
|
||||
Patch0005: 0005-delete-isulad-h-flag.patch
|
||||
Patch0006: 0006-Fix-memory-leak-in-ClearCniNetwork-when-calling-get_.patch
|
||||
Patch0007: 0007-fix-cri-libwebsockets-sync_close_sem-memory-leak.patch
|
||||
Patch0008: 0008-fix-cpu-variant-get-error.patch
|
||||
Patch0009: 0009-fix-unit-test-error-of-registry-in-armv8.patch
|
||||
Patch0010: 0010-Modified-cmakelist-of-storage_layer-and-added-a-new-.patch
|
||||
Patch0011: 0011-add-fuzz-build-in-CI.patch
|
||||
Patch0012: 0012-print-valgrind-log.patch
|
||||
Patch0013: 0013-fix-cri-version-memory-leak.patch
|
||||
Patch0014: 0014-fix-undefined-reference-in-libisulad_img.so.patch
|
||||
|
||||
%ifarch x86_64 aarch64
|
||||
Provides: libhttpclient.so()(64bit)
|
||||
@ -228,6 +239,12 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Dec 02 2021 wangfengtu <wangfengtu@huawei.com> - 2.0.10-7
|
||||
- Type: bugfix
|
||||
- ID: NA
|
||||
- SUG: NA
|
||||
- DESC: sync patches from upstream
|
||||
|
||||
* Tue Nov 23 2021 chengzeruizhi <chengzeruizhi@huawei.com> - 2.0.10-6
|
||||
- Type: enhancement
|
||||
- ID: NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user