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] [day] [month] [year] [list]
Date:   Thu, 2 Aug 2018 10:43:21 +0300
From:   Kirill Tkhai <ktkhai@...tuozzo.com>
To:     Al Viro <viro@...IV.linux.org.uk>
Cc:     "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: Commit "new primitive: discard_new_inode()" introduces a problem

On 01.08.2018 19:34, Al Viro wrote:
> On Wed, Aug 01, 2018 at 07:19:35PM +0300, Kirill Tkhai wrote:
>> On 01.08.2018 19:16, Al Viro wrote:
>>> On Wed, Aug 01, 2018 at 05:11:51PM +0100, Al Viro wrote:
>>>> On Wed, Aug 01, 2018 at 06:43:56PM +0300, Kirill Tkhai wrote:
>>>>> #git status
>>>>> HEAD detached at 22dc9a168272
>>>>
>>>> Wait a sec - just that commit?  With discard_new_inode() not even
>>>> used anywhere?  Then any of those -ENOMEM is disguised ERR_PTR(-ESTALE)
>>>> from find_inode()/find_inode_fast(), i.e. an inode found by
>>>> iget5_locked() (your /etc is on ext4) with I_CREATING still set.
>>>
>>> iget_locked(), that is.
> 
> OK, I see what's going on there.  See if this fixes the problem:
> 
> diff --git a/fs/dcache.c b/fs/dcache.c
> index 0e8e5de3c48a..b11f566bcd66 100644
> --- a/fs/dcache.c
> +++ b/fs/dcache.c
> @@ -1892,7 +1892,7 @@ void d_instantiate_new(struct dentry *entry, struct inode *inode)
>  	spin_lock(&inode->i_lock);
>  	__d_instantiate(entry, inode);
>  	WARN_ON(!(inode->i_state & I_NEW));
> -	inode->i_state &= ~I_NEW;
> +	inode->i_state &= ~I_NEW & ~I_CREATING;
>  	smp_mb();
>  	wake_up_bit(&inode->i_state, __I_NEW);
>  	spin_unlock(&inode->i_lock);

Yeah, this fixes the problem.

Tested-by: Kirill Tkhai <ktkhai@...tuozzo.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ