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: <YzxF5Bs/tgLDOB0T@casper.infradead.org>
Date:   Tue, 4 Oct 2022 15:40:36 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     Hyeonggon Yoo <42.hyeyoo@...il.com>
Cc:     Hugh Dickins <hughd@...gle.com>, Vlastimil Babka <vbabka@...e.cz>,
        David Laight <David.Laight@...lab.com>,
        Joel Fernandes <joel@...lfernandes.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Minchan Kim <minchan@...nel.org>, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, rcu@...r.kernel.org
Subject: Re: amusing SLUB compaction bug when CC_OPTIMIZE_FOR_SIZE

On Tue, Oct 04, 2022 at 11:26:33PM +0900, Hyeonggon Yoo wrote:
> > It's the acquisition of
> > the refcount which stabilises the slab flag, not holding the lock.
> 
> But can you please elaborate how this prevents race between
> allocation & initialization of a slab and isolate_movable_page()?
> 
> Or maybe we can handle it with frozen folio as Vlastimil suggested? ;-) 

Yes, we discussed that a little yesterday.  I'm hoping to have a
refreshed patchset for frozen folios out today.  Some of this patch
is still needed, even if we go that route.

> > @@ -91,8 +99,8 @@ int isolate_movable_page(struct page *page, isolate_mode_t mode)
> >  	 * lets be sure we have the page lock
> >  	 * before proceeding with the movable page isolation steps.
> >  	 */
> > -	if (unlikely(!trylock_page(page)))
> > -		goto out_putpage;
> > +	if (unlikely(!folio_trylock(folio)))
> > +		goto out_put;
> 
> I don't know much about callers that this is trying to avoid race aginst...
> 
> But for this to make sense, I think *every users* that doing their stuff with
> sub-page of a compound page should acquire folio lock and not page lock
> of sub-page, right?

There is no page lock per se.  If you try to acquire the lock on a tail
page, it acquires the lock on its head page.  It's been that way for a
very long time.  A lot of people are confused by this, which was part of
the motivation for making it explicit with folios.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ