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: <BYAPR11MB2632BEC45DC867E80F841B82FF700@BYAPR11MB2632.namprd11.prod.outlook.com>
Date:   Wed, 29 Jul 2020 01:25:40 +0000
From:   "Zhang, Qiang" <Qiang.Zhang@...driver.com>
To:     David Rientjes <rientjes@...gle.com>
CC:     "cl@...ux.com" <cl@...ux.com>,
        "penberg@...nel.org" <penberg@...nel.org>,
        "iamjoonsoo.kim@....com" <iamjoonsoo.kim@....com>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: 回复: [PATCH] mm/slab.c: add node spinlock protect in __cache_free_alien



________________________________________
发件人: David Rientjes <rientjes@...gle.com>
发送时间: 2020年7月29日 3:46
收件人: Zhang, Qiang
抄送: cl@...ux.com; penberg@...nel.org; iamjoonsoo.kim@....com; akpm@...ux-foundation.org; linux-mm@...ck.org; linux-kernel@...r.kernel.org
主题: Re: [PATCH] mm/slab.c: add node spinlock protect in __cache_free_alien

On Tue, 28 Jul 2020, qiang.zhang@...driver.com wrote:

> From: Zhang Qiang <qiang.zhang@...driver.com>
>
> We should add node spinlock protect "n->alien" which may be
> assigned to NULL in cpuup_canceled func. cause address access
> exception.
>

>Hi, do you have an example NULL pointer dereference where you have hit
>this?

>This rather looks like something to fix up in cpuup_canceled() since it's
>currently manipulating the alien cache for the canceled cpu's node.

yes , it is fix up in cpuup_canceled  it's
currently manipulating the alien cache for the canceled cpu's node which  may be the same as the node being operated on in the __cache_free_alien func.

void cpuup_canceled
{
        n = get_node(cachep, node);
        spin_lock_irq(&n->list_lock);
        ...
        n->alien = NULL;
        spin_unlock_irq(&n->list_lock);
         ....
}

> Fixes: 18bf854117c6 ("slab: use get_node() and kmem_cache_node() functions")
> Signed-off-by: Zhang Qiang <qiang.zhang@...driver.com>
> ---
>  mm/slab.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/mm/slab.c b/mm/slab.c
> index a89633603b2d..290523c90b4e 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -759,8 +759,10 @@ static int __cache_free_alien(struct kmem_cache *cachep, void *objp,
>
>       n = get_node(cachep, node);
>       STATS_INC_NODEFREES(cachep);
> +     spin_lock(&n->list_lock);
>       if (n->alien && n->alien[page_node]) {
>               alien = n->alien[page_node];
> +             spin_unlock(&n->list_lock);
>               ac = &alien->ac;
>               spin_lock(&alien->lock);
>               if (unlikely(ac->avail == ac->limit)) {
> @@ -769,14 +771,15 @@ static int __cache_free_alien(struct kmem_cache *cachep, void *objp,
>               }
>               ac->entry[ac->avail++] = objp;
>               spin_unlock(&alien->lock);
> -             slabs_destroy(cachep, &list);
>       } else {
> +             spin_unlock(&n->list_lock);
>               n = get_node(cachep, page_node);
>               spin_lock(&n->list_lock);
>               free_block(cachep, &objp, 1, page_node, &list);
>               spin_unlock(&n->list_lock);
> -             slabs_destroy(cachep, &list);
>       }
> +
> +     slabs_destroy(cachep, &list);
>       return 1;
>  }
>
> --
> 2.26.2
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ