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: <20200326120931.GF22483@bombadil.infradead.org>
Date:   Thu, 26 Mar 2020 05:09:31 -0700
From:   Matthew Wilcox <willy@...radead.org>
To:     Michel Lespinasse <walken@...gle.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        linux-mm <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Laurent Dufour <ldufour@...ux.ibm.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Liam Howlett <Liam.Howlett@...cle.com>,
        Jerome Glisse <jglisse@...hat.com>,
        Davidlohr Bueso <dave@...olabs.net>,
        David Rientjes <rientjes@...gle.com>,
        Hugh Dickins <hughd@...gle.com>, Ying Han <yinghan@...gle.com>
Subject: Re: [PATCH 5/8] mmap locking API: convert nested write lock sites

On Thu, Mar 26, 2020 at 12:02:33AM -0700, Michel Lespinasse wrote:
> @@ -47,9 +48,9 @@ static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
>  	 * when the new ->mm is used for the first time.
>  	 */
>  	__switch_mm(&new->context.id);
> -	down_write_nested(&new->mmap_sem, 1);
> +	mmap_write_lock_nested(new, 1);
>  	uml_setup_stubs(new);
> -	mmap_write_unlock(new);
> +	mmap_write_unlock_nested(new);

This is a bit of an oddity.  We don't usually have an unlock_nested()
variant (a quick grep finds only something complicated in reiserfs).
That's because it's legitimate to release locks in a different order from
the one they were acquired in (eg lock A, lock B, unlock A, unlock B), and
it's not clear whether "nested" would follow the lock (ie unlock_nested B)
or whether it would follow the code (ie unlock_nested A).

Does your future API require knowing the nested nature at the unlock
point?  And if so, does it require it for A or B in the above scenario?
And how does it mix with lock A or B being of a different type (eg a
plain mutex or a spinlock)?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ