public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andi Kleen <ak@suse.de>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2.6.17-rc4 1/6] Base support for kmemleak
Date: Fri, 26 May 2006 22:49:57 +0100	[thread overview]
Message-ID: <44777805.2060600@gmail.com> (raw)
In-Reply-To: <20060526174723.GD30208@elte.hu>

Hi Ingo,

Ingo Molnar wrote:
> * Catalin Marinas <catalin.marinas@gmail.com> wrote:
>>A problem I'm facing (also because I'm not familiar with the other 
>>architectures) is detecting the effective stack boundaries of the 
>>threads running or waiting in kernel mode. Scanning the whole stack 
>>(8K) hides some possible leaks (because of no longer used local 
>>variables) and not scanning the list at all can lead to false 
>>positives. I would need to investigate this a bit more.
> 
> i was thinking about this too, and i wanted to suggest a different 
> solution here: you could build a list of "temporary" objects that only 
> get registered with the memleak proper once a thread exits a system call 
> (or once a kernel thread goes back to its main loop). This means a 
> (lightweight) callback in the syscall exit (or irq exit) path. This way 
> you'd not have to scan kernel stacks at all, only .data and the objects 
> themselves.

That's an interesting approach. I'll first look at the level of false
positives without scanning the stacks at all.

> avoiding the scanning of the kernel stacks gets rid of some of the 
> biggest source of natural entropy. (they contain strings and all sorts 
> of other binary data that could accidentally match up with a kernel 
> pointer)

Indeed, there is a quite high rate of false negatives (undetected leaks)
in my tests, especially on SMP, when scanning the stacks. However, I
haven't got any false positive when not scanning them (on an embedded
platform). I think even the false positives in this case would be mainly
temporary (until a moment of relative calm, i.e. most tasks sleeping).

On SMP there can be another issue - pointers kept in registers only -
leading to false positives. Anyway, I think it's more important to have
a few (temporary) false positives rather than missing real memory leaks.

Catalin

  reply	other threads:[~2006-05-26 21:50 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
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 [this message]
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=44777805.2060600@gmail.com \
    --to=catalin.marinas@gmail.com \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox