Compare commits
10 Commits
06dd1ba214
...
8a61b08b36
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a61b08b36 | ||
|
|
628f3e4012 | ||
|
|
59e6c29b22 | ||
|
|
ec68667799 | ||
|
|
bbc1013e90 | ||
|
|
662a77fcb8 | ||
|
|
a9933eee70 | ||
|
|
72c0373b1d | ||
|
|
b28e2863ea | ||
|
|
ce6d9492eb |
32
0061-fix-ops-hierarchies-cause-coredump.patch
Normal file
32
0061-fix-ops-hierarchies-cause-coredump.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From 269158eb97dc4bd72e77e12ddcab6295ef3f8d01 Mon Sep 17 00:00:00 2001
|
||||
From: "Neil.wrz" <wangrunze13@huawei.com>
|
||||
Date: Thu, 23 Feb 2023 00:12:34 -0800
|
||||
Subject: [PATCH] null ops cause coredump
|
||||
|
||||
---
|
||||
src/lxc/cgroups/isulad_cgfsng.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/src/lxc/cgroups/isulad_cgfsng.c b/src/lxc/cgroups/isulad_cgfsng.c
|
||||
index 6ccff63..dcaa229 100644
|
||||
--- a/src/lxc/cgroups/isulad_cgfsng.c
|
||||
+++ b/src/lxc/cgroups/isulad_cgfsng.c
|
||||
@@ -938,8 +938,15 @@ __cgfsng_ops static inline bool isulad_cgfsng_payload_create(struct cgroup_ops *
|
||||
struct lxc_handler *handler)
|
||||
{
|
||||
int i;
|
||||
+
|
||||
+ if (!ops)
|
||||
+ return ret_set_errno(false, ENOENT);
|
||||
+
|
||||
char *container_cgroup = ops->container_cgroup;
|
||||
|
||||
+ if (!ops->hierarchies)
|
||||
+ return true;
|
||||
+
|
||||
#ifdef HAVE_ISULAD
|
||||
if (ops->no_controller) {
|
||||
DEBUG("no controller found, isgnore isulad_cgfsng_payload_create");
|
||||
--
|
||||
2.25.1
|
||||
|
||||
51
0062-use-ocihooks-env-after-getenv.patch
Normal file
51
0062-use-ocihooks-env-after-getenv.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From 7e515f8f42af1cdbd87442b0ea74fa934ee25576 Mon Sep 17 00:00:00 2001
|
||||
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
Date: Fri, 31 Mar 2023 09:49:59 +0800
|
||||
Subject: [PATCH] use ocihooks env after getenv
|
||||
|
||||
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
---
|
||||
src/lxc/conf.c | 13 +++++++------
|
||||
1 file changed, 7 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
|
||||
index 19cf5e3..b31ba38 100644
|
||||
--- a/src/lxc/conf.c
|
||||
+++ b/src/lxc/conf.c
|
||||
@@ -4461,7 +4461,8 @@ static char **merge_ocihook_env(char **oldenvs, size_t env_len, size_t *merge_en
|
||||
{
|
||||
char **result = NULL;
|
||||
size_t result_len = env_len;
|
||||
- size_t i, j;
|
||||
+ size_t i = 0;
|
||||
+ size_t j, k;
|
||||
char *tmpenv = NULL;
|
||||
char *lxc_envs[] = {"LD_LIBRARY_PATH", "PATH", "LXC_CGNS_AWARE", "LXC_PID", "LXC_ROOTFS_MOUNT",
|
||||
"LXC_CONFIG_FILE", "LXC_CGROUP_PATH", "LXC_ROOTFS_PATH", "LXC_NAME"
|
||||
@@ -4476,11 +4477,6 @@ static char **merge_ocihook_env(char **oldenvs, size_t env_len, size_t *merge_en
|
||||
return NULL;
|
||||
memset(result, 0, sizeof(char *) * result_len);
|
||||
|
||||
- for(i = 0; i < env_len; i++) {
|
||||
- if (oldenvs[i])
|
||||
- result[i] = safe_strdup(oldenvs[i]);
|
||||
- }
|
||||
-
|
||||
for(j = 0; j < (sizeof(lxc_envs) / sizeof(char *)); j++) {
|
||||
size_t env_buf_len = 0;
|
||||
tmpenv = getenv(lxc_envs[j]);
|
||||
@@ -4504,6 +4500,11 @@ static char **merge_ocihook_env(char **oldenvs, size_t env_len, size_t *merge_en
|
||||
}
|
||||
}
|
||||
|
||||
+ for(k = 0; k < env_len; k++) {
|
||||
+ if (oldenvs[k] && i < (result_len - 1))
|
||||
+ result[i++] = safe_strdup(oldenvs[k]);
|
||||
+ }
|
||||
+
|
||||
*merge_env_len = i;
|
||||
return result;
|
||||
}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
44
0063-fix-lxc-attach-stuck-when-disable-isulad.patch
Normal file
44
0063-fix-lxc-attach-stuck-when-disable-isulad.patch
Normal file
@ -0,0 +1,44 @@
|
||||
From 8c605f2ab25387e75f8f0114ead645de73ed4e0e Mon Sep 17 00:00:00 2001
|
||||
From: "Neil.wrz" <wangrunze13@huawei.com>
|
||||
Date: Mon, 17 Apr 2023 23:28:14 -0700
|
||||
Subject: [PATCH] fix lxc-attach stuck when diable isulad
|
||||
|
||||
Signed-off-by: Neil.wrz <wangrunze13@huawei.com>
|
||||
---
|
||||
src/lxc/attach.c | 4 ++++
|
||||
src/lxc/terminal.c | 3 +++
|
||||
2 files changed, 7 insertions(+)
|
||||
|
||||
diff --git a/src/lxc/attach.c b/src/lxc/attach.c
|
||||
index 568dfe1..765f1ee 100644
|
||||
--- a/src/lxc/attach.c
|
||||
+++ b/src/lxc/attach.c
|
||||
@@ -1765,7 +1765,11 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
|
||||
}
|
||||
#endif
|
||||
if (options->attach_flags & LXC_ATTACH_TERMINAL) {
|
||||
+#ifdef HAVE_ISULAD
|
||||
ret = isulad_safe_mainloop(&descr, -1);
|
||||
+#else
|
||||
+ ret = lxc_mainloop(&descr, -1);
|
||||
+#endif
|
||||
if (ret < 0) {
|
||||
ret_parent = -1;
|
||||
to_cleanup_pid = attached_pid;
|
||||
diff --git a/src/lxc/terminal.c b/src/lxc/terminal.c
|
||||
index 5d83691..2d55717 100644
|
||||
--- a/src/lxc/terminal.c
|
||||
+++ b/src/lxc/terminal.c
|
||||
@@ -1304,6 +1304,9 @@ static int lxc_terminal_peer_default(struct lxc_terminal *terminal)
|
||||
DEBUG("Not have a controlling terminal");
|
||||
return 0;
|
||||
}
|
||||
+#else
|
||||
+ else
|
||||
+ path = "/dev/tty";
|
||||
#endif
|
||||
|
||||
terminal->peer = lxc_unpriv(open(path, O_RDWR | O_CLOEXEC));
|
||||
--
|
||||
2.25.1
|
||||
|
||||
51
0064-fix-mixed-use-of-signed-and-unsigned-type.patch
Normal file
51
0064-fix-mixed-use-of-signed-and-unsigned-type.patch
Normal file
@ -0,0 +1,51 @@
|
||||
From 361e3fef68c24b99ed17f8cddc67d184920293ed Mon Sep 17 00:00:00 2001
|
||||
From: "Neil.wrz" <wangrunze13@huawei.com>
|
||||
Date: Sun, 23 Apr 2023 19:45:14 -0700
|
||||
Subject: [PATCH] fix mixed use of signed and unsigned type
|
||||
|
||||
Signed-off-by: Neil.wrz <wangrunze13@huawei.com>
|
||||
---
|
||||
src/lxc/path.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/lxc/path.c b/src/lxc/path.c
|
||||
index 46256cb..c0529b7 100644
|
||||
--- a/src/lxc/path.c
|
||||
+++ b/src/lxc/path.c
|
||||
@@ -101,7 +101,7 @@ bool filepath_split(const char *path, char **dir, char **base)
|
||||
ERROR("Invalid path");
|
||||
return false;
|
||||
}
|
||||
- i = len - 1;
|
||||
+ i = (ssize_t)(len - 1);
|
||||
while (i >= 0 && path[i] != '/')
|
||||
i--;
|
||||
|
||||
@@ -326,7 +326,7 @@ static int do_get_symlinks(const char **fullpath, const char *prefix, size_t pre
|
||||
}
|
||||
|
||||
len = strlen(*end);
|
||||
- if (len >= PATH_MAX - n) {
|
||||
+ if (len >= (size_t)(PATH_MAX - n)) {
|
||||
ERROR("Path is too long");
|
||||
goto out;
|
||||
}
|
||||
@@ -619,7 +619,7 @@ char *path_relative(const char *basepath, const char *targpath)
|
||||
|
||||
if (b0 != bl) {
|
||||
// Base elements left. Must go up before going down.
|
||||
- int seps = 0, i;
|
||||
+ size_t seps = 0, i;
|
||||
size_t ncopyed = 0, seps_size;
|
||||
char *buf = NULL;
|
||||
|
||||
@@ -652,4 +652,4 @@ char *path_relative(const char *basepath, const char *targpath)
|
||||
}
|
||||
|
||||
return safe_strdup(targ + t0);
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
--
|
||||
2.25.1
|
||||
|
||||
27
0065-fix-mount-device-path-incorrect.patch
Normal file
27
0065-fix-mount-device-path-incorrect.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From e461e117238420ba9abdc4c9ec6de46b690354e8 Mon Sep 17 00:00:00 2001
|
||||
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
Date: Fri, 16 Jun 2023 12:02:38 +0800
|
||||
Subject: [PATCH] fix mount device path incorrect
|
||||
|
||||
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
|
||||
---
|
||||
src/lxc/conf.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
|
||||
index b31ba38..51e4bb0 100644
|
||||
--- a/src/lxc/conf.c
|
||||
+++ b/src/lxc/conf.c
|
||||
@@ -4301,7 +4301,8 @@ static int setup_populate_devs(const struct lxc_rootfs *rootfs, struct lxc_list
|
||||
|
||||
// Unprivileged containers cannot create devices, so
|
||||
// try to bind mount the device from the host
|
||||
- ret = snprintf(hostpath, MAXPATHLEN, "/dev/%s", dev_elem->name);
|
||||
+ // dev_elem name is the device path
|
||||
+ ret = snprintf(hostpath, MAXPATHLEN, "%s", dev_elem->name);
|
||||
if (ret < 0 || ret >= MAXPATHLEN) {
|
||||
ret = -1;
|
||||
goto reset_umask;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
37
lxc.spec
37
lxc.spec
@ -1,4 +1,4 @@
|
||||
%global _release 2022102412
|
||||
%global _release 2022102417
|
||||
|
||||
Name: lxc
|
||||
Version: 4.0.3
|
||||
@ -68,6 +68,11 @@ Patch0057: 0057-fix-lxc-write-error-message.patch
|
||||
Patch0058: 0058-add-loongarch64-support-for-lxc.patch
|
||||
Patch0059: 0059-remove-process-inheritable-capability.patch
|
||||
Patch0060: 0060-check-yajl-only-when-have-isulad.patch
|
||||
Patch0061: 0061-fix-ops-hierarchies-cause-coredump.patch
|
||||
Patch0062: 0062-use-ocihooks-env-after-getenv.patch
|
||||
Patch0063: 0063-fix-lxc-attach-stuck-when-disable-isulad.patch
|
||||
Patch0064: 0064-fix-mixed-use-of-signed-and-unsigned-type.patch
|
||||
Patch0065: 0065-fix-mount-device-path-incorrect.patch
|
||||
|
||||
BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath
|
||||
BuildRequires: pkgconfig(libseccomp)
|
||||
@ -248,6 +253,36 @@ make check
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Fri Jun 16 2023 zhangxiaoyu<zhangxiaoyu58@huawei.com> - 4.0.3-2022102417
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: fix mount device path incorrect
|
||||
|
||||
* Mon Apr 24 2023 wangrunze<wangrunze13@huawei.com> - 4.0.3-2022102416
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: fix mixed use of signed and unsigned type
|
||||
|
||||
* Tue Apr 18 2023 wangrunze<wangrunze13@huawei.com> - 4.0.3-2022102415
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: fix lxc attach stuck when disable isulad
|
||||
|
||||
* Fri Mar 31 2023 zhangxiaoyu<zhangxiaoyu58@huawei.com> - 4.0.3-2022102414
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: use ocihooks env after getenv
|
||||
|
||||
* Thu Feb 23 2023 wangrunze<wangrunze13@huawei.com> - 4.0.3-2022102413
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: fix null ops hierarchies cause coredump
|
||||
|
||||
* Tue Feb 21 2023 wangrunze<wangrunze13@huawei.com> - 4.0.3-2022102412
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user