lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 25 Aug 2009 10:11:18 +0100
From:	Catalin Marinas <catalin.marinas@....com>
To:	Vegard Nossum <vegard.nossum@...il.com>
Cc:	Pekka Enberg <penberg@...helsinki.fi>, Ingo Molnar <mingo@...e.hu>,
	linux-kernel@...r.kernel.org
Subject: Re: WARNING: kmemcheck: Caught 32-bit read from uninitialized
	memory  (f6f6e1a4), by kmemleak's scan_block()

On Tue, 2009-08-25 at 11:03 +0200, Vegard Nossum wrote:
> 2009/8/25 Pekka Enberg <penberg@...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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ