Messages in this thread | | | Date | Sat, 19 Oct 2002 13:44:45 -0400 | From | Eric Buddington <> | Subject | Re: can chroot be made safe for non-root? |
| |
On Tue, Oct 15, 2002 at 11:44:32PM -0700, Philippe Troin wrote: > > Would it be reasonable to allow non-root processes to chroot(), if the > > chroot syscall also changed the cwd for non-root processes? > > No. > > fd = open("/", O_RDONLY); > chroot("/tmp"); > fchdir(fd); > > and you're out of the chroot.
I see. From my aesthetic, it would make sense for chroots to 'stack', such that once a directory is made the root directory, its '..' entry *always* points to itself, even after another chroot(). That would prevent the above break (you could be outside the new root, but you still couldn't back out past the old root), though perhaps at an unacceptable in complexity.
I do like the idea of preventing multiple chroots, as a second option.
Thanks to everyone for all the useful comments.
-Eric - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |