From: Catalin Marinas <catalin.marinas@arm.com>
To: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
Ingo Molnar <mingo@elte.hu>,
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:11:18 +0100 [thread overview]
Message-ID: <1251191478.15678.14.camel@pc1117.cambridge.arm.com> (raw)
In-Reply-To: <19f34abd0908250203h52257f52v306545a3d8890577@mail.gmail.com>
On Tue, 2009-08-25 at 11:03 +0200, Vegard Nossum wrote:
> 2009/8/25 Pekka Enberg <penberg@cs.helsinki.fi>:
> > diff --git a/arch/x86/mm/kmemcheck/kmemcheck.c b/arch/x86/mm/kmemcheck/kmemcheck.c
> > index 2c55ed0..528bf95 100644
> > --- a/arch/x86/mm/kmemcheck/kmemcheck.c
> > +++ b/arch/x86/mm/kmemcheck/kmemcheck.c
> > @@ -331,6 +331,20 @@ static void kmemcheck_read_strict(struct pt_regs *regs,
> > kmemcheck_shadow_set(shadow, size);
> > }
> >
> > +bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size)
> > +{
> > + enum kmemcheck_shadow status;
> > + void *shadow;
> > +
> > + shadow = kmemcheck_shadow_lookup(addr);
> > + if (!shadow)
> > + return true;
> > +
> > + status = kmemcheck_shadow_test(shadow, size);
> > +
> > + return status == KMEMCHECK_SHADOW_INITIALIZED;
> > +}
[...]
> I don't know so much about the kmemleak internals, but this I can say
> about the kmemcheck part: According to your definition, an object is
> initialized if all the bytes of an object are initialized.
>
> Is it possible that because of this, if we have a partially
> uninitialized object, kmemleak will not record the pointers found in
> that object? If so, it might skip valid pointers, and deem an object
> unreferenced. Which could make kmemleak give false-positives.
Yes, that's possible.
Does kmemcheck work on a page-range basis. If an object doesn't cross
page boundaries, would it be considered fully initialised after writing
a single location?
> I think it would be better to ask kmemcheck on a per-pointer basis
> (i.e. for each pointer-sized word in the object), whether it is
> initialized or not.
This should work but how expensive is this check?
--
Catalin
next prev parent reply other threads:[~2009-08-25 9:11 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-25 7:19 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
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 [this message]
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=1251191478.15678.14.camel@pc1117.cambridge.arm.com \
--to=catalin.marinas@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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
all inboxes | Powered by JetHome®