Re: Glitch in sys_chroot()

Elliot Lee (sopwith@cuc.edu)
Thu, 14 Nov 1996 20:29:32 -0500 (EST)


On 14 Nov 1996, Aaron M. Ucko wrote:

>
> Jonathan Larmour <jlarmour@origin-at.co.uk> writes:
>
> > This was commented on in some security lists, but it never seems
> > to have made it into the kernel as of 2.0.25.
>
> That's because the bug is in chroot(8), not chroot(2). chroot(2) is
> supposed to change only the root directory; Linux's behavior is
> correct.

I don't think the bug is in chroot(8) necessarily (although

POSIX tests don't include chroot AFAIK, the man pages on other systems
don't specify that the PWD isn't changed (although they DO specify that
/.. should point to /., a behaviour which Linux follows) therefore there
is no real standard as to determine what makes it incorrect/correct.

What makes Linux's behaviour correct in your opinion? If it is supposed to
change the root directory, it should make sure the other parameters of the
process follow that root directory, including PWD.

I'd say put the chdir in there, and also verify that /.. is /.

-- Elliot

http://www.redhat.com/