News for hackers. Stuff that matters.
Re:The origins of chroot() by xg15 on Wednesday September 02, 2015 @01:31PM (#10160744)
That's an interesting tidbit. Though, with the last paragraph, I wonder how canonical paths worked when you have directories "above" the root.
Re:The origins of chroot() by spc476 on Thursday September 03, 2015 @12:28AM (#10163340)
Very early versions of Unix didn't enforce a hierarchical file system---it was, in fact, a directed graph (not only could you have multiple hardlinks to files, but multiple hardlinks to directories!). (information from "Unix Implementation", Bell System Technical Journal, July-August 1978). So things back then were a lot less ... structured.
Re:The origins of chroot() by siebenmann on Wednesday September 02, 2015 @03:24PM (#10161398)
I suspect that the answer is 'badly'. V7's chroot() seems to be more than a little bit of a fast hack, one that was good enough for some things but not at all comprehensive or problem free.

(There are PDP-11 emulators and V7 disk images available through tuhs.org, so intrepid people who want to find out for themselves can actually try this out on a live V7 system.)

Re:The origins of chroot() by dfox on Wednesday September 02, 2015 @07:19PM (#10162557)
I think that chroot predates anything in kernel that would care about canonical paths. OS X manpage (first google hit for "getcwd history") claims that "The getwd() function appeared in 4.0BSD.", which is to this day essentially the only syscall that returns path name.
Re:The origins of chroot() by xj9 on Wednesday September 02, 2015 @03:54PM (#10161525)
You don't. A correct `chroot()` implementation shouldn't let you access paths that aren't below the new `/`.
Re:The origins of chroot() by qu4z-2 on Wednesday September 02, 2015 @06:49PM (#10162434)
That is indeed the modern behaviour of chroot. It is not clear that the "original implementation" shown in the article shares that property, though.

EDIT: That's not to say it doesn't prevent that behaviour. If the usual code to prevent you ..ing above the root checks against u.u_rdir instead of /, it might well work as modern implementations do.

Re:The origins of chroot() by smoyer on Wednesday September 02, 2015 @09:15PM (#10162886)
My recollection of chroot in the late '90s is that it didn't provide a jail.
Re:The origins of chroot() by tsotha on Wednesday September 02, 2015 @09:57PM (#10163005)
Must of been OS dependent. When I was doing bootp stuff in the mid '90s the whole point of chroot was the jail.
Re:The origins of chroot() by gizmo686 on Wednesday September 02, 2015 @01:52PM (#10160892)
You could define the canonical path for such paths to begin with /../
Re:The origins of chroot() by lamontcg on Wednesday September 02, 2015 @03:50PM (#10161509)
One of the old security scanners (SATAN/SAINT or COPS maybe?) would test and report if your chroot was vulnerable to `cd ..`.
Re:The origins of chroot() by mzs on Wednesday September 02, 2015 @04:18PM (#10161658)
That's why for a while people would use fsdb to point .. to . instead.
Re:The origins of chroot() by arielby on Wednesday September 02, 2015 @03:02PM (#10161284)
chroot was always intended to allow running processes picky about their system environment.