Re: Chroot bug



On Wednesday 26 September 2007 13:06:51 David Newall wrote:
Alan Cox wrote:
The dot-dot entry in the root directory is interpreted to mean the
root directory itself. Thus, dot-dot cannot be used to access files
outside the subtree rooted at the root directory.

Which is behaviour chroot preserves properly.

And yet it is the dot-dot entry which is used to access files outside
the root.

The specification says explicitly

"The process working directory is unaffected by chroot()."

Do you believe that when those words were first written, the hidden
conflict, namely that it permits dot-dot to access files outside the
subtree, was understood? They would have said so if that were the case.

You seem to be misunderstanding what Alan is trying to say to you, if your
program calls chroot, it's working directory is unaffected. Programs that are
started in the chrooted root, will be affected.

i.e. if you run chroot in bash, the bash process's CWD is not affected and
bash can escape the chrooted root, but if you run ls .., it will not escape.

If you do not get too emotional, you tend to understand what people are trying
to say.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Mandrake 8.1 Desktop Gone
    ... Read the man page for the FTP server and look for the ... Use chmod to remove "others" access to all directories in root. ... setting it up in a chroot jail. ... chroot - run command or interactive shell with special root directory ...
    (alt.os.linux)
  • Re: Mandrake 8.1 Desktop Gone
    ... Tighten down permissions so that ms ie7 ftp wouldn't navigate into the ... Use chmod to remove "others" access to all directories in root. ... setting it up in a chroot jail. ... chroot - run command or interactive shell with special root directory ...
    (alt.os.linux)
  • Re: Chroot bug (was: sys_chroot+sys_fchdir Fix)
    ... The root directory, '/' is changed, and if the process is capable of using ... chroot, it may change the root directory again. ... You know you're in trouble when packet floods are competing to flood you. ...
    (Linux-Kernel)
  • Re: Chroot bug
    ... dot-dot cannot be used to access files ... outside the subtree rooted at the root directory. ... Which is behaviour chroot preserves properly. ...
    (Linux-Kernel)
  • Chroot bug (was: sys_chroot+sys_fchdir Fix)
    ... Miloslav Semler pointed out that a root process can chdirout of its chroot. ... Although this is documented in the man page, it conflicts with the essential function, which is to change the root directory of the process. ... In addition to any creative uses, for example Philipp Marek's loading dynamic libraries, it seems clear that the prime purpose of chroot is to aid security. ...
    (Linux-Kernel)