On 10/15/2015 7:31 AM, Serge Hallyn wrote:
Quoting Yang Shi (yang....@linaro.org):
When run the below command:
lxc-start -n name -f /path/to/config
If config is not a regular file, lxc-start will be killed by SEG FAULT
directly.
What exactly was the file to get a segfault? When I try with a device
or a directory I do not get a segfault.
I'm using lxc 1.1.3 stable release on armv8 target, when I run the below
command I got segment fault.
# lxc-start -n test -f /var/lib/lxc/test/
lxc-start[309]: unhandled level 2 translation fault (11) at 0x00000000,
esr 0x92000006
pgd = ffff80834780e000
[00000000] *pgd=00000083cb385003, *pud=00000083c99e3003,
*pmd=0000000000000000
CPU: 2 PID: 309 Comm: lxc-start Not tainted 4.1.10 #25
Hardware name: Freescale Layerscape 2085a RDB Board (DT)
task: ffff80007b944d00 ti: ffff808347874000 task.ti: ffff808347874000
PC is at 0xffff9d1ff2d0
LR is at 0xffff9d1bc0d0
pc : [<0000ffff9d1ff2d0>] lr : [<0000ffff9d1bc0d0>] pstate: 80000000
sp : 0000fffffd9f3af0
x29: 0000fffffd9f3af0 x28: 0000000000413000
x27: 0000000000000000 x26: 0000000000000001
x25: 0000000000000000 x24: 0000000000414370
x23: 0000fffffd9f3be0 x22: 0000ffff9d35d3b0
x21: 000000000000000f x20: 0000ffff9d37c000
x19: 00000000004166d0 x18: 0000000000000001
x17: 0000ffff9d1bc1e8 x16: 0000ffff9d37a458
x15: 1201001100000000 x14: 00000000004167e0
x13: 0000000000000000 x12: 0000000000000023
x11: 0000000000000023 x10: 0101010101010101
x9 : 7f7f7f7f7f7f7f7f x8 : 0101010101010101
x7 : 7f7f7f7f7f7f7f7f x6 : ff4753404f5e5245
x5 : 8000000000000000 x4 : 0000000000000000
x3 : 00485441505f5346 x2 : 544f4f525f43584c
x1 : 0000000000000000 x0 : 0000000000000000
Exit with some error message to improve user experience.
This is not the place to put that check (if it is needed). It should go
into either lxc_container_new or load_config, wherever it is failing.
Thanks. If you think the segment fault error sounds valid, I will try to
move the check to the right place.
Regards,
Yang
Signed-off-by: Yang Shi <yang....@linaro.org>
---
src/lxc/lxc_start.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/lxc/lxc_start.c b/src/lxc/lxc_start.c
index 6b942ac..d1cf779 100644
--- a/src/lxc/lxc_start.c
+++ b/src/lxc/lxc_start.c
@@ -212,6 +212,7 @@ int main(int argc, char *argv[])
NULL,
};
struct lxc_container *c;
+ struct stat st_stat = {0};
lxc_list_init(&defines);
@@ -242,6 +243,18 @@ int main(int argc, char *argv[])
/* rcfile is specified in the cli option */
if (my_args.rcfile) {
rcfile = (char *)my_args.rcfile;
+ tmp = stat(rcfile, &st_stat);
+
+ if (tmp && errno == ENOENT) {
+ ERROR("The config path doesn't exist.\n");
+ return err;
+ }
+
+ if (!tmp && !S_ISREG(st_stat.st_mode)) {
+ ERROR("The config is not a regular file.\n");
+ return err;
+ }
+
c = lxc_container_new(my_args.name, lxcpath);
if (!c) {
ERROR("Failed to create lxc_container");
--
2.0.2
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel