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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 31 Mar 2022 11:52:50 +0800
From:   Muchun Song <songmuchun@...edance.com>
To:     NeilBrown <neilb@...e.de>
Cc:     Matthew Wilcox <willy@...radead.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Johannes Weiner <hannes@...xchg.org>,
        Michal Hocko <mhocko@...nel.org>,
        Vladimir Davydov <vdavydov.dev@...il.com>,
        Shakeel Butt <shakeelb@...gle.com>,
        Roman Gushchin <roman.gushchin@...ux.dev>,
        Yang Shi <shy828301@...il.com>, Alex Shi <alexs@...nel.org>,
        Wei Yang <richard.weiyang@...il.com>,
        Dave Chinner <david@...morbit.com>,
        trond.myklebust@...merspace.com, anna.schumaker@...app.com,
        jaegeuk@...nel.org, chao@...nel.org,
        Kari Argillander <kari.argillander@...il.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Linux Memory Management List <linux-mm@...ck.org>,
        linux-nfs@...r.kernel.org, Qi Zheng <zhengqi.arch@...edance.com>,
        Xiongchun duan <duanxiongchun@...edance.com>,
        Fam Zheng <fam.zheng@...edance.com>,
        Muchun Song <smuchun@...il.com>
Subject: Re: [PATCH v6 12/16] mm: list_lru: replace linear array with xarray

On Thu, Mar 31, 2022 at 11:26 AM NeilBrown <neilb@...e.de> wrote:
>
> On Mon, 28 Feb 2022, Muchun Song wrote:
> > If we run 10k containers in the system, the size of the
> > list_lru_memcg->lrus can be ~96KB per list_lru. When we decrease the
> > number containers, the size of the array will not be shrinked. It is
> > not scalable. The xarray is a good choice for this case. We can save
> > a lot of memory when there are tens of thousands continers in the
> > system. If we use xarray, we also can remove the logic code of
> > resizing array, which can simplify the code.
> >
> > Signed-off-by: Muchun Song <songmuchun@...edance.com>
>
> Hi,
>  I've just tried some simple testing on NFS (xfstests generic/???) and
>  it reliably crashes in this code.
>  Specifically in list_lru_add(), list_lru_from_kmem() returns NULL,
>  which results in a NULL deref.
>  list_lru_from_kmem() returns NULL because an xa_load() returns NULL.

Did you test with the patch [1].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ae085d7f9365de7da27ab5c0d16b12d51ea7fca9

>
>  The patch doesn't make any sense to me.  It replaces an array of
>  structures with an xarray, which is an array of pointers.
>  It seems to assume that all the pointers in the array get magically
>  allocated to the required structures.  I certainly cannot find when
>  the 'struct list_lru_node' structures get allocated.  So xa_load() will
>  *always* return NULL in this code.

struct list_lru_node is allocated via kmem_cache_alloc_lru().

>
>  I can provide more details of the failure stack if needed, but I doubt
>  that would be necessary.
>

If the above fix cannot fix your issue, would you mind providing
the .config and stack trace?

Thanks for your report.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ