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: <20200630190931.04967b5e8bdf29c33f3c8005@linux-foundation.org>
Date:   Tue, 30 Jun 2020 19:09:31 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Roman Gushchin <guro@...com>
Cc:     Barry Song <song.bao.hua@...ilicon.com>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>, <linuxarm@...wei.com>,
        Jonathan Cameron <Jonathan.Cameron@...wei.com>,
        Aslan Bakirov <aslan@...com>, Michal Hocko <mhocko@...nel.org>,
        Andreas Schaufler <andreas.schaufler@....de>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        Rik van Riel <riel@...riel.com>,
        Joonsoo Kim <js1304@...il.com>,
        Robin Murphy <robin.murphy@....com>
Subject: Re: [PATCH] mm/cma.c: use exact_nid true to fix possible per-numa
 cma leak

On Tue, 30 Jun 2020 12:08:25 -0700 Roman Gushchin <guro@...com> wrote:

> On Sun, Jun 28, 2020 at 07:43:45PM +1200, Barry Song wrote:
> > Calling cma_declare_contiguous_nid() with false exact_nid for per-numa
> > reservation can easily cause cma leak and various confusion.
> > For example, mm/hugetlb.c is trying to reserve per-numa cma for gigantic
> > pages. But it can easily leak cma and make users confused when system has
> > memoryless nodes.
> > 
> > In case the system has 4 numa nodes, and only numa node0 has memory.
> > if we set hugetlb_cma=4G in bootargs, mm/hugetlb.c will get 4 cma areas
> > for 4 different numa nodes. since exact_nid=false in current code, all
> > 4 numa nodes will get cma successfully from node0, but hugetlb_cma[1 to 3]
> > will never be available to hugepage will only allocate memory from
> > hugetlb_cma[0].
> > 
> > In case the system has 4 numa nodes, both numa node0&2 has memory, other
> > nodes have no memory.
> > if we set hugetlb_cma=4G in bootargs, mm/hugetlb.c will get 4 cma areas
> > for 4 different numa nodes. since exact_nid=false in current code, all
> > 4 numa nodes will get cma successfully from node0 or 2, but hugetlb_cma[1]
> > and [3] will never be available to hugepage as mm/hugetlb.c will only
> > allocate memory from hugetlb_cma[0] and hugetlb_cma[2].
> > This causes permanent leak of the cma areas which are supposed to be
> > used by memoryless node.
> > 
> > Of cource we can workaround the issue by letting mm/hugetlb.c scan all
> > cma areas in alloc_gigantic_page() even node_mask includes node0 only.
> > that means when node_mask includes node0 only, we can get page from
> > hugetlb_cma[1] to hugetlb_cma[3]. But this will cause kernel crash in
> > free_gigantic_page() while it wants to free page by:
> > cma_release(hugetlb_cma[page_to_nid(page)], page, 1 << order)
> > 
> > On the other hand, exact_nid=false won't consider numa distance, it
> > might be not that useful to leverage cma areas on remote nodes.
> > I feel it is much simpler to make exact_nid true to make everything
> > clear. After that, memoryless nodes won't be able to reserve per-numa
> > CMA from other nodes which have memory.
> 
> Totally agree.
> 
> Acked-by: Roman Gushchin <guro@...com>
> 

Do we feel this merits a cc:stable?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ