return fail if no args or no rootfs path found

Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
(cherry picked from commit 70a531a8677edc3e52bfd81e72f225667bd8b858)
This commit is contained in:
zhangxiaoyu 2022-08-31 14:49:28 +08:00 committed by openeuler-sync-bot
parent 76ffd3ecfd
commit 7618df6be6
4 changed files with 49 additions and 3 deletions

View File

@ -0,0 +1,38 @@
From 7fa433ba6e534dcf839845e11771a50c2cc44ff4 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
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 <zhangxiaoyu58@huawei.com>
---
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

View File

@ -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<zhangxiaoyu58@huawei.com> - 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<liuhao27@huawei.com> - 4.0.3-2022081201
- Type:bugfix
- ID:NA

View File

@ -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