All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@gmail.com>
To: Andi Kleen <ak@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.17-rc4 1/6] Base support for kmemleak
Date: Sun, 14 May 2006 09:19:27 +0100	[thread overview]
Message-ID: <4466E80F.4010907@gmail.com> (raw)
In-Reply-To: <p73u07t5x6f.fsf@bragg.suse.de>

Andi Kleen wrote:
> Catalin Marinas <catalin.marinas@gmail.com> writes:
>>This patch adds the base support for the kernel memory leak detector. It
>>traces the memory allocation/freeing in a way similar to the Boehm's
>>conservative garbage collector, the difference being that the orphan
>>pointers are not freed but only shown in /proc/memleak. Enabling this
>>feature would introduce an overhead to memory allocations.
> 
> Interesting approach. Did you actually find any leaks with this? 

I haven't tested it intensively (that's the first version and I mainly
used a minimal kernel on an embedded system) but it could find
explicitely created leaks. For example, it should be able to detect
leaks similar to those fixed recently by Jesper:

http://lkml.org/lkml/2006/5/13/135
http://lkml.org/lkml/2006/5/13/140
http://lkml.org/lkml/2006/5/13/145

The above bugs were found by Coverity when analysing the code. The main
difference is that kmemleak finds them at run-time and only if they
happened.

> What looks a bit dubious is how objects reuse is handled. You can't
> distingush an reused object from an old leaked pointer.

The reused objects are not reported as leaks as long as the tool finds a
pointer to their address (or alias). The memleak_alloc hook is called in
kmem_cache_alloc after the object was actually allocated by
__cache_alloc. An object cannot be reused as long as it hasn't been
previously freed via kmem_cache_free (and the corresponding hook,
memleak_free, called). Kmemleak only reports allocated objects for which
there is no way to determine their address that can later be used in a
kmem_cache_free call.

Catalin

  reply	other threads:[~2006-05-14  8:19 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-13 15:57 [RFC PATCH 2.6.17-rc4 0/6] Kernel memory leak detector Catalin Marinas
2006-05-13 16:05 ` [PATCH 2.6.17-rc4 1/6] Base support for kmemleak Catalin Marinas
2006-05-13 17:42   ` Jesper Juhl
2006-05-13 17:47     ` Roland Dreier
2006-05-14  7:24     ` Catalin Marinas
2006-05-14 17:32       ` Ingo Oeser
2006-05-15 10:15         ` Catalin Marinas
2006-05-13 18:11   ` Paul Jackson
2006-05-13 23:20   ` Andi Kleen
2006-05-14  8:19     ` Catalin Marinas [this message]
2006-05-15  9:15       ` Andi Kleen
2006-05-15 10:09         ` Catalin Marinas
2006-05-26  8:59     ` Ingo Molnar
2006-05-26  9:39       ` Andi Kleen
2006-05-26 11:31         ` Ingo Molnar
2006-05-26 16:37       ` Catalin Marinas
2006-05-26 17:47         ` Ingo Molnar
2006-05-26 21:49           ` Catalin Marinas
2006-05-26 22:01       ` Catalin Marinas
2006-05-14 14:53   ` Pekka Enberg
2006-05-14 15:30     ` Catalin Marinas
2006-05-14 15:52     ` Catalin Marinas
2006-05-13 16:05 ` [PATCH 2.6.17-rc4 2/6] Some documentation " Catalin Marinas
2006-05-13 16:06 ` [PATCH 2.6.17-rc4 3/6] Add the memory allocation/freeing hooks " Catalin Marinas
2006-05-14 14:49   ` Pekka Enberg
2006-05-13 16:06 ` [PATCH 2.6.17-rc4 4/6] Add kmemleak support for i386 Catalin Marinas
2006-05-13 18:24   ` Jesper Juhl
2006-05-13 21:20     ` Jan Engelhardt
2006-05-14  7:28       ` Catalin Marinas
2006-05-13 16:06 ` [PATCH 2.6.17-rc4 5/6] Add kmemleak support for ARM Catalin Marinas
2006-05-13 18:25   ` Jesper Juhl
2006-05-13 16:06 ` [PATCH 2.6.17-rc4 6/6] Remove some of the kmemleak false positives Catalin Marinas
2006-05-13 19:21   ` Jesper Juhl
2006-05-14  7:31     ` Catalin Marinas
2006-05-14 14:55   ` Pekka Enberg
2006-05-14 15:39     ` Catalin Marinas
2006-05-14 17:39       ` Ingo Oeser
2006-05-15 10:12         ` Catalin Marinas
2006-05-15 18:32           ` Ingo Oeser
2006-05-15 11:52   ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4466E80F.4010907@gmail.com \
    --to=catalin.marinas@gmail.com \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.