From 7618df6be6b97c46ae5ef7e3c5b9b1843bdd8f43 Mon Sep 17 00:00:00 2001 From: zhangxiaoyu Date: Wed, 31 Aug 2022 14:49:28 +0800 Subject: [PATCH] return fail if no args or no rootfs path found Signed-off-by: zhangxiaoyu (cherry picked from commit 70a531a8677edc3e52bfd81e72f225667bd8b858) --- ...y-to-convert-selinux-label-to-shared.patch | 0 ...l-if-no-args-or-no-rootfs-path-found.patch | 38 +++++++++++++++++++ lxc.spec | 11 +++++- series.conf | 3 +- 4 files changed, 49 insertions(+), 3 deletions(-) rename 0040-refactor-the-way-to-convert-selinux-label-to-shared.path => 0040-refactor-the-way-to-convert-selinux-label-to-shared.patch (100%) create mode 100644 0046-return-fail-if-no-args-or-no-rootfs-path-found.patch diff --git a/0040-refactor-the-way-to-convert-selinux-label-to-shared.path b/0040-refactor-the-way-to-convert-selinux-label-to-shared.patch similarity index 100% rename from 0040-refactor-the-way-to-convert-selinux-label-to-shared.path rename to 0040-refactor-the-way-to-convert-selinux-label-to-shared.patch diff --git a/0046-return-fail-if-no-args-or-no-rootfs-path-found.patch b/0046-return-fail-if-no-args-or-no-rootfs-path-found.patch new file mode 100644 index 0000000..262aa57 --- /dev/null +++ b/0046-return-fail-if-no-args-or-no-rootfs-path-found.patch @@ -0,0 +1,38 @@ +From 7fa433ba6e534dcf839845e11771a50c2cc44ff4 Mon Sep 17 00:00:00 2001 +From: zhangxiaoyu +Date: Wed, 31 Aug 2022 17:30:27 +0800 +Subject: [PATCH] return fail if no args or no rootfs path found + +Signed-off-by: zhangxiaoyu +--- + src/lxc/lxccontainer.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c +index 69706a5..dd1dbf2 100644 +--- a/src/lxc/lxccontainer.c ++++ b/src/lxc/lxccontainer.c +@@ -1062,6 +1062,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) { ++ ERROR("Empty rootfs path detected"); ++ lxc_free_handler(handler); ++ return false; ++ } ++ ++ // do not allow using default args when isulad ++ if (!argv) { ++ ERROR("Empty args detected"); ++ lxc_free_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 03492b5..dc28fb6 100644 --- a/lxc.spec +++ b/lxc.spec @@ -1,4 +1,4 @@ -%global _release 2022081201 +%global _release 2022083101 Name: lxc Version: 4.0.3 @@ -47,12 +47,13 @@ Patch0036: 0036-compile-in-android-env.patch Patch0037: 0037-fix-always-print-and-temp-len.patch Patch0038: 0038-just-print-error-when-new-lock-failed.patch Patch0039: 0039-fix-bug-of-memory-free.patch -Patch0040: 0040-refactor-the-way-to-convert-selinux-label-to-shared.path +Patch0040: 0040-refactor-the-way-to-convert-selinux-label-to-shared.patch Patch0041: 0041-do-not-free-the-pointer-returned-by-dirname.patch Patch0042: 0042-add-x-permission-when-create-directory.patch Patch0043: 0043-do-not-operate-playload-and-attach-cgroup-if-no-cont.patch Patch0044: 0044-fix-HOME-env-unset-error.patch Patch0045: 0045-only-set-user-or-image-set-non-empty-HOME.patch +Patch0046: 0046-return-fail-if-no-args-or-no-rootfs-path-found.patch BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath BuildRequires: pkgconfig(libseccomp) @@ -224,6 +225,12 @@ make check %{_mandir}/*/man7/%{name}* %changelog +* Wed Aug 31 2022 zhangxiaoyu - 4.0.3-2022083101 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: return fail if no args or no rootfs path found + * Fri Aug 12 2022 haozi007 - 4.0.3-2022081201 - Type:bugfix - ID:NA diff --git a/series.conf b/series.conf index 13aca86..fe34288 100644 --- a/series.conf +++ b/series.conf @@ -37,9 +37,10 @@ 0037-fix-always-print-and-temp-len.patch 0038-just-print-error-when-new-lock-failed.patch 0039-fix-bug-of-memory-free.patch -0040-refactor-the-way-to-convert-selinux-label-to-shared.path +0040-refactor-the-way-to-convert-selinux-label-to-shared.patch 0041-do-not-free-the-pointer-returned-by-dirname.patch 0042-add-x-permission-when-create-directory.patch 0043-do-not-operate-playload-and-attach-cgroup-if-no-cont.patch 0044-fix-HOME-env-unset-error.patch 0045-only-set-user-or-image-set-non-empty-HOME.patch +0046-return-fail-if-no-args-or-no-rootfs-path-found.patch -- Gitee