[lxc-devel] [lxc/master] conf: fix chroot jail issue

2xsec on Github lxc-bot at linuxcontainers.org
Fri Nov 16 03:00:55 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 398 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20181116/a8ecf1c9/attachment.bin>
-------------- next part --------------
From d777942209461d0a6389a3ae5dcae6bc8c6e2b99 Mon Sep 17 00:00:00 2001
From: 2xsec <dh48.jeong at samsung.com>
Date: Fri, 16 Nov 2018 11:59:46 +0900
Subject: [PATCH] conf: fix chroot jail issue

Signed-off-by: 2xsec <dh48.jeong at samsung.com>
---
 src/lxc/conf.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index 3d0e4a192..f7e8dd6e8 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -1463,6 +1463,12 @@ int lxc_chroot(const struct lxc_rootfs *rootfs)
 		return -1;
 	}
 
+	ret = chdir("/");
+	if (ret < 0) {
+		SYSERROR("Failed to chroot(\"/\")");
+		return -1;
+	}
+
 	return 0;
 }
 


More information about the lxc-devel mailing list