From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: jblunck@suse.de
Cc: Miklos Szeredi <miklos@szeredi.hu>,
viro@ftp.linux.org.uk, linux-kernel@vger.kernel.org
Subject: Re: [RFC,PATCH] libfs dcache_readdir() and dcache_dir_lseek() bugfix
Date: Fri, 4 Nov 2005 16:45:11 +0100 [thread overview]
Message-ID: <20051104154511.GC31827@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <20051104153420.GA23962@hasse.suse.de>
On Fri, 4 November 2005 16:34:20 +0100, jblunck@suse.de wrote:
> On Fri, Nov 04, Jörn Engel wrote:
> > On Fri, 4 November 2005 16:11:04 +0100, jblunck@suse.de wrote:
> > >
> > > True. Seeking to that offset should at least fail and shouldn't stop at the
> > > new entry. But SuSV3 says that the offset given by telldir() is valid until
> > > the next rewinddir(). This is no problem for directories that can only grow.
> > > I tried to implement some kind of deferred dput'ing of the d_child's but that
> > > was too hackish and was wasting memory. So the best thing I can do now is fail
> > > if someone wants to seek to an offset of an already unlinked file.
> >
> > Does that mean that, to satisfy the standard, you'd have to allow the
> > seek, but return 0 bytes on further reads, as you're already at (or
> > beyond, whatever) EOF?
>
> No. To satisfy the standard, it would be necessary to let the seek succeed and
> to return the already unlinked dentry or the next dentry (this is
> unspecified).
Do you have a link to the standard? Iirc, it is explicitly
unspecified whether files created/deleted after opendir/rewinddir are
returned. Why do you want to return one such unspecified file now?
Especially when the implementation is ugly and the whole concept
appears to be plain stupid.
> I think we should return the next dentry, therefore I let the
> seek fail (seekdir() doesn't even have a return value) and the cursor/f_pos is
> still at the old offset.
>
> The real problem is this IMHO:
> ...
> telldir() = a
> ...
> telldir() = b
> readdir() = foo.txt
> unlink(foo.txt)
> seekdir(a)
> seekdir(b)
> readdir() = ???
>
> With my patch the seekdir(b) doesn't find the offset and is placing the cursor
> at the end of the directory. In my understanding of the SuSV3 this should be
> possible and should return either "foo.txt" or the next entry after
> "foo.txt". I don't see any chance how I can implement that.
Does the above really happen, or is this just a theoretical case? At
least it looks as if ext3 with dir_index will simply barf on it:
/* Some one has messed with f_pos; reset the world */
if (info->last_pos != filp->f_pos) {
...
And imo, that is the correct behaviour. Anything else would leave the
door wide open for trivial DOS attacks on kernel memory.
Jörn
--
The strong give up and move away, while the weak give up and stay.
-- unknown
next prev parent reply other threads:[~2005-11-04 15:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-04 11:38 jblunck
2005-11-04 11:51 ` Al Viro
2005-11-04 12:20 ` jblunck
2005-11-04 12:56 ` Miklos Szeredi
2005-11-04 13:18 ` jblunck
2005-11-04 13:31 ` Miklos Szeredi
2005-11-04 15:11 ` jblunck
2005-11-04 15:16 ` Jörn Engel
2005-11-04 15:34 ` jblunck
2005-11-04 15:45 ` Jörn Engel [this message]
2005-11-04 15:38 ` Miklos Szeredi
2005-11-04 15:32 ` Miklos Szeredi
2005-11-04 15:46 ` jblunck
2005-11-04 15:55 ` Miklos Szeredi
2005-11-04 16:04 ` jblunck
2005-11-04 16:19 ` Miklos Szeredi
2005-11-07 10:17 ` jblunck
2005-11-04 16:27 ` Al Viro
2005-11-04 16:27 ` Trond Myklebust
2005-11-04 16:39 ` Miklos Szeredi
2005-11-04 16:55 ` Rob Landley
2005-11-07 10:06 ` jblunck
2005-11-04 12:52 ` Jörn Engel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051104154511.GC31827@wohnheim.fh-wedel.de \
--to=joern@wohnheim.fh-wedel.de \
--cc=jblunck@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=viro@ftp.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®