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]
Date:	Tue, 12 Aug 2008 18:51:42 -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 Wed, 13 Aug 2008, Al Viro wrote:
> 
> What _can_ a common helper do, anyway, when we are busy parsing an arseload of
> possibly corrupt data in whatever weird format fs insists upon?

Well, the parsing has to be done by the low-level filesystem code, yes.

However, the whole thing with races with "f_pos" and all the locking - 
that's only because we see the filesystem "readdir" code as being the 
primary source of data.

Quite frankly, if we had a "readdir page cache", the low-level filesystem 
would still have to parse the insane low-level data with corruption 
issues, but we could make it totally independent of f_pos (because we 
would never use in the _real_ file->f_pos - we would just populate the 
cache), and the locking issues would be only a cold-cache issue, with the 
hot-cache hopefully needing little locking at all.

For an exmple of that: you did a good job with all the "seq_file" helpers, 
which meant that the low-level "filesystem" ops didn't need to know 
_anything_ about partial results etc, and it automatically did the right 
thing wrt f_pos updates and lseek etc.

I'm not saying that readdir() would use the _same_ model, but I do suspect 
that a common format in between the disk format and the eventual readdir() 
output, that also could be cached, might mitigate a lot of the problems.

As to the issues with lookup() - yes, a lookup would need to get the lock 
for writing, but only for the last entry, and only if O_CREAT is set. 
There's nothing wrogn with concurrent read-only lookups, I think (apart 
from having to protect the dentries from being duplicated, of course, but 
that would be a per-dentry lock flag, not a directory lock, methinks).

I dunno.

That said, I think you are right that we could also just improve on the 
current non-caching version with soem higher-level semantics. Including 
flags like "yes, we've seen the end", so that we don't need to always call 
into the low-level filesystem one extra time to see that final zero 
return.

So yes, instead of separate "filldir_t" and "void *data" things, having a 
"struct filldir_t" with several fields in common might be worth it.

			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