Re: If not readdir() then what?

2007-04-08 Thread Theodore Tso
On Sun, Apr 08, 2007 at 12:28:32PM -0700, H. Peter Anvin wrote: > Theodore Tso wrote: > >It doesn't state explicitly that you can use the telldir cookie() > >after closing the directory stream using closedir() and then reopening > >it using opendir(), but given that it states that results are >

Re: If not readdir() then what?

2007-04-08 Thread J. Bruce Fields
On Sat, Apr 07, 2007 at 04:36:33PM -0400, Theodore Tso wrote: > 1) Deprecate telldir/seekdir() altogether. Relatively few progams use > this functionality, and it is highly questionable how useful it is, > anyway. If you use telldir/seekdir and keep the cookie for a long > time, even the

Re: If not readdir() then what?

2007-04-08 Thread Ulrich Drepper
On 4/8/07, H. Peter Anvin <[EMAIL PROTECTED]> wrote: More fundamentally, the telldir cookie should never be valid when applied to a different DIR * (even one that refers to the same directory.) Don't worry about this. This is clearly the semantics which was always wanted. I've filed a defect

Re: If not readdir() then what?

2007-04-08 Thread H. Peter Anvin
Theodore Tso wrote: It doesn't state explicitly that you can use the telldir cookie() after closing the directory stream using closedir() and then reopening it using opendir(), but given that it states that results are undefined after a rewinddir() --- which is much less violent than a

Re: If not readdir() then what?

2007-04-08 Thread Ulrich Drepper
On 4/8/07, Theodore Tso <[EMAIL PROTECTED]> wrote: Ulrich, is it too late to insert a clarification that the telldir() cookie isn't guaranteed to be valid after closedir() *or* rewinddir()? It's never too late. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the

Re: If not readdir() then what?

2007-04-08 Thread Theodore Tso
On Sun, Apr 08, 2007 at 08:41:30PM +0200, Jörn Engel wrote: > > Garbage-collecting them on closedir() does not work. It surprised me as > well, but there seem to be applications that keep the telldir() cookie > around after closedir(). Iirc, "rm -r" was one of them. > > Neil, is this correct?

Re: If not readdir() then what?

2007-04-08 Thread H. Peter Anvin
Theodore Tso wrote: You could, but then you're succeptible to a memory allocation attack. If you have an arbitrarily large directory (say, one with multiple millions of entries), and the attacker program calls seekdir() after every single readdir() call, you would then force the kernel to

Re: If not readdir() then what?

2007-04-08 Thread Ulrich Drepper
On 4/7/07, Christoph Hellwig <[EMAIL PROTECTED]> wrote: It's not going to solve anything at all. We can't stop supporting functionality that has been there forever. Not necessarily. One problem here is that the interface for using readdir() with and without telldir()/seekdir() is the same.

Re: If not readdir() then what?

2007-04-08 Thread Theodore Tso
On Sun, Apr 08, 2007 at 11:11:20AM -0700, H. Peter Anvin wrote: > Christoph Hellwig wrote: > >On Sat, Apr 07, 2007 at 04:36:33PM -0400, Theodore Tso wrote: > >>this functionality, and it is highly questionable how useful it is, > >>anyway. If you use telldir/seekdir and keep the cookie for a long

Re: If not readdir() then what?

2007-04-08 Thread Jörn Engel
On Sun, 8 April 2007 11:11:20 -0700, H. Peter Anvin wrote: > > Well, the question is if you can keep the seekdir/telldir cookie around > as a pointer -- preferrably in userspace, of course. You would > presumably garbage-collect them on closedir() -- there is no other point > at which you

Re: If not readdir() then what?

2007-04-08 Thread H. Peter Anvin
Christoph Hellwig wrote: On Sat, Apr 07, 2007 at 04:36:33PM -0400, Theodore Tso wrote: this functionality, and it is highly questionable how useful it is, anyway. If you use telldir/seekdir and keep the cookie for a long time, even the POSIX-provided guarantees about files that are created and

Re: If not readdir() then what?

2007-04-08 Thread H. Peter Anvin
Christoph Hellwig wrote: On Sat, Apr 07, 2007 at 04:36:33PM -0400, Theodore Tso wrote: this functionality, and it is highly questionable how useful it is, anyway. If you use telldir/seekdir and keep the cookie for a long time, even the POSIX-provided guarantees about files that are created and

Re: If not readdir() then what?

2007-04-08 Thread Jörn Engel
On Sun, 8 April 2007 11:11:20 -0700, H. Peter Anvin wrote: Well, the question is if you can keep the seekdir/telldir cookie around as a pointer -- preferrably in userspace, of course. You would presumably garbage-collect them on closedir() -- there is no other point at which you could.

Re: If not readdir() then what?

2007-04-08 Thread Theodore Tso
On Sun, Apr 08, 2007 at 11:11:20AM -0700, H. Peter Anvin wrote: Christoph Hellwig wrote: On Sat, Apr 07, 2007 at 04:36:33PM -0400, Theodore Tso wrote: this functionality, and it is highly questionable how useful it is, anyway. If you use telldir/seekdir and keep the cookie for a long time,

Re: If not readdir() then what?

2007-04-08 Thread Ulrich Drepper
On 4/7/07, Christoph Hellwig [EMAIL PROTECTED] wrote: It's not going to solve anything at all. We can't stop supporting functionality that has been there forever. Not necessarily. One problem here is that the interface for using readdir() with and without telldir()/seekdir() is the same. A

Re: If not readdir() then what?

2007-04-08 Thread H. Peter Anvin
Theodore Tso wrote: You could, but then you're succeptible to a memory allocation attack. If you have an arbitrarily large directory (say, one with multiple millions of entries), and the attacker program calls seekdir() after every single readdir() call, you would then force the kernel to

Re: If not readdir() then what?

2007-04-08 Thread Theodore Tso
On Sun, Apr 08, 2007 at 08:41:30PM +0200, Jörn Engel wrote: Garbage-collecting them on closedir() does not work. It surprised me as well, but there seem to be applications that keep the telldir() cookie around after closedir(). Iirc, rm -r was one of them. Neil, is this correct? Well,

Re: If not readdir() then what?

2007-04-08 Thread Ulrich Drepper
On 4/8/07, Theodore Tso [EMAIL PROTECTED] wrote: Ulrich, is it too late to insert a clarification that the telldir() cookie isn't guaranteed to be valid after closedir() *or* rewinddir()? It's never too late. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body

Re: If not readdir() then what?

2007-04-08 Thread H. Peter Anvin
Theodore Tso wrote: It doesn't state explicitly that you can use the telldir cookie() after closing the directory stream using closedir() and then reopening it using opendir(), but given that it states that results are undefined after a rewinddir() --- which is much less violent than a

Re: If not readdir() then what?

2007-04-08 Thread Ulrich Drepper
On 4/8/07, H. Peter Anvin [EMAIL PROTECTED] wrote: More fundamentally, the telldir cookie should never be valid when applied to a different DIR * (even one that refers to the same directory.) Don't worry about this. This is clearly the semantics which was always wanted. I've filed a defect

Re: If not readdir() then what?

2007-04-08 Thread J. Bruce Fields
On Sat, Apr 07, 2007 at 04:36:33PM -0400, Theodore Tso wrote: 1) Deprecate telldir/seekdir() altogether. Relatively few progams use this functionality, and it is highly questionable how useful it is, anyway. If you use telldir/seekdir and keep the cookie for a long time, even the

Re: If not readdir() then what?

2007-04-08 Thread Theodore Tso
On Sun, Apr 08, 2007 at 12:28:32PM -0700, H. Peter Anvin wrote: Theodore Tso wrote: It doesn't state explicitly that you can use the telldir cookie() after closing the directory stream using closedir() and then reopening it using opendir(), but given that it states that results are undefined

Re: If not readdir() then what?

2007-04-07 Thread Jan Engelhardt
On Apr 7 2007 16:36, Theodore Tso wrote: > >So how do we solve this problem? I can think of two solutions: > >1) Deprecate telldir/seekdir() altogether. Relatively few progams use >this functionality, and it is highly questionable how useful it is, >anyway. If you use telldir/seekdir and keep

Re: If not readdir() then what?

2007-04-07 Thread Christoph Hellwig
On Sat, Apr 07, 2007 at 04:36:33PM -0400, Theodore Tso wrote: > this functionality, and it is highly questionable how useful it is, > anyway. If you use telldir/seekdir and keep the cookie for a long > time, even the POSIX-provided guarantees about files that are created > and deleted between the

Re: If not readdir() then what?

2007-04-07 Thread Theodore Tso
On Sat, Apr 07, 2007 at 09:57:32AM -0700, Ulrich Drepper wrote: > In their closed chambers (well, workshops, > http://lwn.net/Articles/226351/), the filesystem developers complain > about readdir. I fully appreciate the difficulties. But what I fail > to see so far is any proposal for an

If not readdir() then what?

2007-04-07 Thread Ulrich Drepper
In their closed chambers (well, workshops, http://lwn.net/Articles/226351/), the filesystem developers complain about readdir. I fully appreciate the difficulties. But what I fail to see so far is any proposal for an alternative interface. The phase to get new functionality included in the

If not readdir() then what?

2007-04-07 Thread Ulrich Drepper
In their closed chambers (well, workshops, http://lwn.net/Articles/226351/), the filesystem developers complain about readdir. I fully appreciate the difficulties. But what I fail to see so far is any proposal for an alternative interface. The phase to get new functionality included in the

Re: If not readdir() then what?

2007-04-07 Thread Theodore Tso
On Sat, Apr 07, 2007 at 09:57:32AM -0700, Ulrich Drepper wrote: In their closed chambers (well, workshops, http://lwn.net/Articles/226351/), the filesystem developers complain about readdir. I fully appreciate the difficulties. But what I fail to see so far is any proposal for an alternative

Re: If not readdir() then what?

2007-04-07 Thread Christoph Hellwig
On Sat, Apr 07, 2007 at 04:36:33PM -0400, Theodore Tso wrote: this functionality, and it is highly questionable how useful it is, anyway. If you use telldir/seekdir and keep the cookie for a long time, even the POSIX-provided guarantees about files that are created and deleted between the

Re: If not readdir() then what?

2007-04-07 Thread Jan Engelhardt
On Apr 7 2007 16:36, Theodore Tso wrote: So how do we solve this problem? I can think of two solutions: 1) Deprecate telldir/seekdir() altogether. Relatively few progams use this functionality, and it is highly questionable how useful it is, anyway. If you use telldir/seekdir and keep the

<    1   2