Re: silent semantic changes with reiser4

Christoph Hellwig
2004-08-26T12:43:03Z

On Thu, Aug 26, 2004 at 12:54:09AM +0100, Jamie Lokier wrote:
> Christoph Hellwig wrote:
> > > Reiser4 may have a mount option for whoose who like or have to use
> > > traditional O_DIRECTORY semantics. There would be no /metas under
> > > non-directories, if user wants that.
> >
> > Again, O_DIRECTORY was added to solve a real-world race, not just for
> > the sake of it. If you really want to add that option I'll research the
> > CAN number for you so you can named it after that - or just call it -o
> > insecure directly.
>
> man open(2) explains that O_DIRECTORY is used by opendir() to prevent
> blocking when opening pipes and certain devices*, and should only by
> used by opendir (of course it isn't only used by opendir, as it's a
> handy optimisation).
>
> In fact O_DIRECTORY is also used by Glibc to optimise away stat()
> before and fstat() after calls.
>
> An O_NODEVICE flag would be equally secure, and more generally useful.

It would prevent the open device issue but you'd need another syscall.
Anyways, this is an existing API and chaging it now would suddenly
making everything that relies on it for that purpose insecure, so it's
completely out of option.