lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.1.10.0808121259400.3462@nehalem.linux-foundation.org>
Date:	Tue, 12 Aug 2008 13:02:59 -0700 (PDT)
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Al Viro <viro@...IV.linux.org.uk>
cc:	OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC] readdir mess



On Tue, 12 Aug 2008, Al Viro wrote:
> 
> Doesn't work well for readdir(2)...

Sure it does.

> > 	error = vfs_readdir(file, filldir, &buf);
> > 	lastdirent = buf.previous;
> > 	if (lastdirent) {
> > 		error = count - buf.count;
> > 		if (put_user(file->f_pos, &lastdirent->d_off))
> > 			error = -EFAULT;
> > 	}
> > 	fput(file);
> > 	return error;
> > 
> >    and we wouldn't need any other logic at all.
> 
> you've just lost e.g. -EIO for getdents().

No I've not.

If we returned a partial result, we _should_ return a partial result.

And if we got EIO on the first entry, we should return EIO.

The _current_ code is crap. It sometimes returns the error (if the 
->readdir() function returned error), and sometimes returns the partial 
result (if the "buf.error" was set).

> Frankly, I'd rather keep ->readdir() instances simpler.  There are far
> more of those, for one thing.  As it is, we only have "stop"/"continue"
> ->readdir() has to care about...

Keeping them simple (and not changing them - always returning zero is what 
the _original_ readdir() thing did!) is why the current situation exists.

So if we keep it that way, then we really *KEEP* it that way. Don't go 
around changing any of the existing rules. Just make sure that the 
callbacks keep on always returning negative or zero (and never positive).

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ