Problem with patch and infinit directories

Rob Warnock rpw3 at redwood.UUCP
Wed Jan 16 16:02:07 AEST 1985


+---------------
| I also accidentally created a HARD link, using patch,...
|                  ... I wonder how could patch do such an evil thing?
| And just how is it possible for `root' to create such a directory in 4.2
| without writing to raw disc?
| -michael
+---------------

WARNING!!! It has ALWAYS been possible (on any UNIX I know) for a superuser
to create a (hard) link to a directory.  While the "ln" program (command) will
not allow it, the system call does (for the superuser) and must (for "mv").
Any program that runs as root and does not use 'system("/bin/ln ...")' for
making links (or 'system("mv ...")' for renaming) should have defensive code.

(It's actually useful, on occasion, to make a hard link to a directory, to
temporarily work around problems with hard-coded paths in binary programs.
This is not particularly a problem if you don't create a loop.)


Rob Warnock
Systems Architecture Consultant

UUCP:	{ihnp4,ucbvax!dual}!fortune!redwood!rpw3
DDD:	(415)572-2607
USPS:	510 Trinidad Lane, Foster City, CA  94404



More information about the Comp.unix mailing list