From e5db883b6ce13944619c36b93780a4d2b941232e Mon Sep 17 00:00:00 2001 From: Tanya Degurechaff <34323200+TanyaEleventhGoddess@users.noreply.github.com> Date: Mon, 29 Jun 2020 23:10:51 +0200 Subject: [PATCH] Restrict removal to cgroup mountpoints created by these scripts --- cgroupfs-umount | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cgroupfs-umount b/cgroupfs-umount index ac26b6b..18c328f 100755 --- a/cgroupfs-umount +++ b/cgroupfs-umount @@ -20,11 +20,14 @@ fi cd /sys/fs/cgroup for sys in *; do - if mountpoint -q $sys; then - umount $sys - fi - if [ -d $sys ]; then - rmdir $sys || true + # Solves https://bugs.debian.org/950986 + if grep -q $sys /proc/cgroups 2>/dev/null || [ $sys = 'systemd' ]; then + if mountpoint -q $sys; then + umount $sys + fi + if [ -d $sys ]; then + rmdir $sys || true + fi fi done