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:   Fri, 13 Oct 2017 16:58:55 +0200
From:   Oleg Nesterov <oleg@...hat.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Rik van Riel <riel@...riel.com>, Gargi Sharma <gs051095@...il.com>,
        linux-kernel@...r.kernel.org, julia.lawall@...6.fr,
        mingo@...nel.org, pasha.tatashin@...cle.com, ktkhai@...tuozzo.com,
        ebiederm@...ssion.com, hch@...radead.org, lkp@...el.com,
        tony.luck@...el.com
Subject: Re: [PATCH v6 1/2] pid: Replace pid bitmap implementation with IDR
 API

On 10/12, Andrew Morton wrote:
>
> On Wed, 11 Oct 2017 20:54:32 -0400 Rik van Riel <riel@...riel.com> wrote:
>
> > Documenting the locking on all the existing code, plus the
> > new code, seems a little out of scope of an Outreachy
> > internship...
>
> I'm not referring to all the existing code!  Just this new
> pid_namespace.idr's locking.  If it was protected by
> spin_lock_irq(&pidmap_lock) everywhere then an explanation wouldn't be
> needed.  But we have this oddball site where pidmap_lock isn't taken
> but it uses rcu_read_lock() which is surprising to say the least.
> Readers could be forgiven for thinking that is a bug.

Actually this all looks simple, or I missed something...

pid_namespace.idr is protected by pidmap_lock, it is always modified
with this lock held.

idr_find/idr_find_ext/etc can be called under rcu_read_lock() simply
because idr/radix_tree is rcu-safe and this is already documented in
idr.h, say, the comment above idr_find() says

 * This function can be called under rcu_read_lock(), given that the leaf
 * pointers lifetimes are correctly managed.

Oleg.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ