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: <20201105120554.GJ17076@casper.infradead.org>
Date:   Thu, 5 Nov 2020 12:05:54 +0000
From:   Matthew Wilcox <willy@...radead.org>
To:     Vlastimil Babka <vbabka@...e.cz>
Cc:     linux-mm@...ck.org, netdev@...r.kernel.org,
        Dongli Zhang <dongli.zhang@...cle.com>,
        Aruna Ramakrishna <aruna.ramakrishna@...cle.com>,
        Bert Barbe <bert.barbe@...cle.com>,
        Rama Nichanamatlu <rama.nichanamatlu@...cle.com>,
        Venkat Venkatsubra <venkat.x.venkatsubra@...cle.com>,
        Manjunath Patil <manjunath.b.patil@...cle.com>,
        Joe Jin <joe.jin@...cle.com>,
        SRINIVAS <srinivas.eeda@...cle.com>, stable@...r.kernel.org,
        Jann Horn <jannh@...gle.com>
Subject: Re: [PATCH] page_frag: Recover from memory pressure

On Thu, Nov 05, 2020 at 12:56:43PM +0100, Vlastimil Babka wrote:
> > +++ b/mm/page_alloc.c
> > @@ -5139,6 +5139,10 @@ void *page_frag_alloc(struct page_frag_cache *nc,
> >   		if (!page_ref_sub_and_test(page, nc->pagecnt_bias))
> >   			goto refill;
> > +		if (nc->pfmemalloc) {
> > +			free_the_page(page, compound_order(page));
> > +			goto refill;
> 
> Theoretically the refill can fail and we return NULL while leaving nc->va
> pointing to a freed page, so I think you should set nc->va to NULL.
> 
> Geez, can't the same thing already happen after we sub the nc->pagecnt_bias
> from page ref, and last users of the page fragments then return them and dec
> the ref to zero and the page gets freed?

I don't think you read __page_frag_cache_refill() closely enough ...

        if (unlikely(!page))
                page = alloc_pages_node(NUMA_NO_NODE, gfp, 0);

        nc->va = page ? page_address(page) : NULL;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ