From 58d2c892a30a0171f05753404f854028dc88ee3e Mon Sep 17 00:00:00 2001 From: WangFengTu Date: Fri, 19 Aug 2022 15:18:24 +0800 Subject: [PATCH] return fail if no args or no rootfs path found Signed-off-by: WangFengTu --- ...l-if-no-args-or-no-rootfs-path-found.patch | 38 +++++++++++++++++++ lxc.spec | 9 ++++- series.conf | 1 + 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 0013-return-fail-if-no-args-or-no-rootfs-path-found.patch diff --git a/0013-return-fail-if-no-args-or-no-rootfs-path-found.patch b/0013-return-fail-if-no-args-or-no-rootfs-path-found.patch new file mode 100644 index 0000000..ca06714 --- /dev/null +++ b/0013-return-fail-if-no-args-or-no-rootfs-path-found.patch @@ -0,0 +1,38 @@ +From ee2a2242a009627fe6edd89f4624d8eb6dd1756c Mon Sep 17 00:00:00 2001 +From: WangFengTu +Date: Fri, 19 Aug 2022 14:32:22 +0800 +Subject: [PATCH] return fail if no args or no rootfs path found + +Signed-off-by: WangFengTu +--- + src/lxc/lxccontainer.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c +index 3f75184..2133782 100644 +--- a/src/lxc/lxccontainer.c ++++ b/src/lxc/lxccontainer.c +@@ -1030,6 +1030,20 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a + argv = init_cmd = use_init_args(conf->init_argv, conf->init_argc); + } + ++ // do not allow using default rootfs path when isulad ++ if (conf->rootfs.mount == NULL || conf->rootfs.path == NULL) { ++ ERROR("Empty rootfs path detected"); ++ lxc_put_handler(handler); ++ return false; ++ } ++ ++ // do not allow using default args when isulad ++ if (!argv) { ++ ERROR("Empty args detected"); ++ lxc_put_handler(handler); ++ return false; ++ } ++ + if (c->image_type_oci) { + handler->image_type_oci = true; + } +-- +2.25.1 + diff --git a/lxc.spec b/lxc.spec index 52b691d..a0e5423 100644 --- a/lxc.spec +++ b/lxc.spec @@ -1,4 +1,4 @@ -%global _release 2022080901 +%global _release 2022081901 Name: lxc Version: 4.0.3 @@ -20,6 +20,7 @@ Patch0009: 0009-fix-HOME-env-of-container-unset-error.patch Patch0010: 0010-check-yajl-only-when-have-isulad.patch Patch0011: 0011-drop-security_context_t.patch Patch0012: 0012-only-set-user-or-image-set-non-empty-HOME.patch +Patch0013: 0013-return-fail-if-no-args-or-no-rootfs-path-found.patch BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath BuildRequires: pkgconfig(libseccomp) @@ -191,6 +192,12 @@ make check %{_mandir}/*/man7/%{name}* %changelog +* Fri Aug 19 2022 wangfengtu - 4.0.3-2022081901 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: return fail if no args or no rootfs path found + * Tue Aug 9 2022 haozi007 - 4.0.3-2022080901 - Type:bugfix - ID:NA diff --git a/series.conf b/series.conf index 4c1cbc3..8200753 100644 --- a/series.conf +++ b/series.conf @@ -10,3 +10,4 @@ 0010-check-yajl-only-when-have-isulad.patch 0011-drop-security_context_t.patch 0012-only-set-user-or-image-set-non-empty-HOME.patch +0013-return-fail-if-no-args-or-no-rootfs-path-found.patch -- Gitee