Re: [RFC] Bug in mkdir(2)

Wolfgang Walter (wolfgang.walter@stusta.mhn.de)
Wed, 16 Jun 1999 23:58:33 +0200


On Wed, Jun 16, 1999 at 10:11:00PM +0100, Alan Cox wrote:
> > Following symlinks can be useful at times. It is the root-owned
> > processes responsibility to check for symlinks in /tmp. This argument
> > can be used for any file manipulation in a globally writable directory.
> > Both mkdir("foo") and mkdir("foo/") should follow symlinks for
> > consistency purposes.
>
> You can demonstrate the link following race for O_EXCL|O_CREAT is insoluble.

Yes. But it is possible to reduce it to a practical minimal risk by using
a long enough really random filename and if this succeeds, to rename it to
the wished name.

For temporary files in /tmp which do not need a well known name it is probably
the best to just choose such real random numbers, anyway. This solves i.e.
often some denial of service attack possibilties. But this is my very private
opinion and this method seems not to be used often.

Wolfgang Walter

> This is why every modern Unix doesn't link follow on create. It doesn't work.
>
>
> Alan
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.rutgers.edu
> Please read the FAQ at http://www.tux.org/lkml/

-- 
Veni, Vidi, VISA:
	I came, I saw, I did a little shopping.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/