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]
Date:   Wed, 13 Dec 2017 15:46:54 +0100
From:   Jesper Dangaard Brouer <brouer@...hat.com>
To:     Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc:     linux-rt-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        tglx@...utronix.de, Peter Zijlstra <peterz@...radead.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Vladimir Davydov <vdavydov@...tuozzo.com>, linux-mm@...ck.org,
        brouer@...hat.com, Rao Shoaib <rao.shoaib@...cle.com>,
        "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Subject: Re: [PATCH RT] mm/slub: close possible memory-leak in
 kmem_cache_alloc_bulk()

On Wed, 13 Dec 2017 15:05:55 +0100
Sebastian Andrzej Siewior <bigeasy@...utronix.de> wrote:

> Under certain circumstances we could leak elements which were moved to
> the local "to_free" list. The damage is limited since I can't find any
> users here.
> 
> Cc: stable-rt@...r.kernel.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> ---
> Jesper: There are no users of kmem_cache_alloc_bulk() and kfree_bulk().
> Only kmem_cache_free_bulk() is used since it was introduced. Do you
> think that it would make sense to remove those?

I would like to keep them.

Rao Shoaib (Cc'ed) is/was working on a patchset for RCU-bulk-free that
used the kfree_bulk() API.

I plan to use kmem_cache_alloc_bulk() in the bpf-map "cpumap", for bulk
allocating SKBs during dequeue of XDP frames.  (My original bulk alloc
SKBs use-case during NAPI/softirq was never merged).


>  mm/slub.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index ffd2fa0f415e..9053e929ce9d 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3240,6 +3240,7 @@ int kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size,
>  	return i;
>  error:
>  	local_irq_enable();
> +	free_delayed(&to_free);
>  	slab_post_alloc_hook(s, flags, i, p);
>  	__kmem_cache_free_bulk(s, i, p);
>  	return 0;

I've not seen free_delayed() before... and my cscope cannot find it...

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ