]> git.ipfire.org Git - thirdparty/coreutils.git/commit
chroot: call chroot() unconditionally to handle bind mounted "/"
authorPádraig Brady <P@draigBrady.com>
Wed, 15 Oct 2014 17:08:42 +0000 (18:08 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 15 Oct 2014 23:45:32 +0000 (00:45 +0100)
commitd520929586ee2063d48359aaaef8f28807604cae
tree3922530539173d01e62ae04aedd252d61c3d7ecd
parent84616da89dbfc81e22f8c2fd077f1d61d788522c
chroot: call chroot() unconditionally to handle bind mounted "/"

* src/chroot.c (is_root): Adjust to compare canonicalized paths
rather than inodes, to handle (return false in) the case where
we have a tree that is constructed by first bind mounting "/"
(thus having the same inode).
(main): Unconditionally call chroot() because it's safer
and of minimal performance benefit to avoid in this case.
This will cause inconsistency with some platforms
not allowing `chroot / true` for non root users.
* tests/misc/chroot-fail.sh: Adjust appropriately.
* NEWS: Mention the bug fixes.
Fixes http://bugs.gnu.org/18736
NEWS
src/chroot.c
tests/misc/chroot-fail.sh