public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Vegard Nossum <vegard.nossum@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: WARNING: kmemcheck: Caught 32-bit read from uninitialized memory  (f6f6e1a4), by kmemleak's scan_block()
Date: Tue, 25 Aug 2009 10:40:52 +0200	[thread overview]
Message-ID: <20090825084052.GE17692@elte.hu> (raw)
In-Reply-To: <1251189105.7261.4.camel@penberg-laptop>


* Pekka Enberg <penberg@cs.helsinki.fi> wrote:

> On Tue, 2009-08-25 at 09:27 +0100, Catalin Marinas wrote:
> > On Tue, 2009-08-25 at 11:08 +0300, Pekka Enberg wrote:
> > > On Tue, 2009-08-25 at 10:04 +0200, Vegard Nossum wrote:
> > > > 2009/8/25 Ingo Molnar <mingo@elte.hu>:
> > > > > FYI, -tip testing triggered the following kmemcheck warning in
> > > > > kmemleak:
> > > > >
> > > > > PM: Adding info for No Bus:vcsa7
> > > > > WARNING: kmemcheck: Caught 32-bit read from uninitialized memory (f6f6e1a4)
> > > > > d873f9f600000000c42ae4c1005c87f70000000070665f666978656400000000
> > > > >  i i i i u u u u i i i i i i i i i i i i i i i i i i i i i u u u
> > [...]
> > > > Already the patch to make kmemcheck and kmemleak mutually exclusive is
> > > > underway. It is not surprising that kmemleak is scanning uninitialized
> > > > memory. But if you say that you have tried it before, it is strange
> > > > that it didn't appear until now.
> > > 
> > > Why isn't it surprising? Yes, it's non-fatal for kmemleak to scan
> > > uninitialized memory but we could be looking at non-initialized struct
> > > member that's a bug waiting to happen elsewhere in the code (that
> > > doesn't trigger often).
> > 
> > It isn't surprising to me either. Kmemleak scans the memory periodically
> > but it cannot know whether such memory was initialised or not to avoid
> > scanning it. So I would expect such warnings if both kmemleak and
> > kmemcheck are enabled. Scanning uninitialised memory is fine with
> > kmemleak, it just increases the number of false negatives (with
> > SLAB_DEBUG enabled, however, the allocated blocks are pre-initialised).
> > 
> > So kmemleak and kmemcheck should be exclusive, unless there is a way for
> > kmemleak to validate an address with kmemcheck before deciding whether
> > to scan a memory block.
> 
> It's possible. Look at the kmemcheck_shadow_lookup() and 
> kmemcheck_shadow_test() calls in kmemcheck_read_strict(), for 
> example.
> 
> Vegard, what do you think? I think making kmemcheck and kmemleak 
> play nice with each other is useful for people like Ingo who do 
> automated testing.

There's already a couple of exclusion rules in kmemcheck:

menuconfig KMEMCHECK
        bool "kmemcheck: trap use of uninitialized memory"
        depends on DEBUG_KERNEL
        depends on !X86_USE_3DNOW
        depends on SLUB || SLAB
        depends on !CC_OPTIMIZE_FOR_SIZE
        depends on !FUNCTION_TRACER

such type of Kconfig driven exclusion is usually a somewhat lame way 
to express limitations in the software.

CC_OPTIMIZE_FOR_SIZE is an externality that cannot be eliminated, 
but the others could be improved - and we should definitely not 
extend the list of exclusions.

	Ingo

  reply	other threads:[~2009-08-25  8:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-25  7:19 WARNING: kmemcheck: Caught 32-bit read from uninitialized memory (f6f6e1a4), by kmemleak's scan_block() Ingo Molnar
2009-08-25  8:04 ` Vegard Nossum
2009-08-25  8:08   ` Pekka Enberg
2009-08-25  8:27     ` Catalin Marinas
2009-08-25  8:31       ` Pekka Enberg
2009-08-25  8:40         ` Ingo Molnar [this message]
2009-08-25  8:48           ` Pekka Enberg
2009-08-25  8:32   ` Ingo Molnar
2009-08-25  8:45     ` Pekka Enberg
2009-08-25  8:48       ` Ingo Molnar
2009-08-25  8:54         ` Pekka Enberg
2009-08-25  9:03           ` Vegard Nossum
2009-08-25  9:11             ` Catalin Marinas
2009-08-25  9:15               ` Pekka Enberg
2009-08-25  9:25                 ` Catalin Marinas
2009-08-25  9:11             ` Pekka Enberg
2009-08-25  9:21               ` Catalin Marinas
2009-08-25  9:26                 ` Pekka Enberg
2009-08-25  9:28                   ` Catalin Marinas
2009-08-25  9:31                     ` Pekka Enberg
2009-08-25  9:34                       ` Catalin Marinas
2009-08-25  9:34                       ` Ingo Molnar
2009-08-25 10:43                         ` Ingo Molnar
2009-08-25 13:57                           ` Catalin Marinas
2009-08-26 10:48                         ` Pekka Enberg
2009-08-26 11:17                           ` Ingo Molnar
2009-08-25  9:25               ` Ingo Molnar

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=20090825084052.GE17692@elte.hu \
    --to=mingo@elte.hu \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=vegard.nossum@gmail.com \
    /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