[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#762304: debootstrap doesn't unmount /proc and /sys if caught Ctrl-C



Package: debootstrap
Version: 1.0.48+deb7u1
Severity: grave

debootstrap doesn't unmount /proc and /sys (on my Debian GNU/Linux) if caught Ctrl-C in unpacking stage.

I started debootstrap, then I changed my mind, pressed Ctrl-C and then decided to delete target (let's assume it is /tmp/wheezy). I typed "rm -r /tmp/wheezy", and then unexpectedly I saw the following:

rm: cannot remove `/tmp/wheezy/proc/asound/PCH': Operation not permitted
rm: cannot remove `/tmp/wheezy/proc/asound/card0/id': Operation not permitted
rm: cannot remove `/tmp/wheezy/proc/asound/card0/codec#0': Operation not permitted
[...]
rm: cannot remove `/tmp/wheezy/proc/1/mem': Permission denied
rm: cannot remove `/tmp/wheezy/proc/1/cwd': Permission denied
rm: cannot remove `/tmp/wheezy/proc/1/root': Permission denied
rm: cannot remove `/tmp/wheezy/proc/1/exe': Permission denied
rm: cannot remove `/tmp/wheezy/proc/1/mounts': Permission denied
[...]

This is very frustrating output. It is similar to output of the "rm -rf /*" command, so I was scared and I decided then I am deleting all my files. Then I discovered that the files are safe. (But I think this is possible that "rm -r /tmp/wheezy/proc /tmp/wheezy/sys" somehow damages host system.)

So, please, fix this bug. I gave it severity "grave" because:
1. Output of "rm -r /tmp/wheezy" makes a user very scared.
2. "rm -r" doesn't follow symbolic links. So, "rm -r /tmp/wheezy" (which includes "rm -r /tmp/wheezy/proc/1/root") fortunately didn't remove all files. But if "rm" did, then all files would be deleted.
3. debootstrap on my Debian GNU/Linux doesn't mount /dev, it mounts just /proc and /sys. But if it mounted /dev (via "mount --bind /dev /tmp/wheezy/dev" or via "mount -t devtmpfs devtmpfs /tmp/wheezy/dev"), then "rm -r /tmp/wheezy" would do "rm -r /tmp/wheezy/dev" and this would erase /dev on the host system (including /dev/null) and this would make the system unstable and it would probably crash.

So, as you can see, this bug is very close to make serious problems to whole system or even to data loss. Moreover, this is possible that this bug really cases crashes or data loss on other arches (for example, kFreeBSD or Hurd), for example, because they mount /dev or something like that.

Command, which reproduces the bug:
debootstrap --variant=minbase wheezy /tmp/wheezy http://localhost:3142/debian

Host is wheezy.

==
Askar Safin
http://vk.com/safinaskar
Moscow, Russia
Moscow State University, http://msu.ru , Faculty of Mechanics and Mathematics, Department of Mathematical Logic and Theory of Algorithms
.

Reply to: