From 33c5ad0b19a0bacf827a00255ca02c7aa5f9d2ed Mon Sep 17 00:00:00 2001 From: Balint Reczey Date: Mon, 4 Feb 2019 22:41:51 +0700 Subject: [PATCH] live-build/functions: Always use mount --make-private before umount Util-linux 2.33 fixed mount --rbind --make-rslave which did not pass MS_REC with MS_BIND and livecd-rootfs did only --bind --make-rslave effectively with prior mount versions. While mount --rbind --rslave are properly passed the flags to mount() unmounting did not work cleanly with --make-rslave. To clearly stop propagation of umount, --make-private is used instead of --make-rslave and it is always set before umounts. Umount -R is replaced with a simple umount since submounts are tore down in teardown_mountpoint() earlier. LP: #1813730 --- live-build/functions | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/live-build/functions b/live-build/functions index 53f6c1a9..a05db492 100644 --- a/live-build/functions +++ b/live-build/functions @@ -91,7 +91,7 @@ mount_image() { setup_mountpoint() { local mountpoint="$1" - mount --rbind --make-rslave /dev "$mountpoint/dev" + mount --rbind /dev "$mountpoint/dev" mount proc-live -t proc "$mountpoint/proc" mount sysfs-live -t sysfs "$mountpoint/sys" mount -t tmpfs none "$mountpoint/tmp" @@ -112,6 +112,7 @@ teardown_mountpoint() { # sort -r ensures that deeper mountpoints are unmounted first for submount in $(awk "$mountpoint/boot/efi/bloat_file" 2> /dev/null || true rm "$mountpoint/boot/efi/bloat_file" + mount --make-private "$mountpoint/boot/efi" umount --detach-loop "$mountpoint/boot/efi" fi