lxc: warning fixes in busybox template

Warnings fixes:
- optional mounts when dirs not available
- busybox dynamically linked
- fstab not available in container

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
This commit is contained in:
Bogdan Purcareata 2016-03-25 08:12:53 +00:00 committed by Bruce Ashfield
parent f52fd7e614
commit c29fe5e3d0
4 changed files with 125 additions and 0 deletions

View File

@ -0,0 +1,43 @@
From 07e4c41f2963d73b9aedd552c74f17a33e89f020 Mon Sep 17 00:00:00 2001
From: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Date: Thu, 24 Mar 2016 11:54:27 +0000
Subject: [PATCH] lxc-busybox: Remove warning for dynamically linked Busybox
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The warning has been present since commit 32b37181ea (with no purpose stated).
Support for dynamically linked Busybox has been added since commit bf6cc73696.
Haven't encountered any issues with dynamically linked Busybox in my last
2 years' testing.
Upstream-status: Accepted
[https://github.com/lxc/lxc/commit/07e4c41f2963d73b9aedd552c74f17a33e89f020]
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
---
templates/lxc-busybox.in | 7 -------
1 file changed, 7 deletions(-)
diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in
index f547f9e..336fa12 100644
--- a/templates/lxc-busybox.in
+++ b/templates/lxc-busybox.in
@@ -304,13 +304,6 @@ configure_busybox()
return 1
fi
- file -L $(which busybox) | grep -q "statically linked"
- if [ $? -ne 0 ]; then
- echo "warning : busybox is not statically linked."
- echo "warning : The template script may not correctly"
- echo "warning : setup the container environment."
- fi
-
# copy busybox in the rootfs
cp $(which busybox) $rootfs/bin
if [ $? -ne 0 ]; then
--
1.9.1

View File

@ -0,0 +1,30 @@
From 6ab1ca0375feeb00070f0c0f9186551b08b1ee5e Mon Sep 17 00:00:00 2001
From: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Date: Tue, 22 Mar 2016 13:33:57 +0000
Subject: [PATCH] lxc-busybox: Touch /etc/fstab in the container rootfs
Upstream-status: Accepted
[https://github.com/lxc/lxc/commit/6ab1ca0375feeb00070f0c0f9186551b08b1ee5e]
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
---
templates/lxc-busybox.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in
index c020e66..f547f9e 100644
--- a/templates/lxc-busybox.in
+++ b/templates/lxc-busybox.in
@@ -330,6 +330,9 @@ configure_busybox()
# relink /sbin/init
ln $rootfs/bin/busybox $rootfs/sbin/init
+ # /etc/fstab must exist for "mount -a"
+ touch $rootfs/etc/fstab
+
# passwd exec must be setuid
chmod +s $rootfs/bin/passwd
touch $rootfs/etc/shadow
--
1.9.1

View File

@ -0,0 +1,49 @@
From 88e078ba865b675f9a0dc61caa0732d7052593f8 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner@mailbox.org>
Date: Wed, 23 Mar 2016 16:37:09 +0100
Subject: [PATCH] open_without_symlink: Don't SYSERROR on something else than
ELOOP
The open_without_symlink routine has been specifically created to prevent
mounts with synlinks as source or destination. Keep SYSERROR'ing in that
particular scenario, but leave error handling to calling functions for the
other ones - e.g. optional bind mount when the source dir doesn't exist
throws a nasty error.
Upstream-status: Accepted
[https://github.com/lxc/lxc/commit/88e078ba865b675f9a0dc61caa0732d7052593f8]
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
---
src/lxc/utils.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/lxc/utils.c b/src/lxc/utils.c
index 6bee698..8e7ebbc 100644
--- a/src/lxc/utils.c
+++ b/src/lxc/utils.c
@@ -1621,8 +1621,6 @@ static int open_without_symlink(const char *target, const char *prefix_skip)
errno = saved_errno;
if (errno == ELOOP)
SYSERROR("%s in %s was a symbolic link!", nextpath, target);
- else
- SYSERROR("Error examining %s in %s", nextpath, target);
goto out;
}
}
@@ -1667,8 +1665,11 @@ int safe_mount(const char *src, const char *dest, const char *fstype,
destfd = open_without_symlink(dest, rootfs);
if (destfd < 0) {
- if (srcfd != -1)
+ if (srcfd != -1) {
+ saved_errno = errno;
close(srcfd);
+ errno = saved_errno;
+ }
return destfd;
}
--
1.9.1

View File

@ -37,6 +37,9 @@ SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
file://open_without_symlink-Account-when-prefix-is-empty-st.patch \
file://lxc_setup_fs-Create-dev-shm-folder-if-it-doesn-t-exi.patch \
file://mount_proc_if_needed-only-safe-mount-when-rootfs-is-.patch \
file://open_without_symlink-Don-t-SYSERROR-on-something-els.patch \
file://lxc-busybox-Touch-etc-fstab-in-the-container-rootfs.patch \
file://lxc-busybox-Remove-warning-for-dynamically-linked-Bu.patch \
"
SRC_URI[md5sum] = "d33c4bd9c57755c0e2b0e2acbc3f171d"