Re: silent semantic changes with reiser4

Rik van Riel
2004-08-26T19:11:48Z

On Thu, 26 Aug 2004, Linus Torvalds wrote:
> On Thu, 26 Aug 2004, Rik van Riel wrote:
> >
> > So you'd have both a file and a directory that just happen
> > to have the same name ? How would this work in the dcache?
>
> There would be only one entry in the dcache. The lookup will select
> whether it opens the file or the directory based on O_DIRECTORY (and
> usage, of course - if it's in the middle of a path, it obviously needs to
> be opened as a directory regardless).

Hmmm, I just straced "cp /bin/bash /tmp".
One line stood out as a potential problem:

open("/tmp/bash", O_WRONLY|O_CREAT|O_LARGEFILE, 0100755) = 4

What do we do with O_CREAT ?

Do we always allow both a directory and a file to be created with
the same name ?

Does this create a new class of "symlink attack" style security
holes ?

--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan