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-next>] [day] [month] [year] [list]
Message-ID: <20150516043147.GR7232@ZenIV.linux.org.uk>
Date:	Sat, 16 May 2015 05:31:47 +0100
From:	Al Viro <viro@...IV.linux.org.uk>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Dave Chinner <david@...morbit.com>,
	Andreas Dilger <adilger@...ger.ca>, NeilBrown <neilb@...e.de>,
	Christoph Hellwig <hch@...radead.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	linux-fsdevel <linux-fsdevel@...r.kernel.org>
Subject: Re: [RFC][PATCHSET v3] non-recursive pathname resolution & RCU
 symlinks

On Fri, May 15, 2015 at 08:37:20PM -0700, Linus Torvalds wrote:
> On May 15, 2015 8:17 PM, "Al Viro" <viro@...iv.linux.org.uk> wrote:
> >
> >         What for?  All we need is a flag, waitqueue and being woken
> > up when the flag gets cleared.
> 
> You need to have the flag somewhere.
> 
> The child dentry doesn't exist yet.
> 
> That's the point of the hashed entry. It approximates the not-yet-existing
> child dentry that we have *not* added to the parent until after lookup.

Point, but...  A lot of our problems comes from the fact that ->i_mutex
doubles as protection against the addition to the list of children, on
top of protection of directory itself.  What if we do the following:
have the normal case of __lookup_hash() (and other callers of lookup_real())
	* allocate dentry, marked "in-lookup"
	* do dcache lookup, likely to come up empty, _without_ touching
potential matches' d_lock, i.e. based on __d_lookup_rcu() (under
rcu_read_lock(), with rename_lock loop around it).  Hold parent's ->d_lock
while walking the chain, grab refcount in the unlikely case the match had
been found.  If nothing's found *and* rename_lock hadn't been touched, insert
the new dentry into hash and list of children before dropping ->d_lock.
	* call ->lookup() (still under ->i_mutex, shared)
	* clear "in-lookup" bit on _original_ dentry (we might very well
have returned a different one)
	* kick the wait queue of parent's ->i_mutex

I'll need to think about that after I get some sleep, but it smells like
that could be feasible.  Of course, that assumes we'll be able to cope
with hashed-but-currently-in-lookup dentries, but I think it might be
doable with some massage...
--
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