]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
volatile-binds: add recipe variable to allow disabling OverlayFS
authorLuca Boccassi <luca.boccassi@microsoft.com>
Mon, 28 Mar 2022 15:26:54 +0000 (16:26 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 29 Mar 2022 14:58:39 +0000 (15:58 +0100)
Use the new MOUNT_COPYBIND_AVOID_OVERLAYFS flag provided by mount-copybind.
When SELinux is enabled, processes accessing OverlayFS mounts will get a denial
if the process setting up the mount doesn't have all the permissions that
the accessor has.

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/volatile-binds/files/volatile-binds.service.in
meta/recipes-core/volatile-binds/volatile-binds.bb

index e2ad39f258c56ac260543a978f9fdbaa6270e41f..6612d2aae09ee90ad6fe5790ce55cc00f37d0e42 100644 (file)
@@ -11,6 +11,7 @@ ConditionPathIsReadWrite=!@where@
 Type=oneshot
 RemainAfterExit=Yes
 TimeoutSec=0
+Environment=MOUNT_COPYBIND_AVOID_OVERLAYFS=@avoid_overlayfs@
 ExecStart=/sbin/mount-copybind @what@ @where@
 ExecStop=/bin/umount @where@
 
index d5c5538cd7e731864fa59c42090ae3464b5a5baa..3fefa9abde904dcfb35fc3d54fc258bf6e39c004 100644 (file)
@@ -37,6 +37,9 @@ SYSTEMD_SERVICE:${PN} = "${@volatile_systemd_services(d)}"
 
 FILES:${PN} += "${systemd_system_unitdir}/*.service ${servicedir}"
 
+# Set to 1 to forcibly skip OverlayFS, and default to copy+bind
+AVOID_OVERLAYFS = "0"
+
 do_compile () {
     while read spec mountpoint; do
         if [ -z "$spec" ]; then
@@ -47,6 +50,7 @@ do_compile () {
         servicefile="$(echo "$servicefile" | tr / -).service"
         sed -e "s#@what@#$spec#g; s#@where@#$mountpoint#g" \
             -e "s#@whatparent@#${spec%/*}#g; s#@whereparent@#${mountpoint%/*}#g" \
+            -e "s#@avoid_overlayfs@#${@d.getVar('AVOID_OVERLAYFS')}#g" \
             volatile-binds.service.in >$servicefile
     done <<END
 ${@d.getVar('VOLATILE_BINDS').replace("\\n", "\n")}