From 5d33dd0f1f8132e9d05fa54e1aaff2df4d68c7a2 Mon Sep 17 00:00:00 2001 From: zhangxiaoyu Date: Fri, 12 Jan 2024 16:43:52 +0800 Subject: [PATCH] fix dev mount failed and skip send/recv devpts_fd if disable_pty Signed-off-by: zhangxiaoyu --- ...iled-and-skip-send-recv-devpts_fd-if.patch | 56 +++++++++++++++++++ lxc.spec | 9 ++- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 0012-fix-dev-mount-failed-and-skip-send-recv-devpts_fd-if.patch diff --git a/0012-fix-dev-mount-failed-and-skip-send-recv-devpts_fd-if.patch b/0012-fix-dev-mount-failed-and-skip-send-recv-devpts_fd-if.patch new file mode 100644 index 0000000..4b79f83 --- /dev/null +++ b/0012-fix-dev-mount-failed-and-skip-send-recv-devpts_fd-if.patch @@ -0,0 +1,56 @@ +From 47513b0bd34217bb2032285ea03ae7e4508ba24d Mon Sep 17 00:00:00 2001 +From: zhangxiaoyu +Date: Fri, 12 Jan 2024 16:40:32 +0800 +Subject: [PATCH] fix dev mount failed and skip send/recv devpts_fd if + disable_pty + +Signed-off-by: zhangxiaoyu +--- + src/lxc/conf.c | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/src/lxc/conf.c b/src/lxc/conf.c +index c73ba04..b61615d 100644 +--- a/src/lxc/conf.c ++++ b/src/lxc/conf.c +@@ -1829,6 +1829,12 @@ static int lxc_recv_devpts_from_child(struct lxc_handler *handler) + { + int ret; + ++#ifdef HAVE_ISULAD ++ if (handler->disable_pty) { ++ return 0; ++ } ++#endif ++ + if (handler->conf->pty_max <= 0) + return 0; + +@@ -2066,6 +2072,12 @@ static int lxc_send_devpts_to_parent(struct lxc_handler *handler) + { + int ret; + ++#ifdef HAVE_ISULAD ++ if (handler->disable_pty) { ++ return 0; ++ } ++#endif ++ + if (handler->conf->pty_max <= 0) + return log_debug(0, "No devpts file descriptor will be sent since no pts devices are requested"); + +@@ -4852,6 +4864,11 @@ int lxc_setup(struct lxc_handler *handler) + if (ret < 0) { + return log_error(-1, "Failed to setup new devpts instance for '%s'", name); + } ++ } else { ++ lxc_conf->devpts_fd = open_at(lxc_conf->rootfs.dfd_dev, "pts", PROTECT_OPATH_DIRECTORY, PROTECT_LOOKUP_BENEATH_XDEV, 0); ++ if (lxc_conf->devpts_fd < 0) { ++ return log_error(-1, "Failed to allocate console from container's devpts instance"); ++ } + } + #else + ret = lxc_create_tmp_proc_mount(lxc_conf); +-- +2.25.1 + diff --git a/lxc.spec b/lxc.spec index 3d7da5a..51df32b 100644 --- a/lxc.spec +++ b/lxc.spec @@ -1,4 +1,4 @@ -%global _release 8 +%global _release 9 %global enable_isulad 1 Name: lxc @@ -20,6 +20,7 @@ Patch0008: 0008-bugfix-for-system-container-and-stream.patch Patch0009: 0009-bugfix-about-cgroup-mount-propagation-and-capabiliti.patch Patch0010: 0010-add-storage-block-code-for-embedded-image.patch Patch0011: 0011-skip-setup-console-if-disable-pty-and-fix-syscontain.patch +Patch0012: 0012-fix-dev-mount-failed-and-skip-send-recv-devpts_fd-if.patch BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath BuildRequires: pkgconfig(libseccomp) @@ -207,6 +208,12 @@ meson test -C build %endif %changelog +* Fri Jan 12 2024 zhangxiaoyu - 5.0.2-9 +- Type: bugfix +- ID:NA +- SUG:NA +- DESC: fix dev mount failed and skip send/recv devpts_fd if disable_pty + * Thu Jan 04 2024 zhangxiaoyu - 5.0.2-8 - Type: bugfix - ID:NA -- Gitee