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: <20181017151134.GA8966@andrea>
Date:   Wed, 17 Oct 2018 17:11:34 +0200
From:   Andrea Parri <andrea.parri@...rulasolutions.com>
To:     David Howells <dhowells@...hat.com>
Cc:     gregkh@...ux-foundation.org,
        Kiran Kumar Modukuri <kiran.modukuri@...il.com>,
        viro@...iv.linux.org.uk, sandeen@...hat.com,
        linux-cachefs@...hat.com, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/4] fscache: Fix race in fscache_op_complete() due to
 split atomic_sub & read

Hi David,

On Wed, Oct 17, 2018 at 03:23:38PM +0100, David Howells wrote:
> From: kiran.modukuri <kiran.modukuri@...il.com>
> 
> The code in fscache_retrieval_complete is using atomic_sub followed by an
> atomic_read:
> 
>         atomic_sub(n_pages, &op->n_pages);
>         if (atomic_read(&op->n_pages) <= 0)
>                 fscache_op_complete(&op->op, true);
> 
> This causes two threads doing a decrement of n_pages to race with each
> other seeing the op->refcount 0 at same time - and they end up calling
> fscache_op_complete() in both the threads leading to an assertion failure.
> 
> Fix this by using atomic_sub_return() instead of two calls.

Seems a case for atomic_sub_return_relaxed()... why not?

  Andrea

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ