return fail if no args or no rootfs path found

Signed-off-by: WangFengTu <wangfengtu@huawei.com>
This commit is contained in:
WangFengTu 2022-08-19 15:18:24 +08:00
parent 04c9a5385b
commit 58d2c892a3
3 changed files with 47 additions and 1 deletions

View File

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

View File

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

View File

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