Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1160382

Re: [PATCH] slub/slab: fix kmemleak didn't work on some case

From Catalin Marinas <catalin.marinas@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH] slub/slab: fix kmemleak didn't work on some case
Date 2015-06-08 12:20 +0200
Message-ID <pz2jT-3X6-1@gated-at.bofh.it> (permalink)
References <pz1Hb-2Xq-11@gated-at.bofh.it> <pz1Hb-2Xq-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jun 08, 2015 at 10:38:13AM +0100, Christoph Lameter wrote:
> On Mon, 8 Jun 2015, Liu, XinwuX wrote:
> 
> > when kernel uses kmalloc to allocate memory, slub/slab will find
> > a suitable kmem_cache. Ususally the cache's object size is often
> > greater than requested size. There is unused space which contains
> > dirty data. These dirty data might have pointers pointing to a block
> 
> dirty? In what sense?

I guess XinwuX meant uninitialised.

> > of leaked memory. Kernel wouldn't consider this memory as leaked when
> > scanning kmemleak object.
> 
> This has never been considered leaked memory before to my knowledge and
> the data is already initialized.

It's not the object being allocated that is considered leaked. But
uninitialised data in this object is scanned by kmemleak and it may look
like valid pointers to real leaked objects. So such data increases the
number of kmemleak false negatives.

As I replied already, I don't think this is that bad, or at least not
worse than what kmemleak already does (looking at all data whether it's
pointer or not). It also doesn't solve the kmem_cache_alloc() case where
the original object size is no longer available.

> F.e. The zeroing function in linux/mm/slub.c::slab_alloc_node() zeros the
> complete object and not only the number of bytes specified in the kmalloc
> call. Same thing is true for SLAB.

But that's only when __GFP_ZERO is passed.

-- 
Catalin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH] slub/slab: fix kmemleak didn't work on some case Catalin Marinas <catalin.marinas@arm.com> - 2015-06-08 12:20 +0200
  Re: [PATCH] slub/slab: fix kmemleak didn't work on some case "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> - 2015-06-09 10:20 +0200

csiph-web