[lxc-devel] [distrobuilder/master] chroot: Unmount /dev/fuse

monstermunchkin on Github lxc-bot at linuxcontainers.org
Tue Mar 3 08:15:41 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200303/d8811391/attachment.bin>
-------------- next part --------------
From 0dc2ee9d9bf6613445f3b69996b45862ce261d12 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Tue, 3 Mar 2020 09:15:05 +0100
Subject: [PATCH] chroot: Unmount /dev/fuse

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 shared/chroot.go | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/shared/chroot.go b/shared/chroot.go
index e15540e..13b215b 100644
--- a/shared/chroot.go
+++ b/shared/chroot.go
@@ -58,14 +58,6 @@ func setupMounts(rootfs string, mounts []ChrootMount) error {
 		}
 	}
 
-	// Make sure /dev/fuse is read-only
-	if lxd.PathExists("/dev/fuse") {
-		err = unix.Mount("", "/dev/fuse", "", unix.MS_REMOUNT|unix.MS_BIND|unix.MS_RDONLY, "")
-		if err != nil {
-			return errors.Wrap(err, "Failed to mount '/dev/fuse' read-only")
-		}
-	}
-
 	return nil
 }
 
@@ -130,6 +122,14 @@ func moveMounts(mounts []ChrootMount) error {
 		return err
 	}
 
+	// Make sure /dev/fuse is unmounted
+	if lxd.PathExists("/dev/fuse") {
+		err = unix.Unmount("/dev/fuse", 0)
+		if err != nil {
+			return errors.Wrap(err, "Failed to unmount /dev/fuse")
+		}
+	}
+
 	return nil
 
 }


More information about the lxc-devel mailing list