Re: [ANNOUNCE] kmemcheck v7

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andi Kleen <andi@...>
Cc: Vegard Nossum <vegard.nossum@...>, Bart Van Assche <bart.vanassche@...>, John Reiser <jreiser@...>, Pekka Enberg <penberg@...>, Linux Kernel Mailing List <linux-kernel@...>, Ingo Molnar <mingo@...>, Peter Zijlstra <a.p.zijlstra@...>, Paul E. McKenney <paulmck@...>, Christoph Lameter <clameter@...>, Daniel Walker <dwalker@...>, Randy Dunlap <randy.dunlap@...>, Josh Aune <luken@...>, Pekka Paalanen <pq@...>
Date: Saturday, May 10, 2008 - 4:45 pm

Andi Kleen wrote:

Yeah, as soon as the stack pointer changes, everything below it is 
invalidated (except if the stack-pointer change was actually determined 
to be a stack switch).


No, it won't.  If the stack pointer goes up then down between f1 and f2, 
then f2 will get fresh values.

The big thing Valgrind hasn't traditionally helped with is overruns of 
on-stack arrays.  You may be thinking of that.


No, its not all that expensive compared the overall cost of valgrind and 
the amount of diagnostic power it provides.  Determining stack 
boundaries has always been a bit fraught.  Typically a stack switch has 
been determined heuristically by looking for a "large" change in stack 
pointer, but there's a callback to specifically mark a range of memory 
as a stack, so that movements into and out of a stack can be determined 
as a switch (added specifically to deal with small densely packed stacks 
in uml).


Hm, I'd expect it to.  Oh, your test program doesn't use the value.  
Valgrind doesn't complain about uninitialized values unless they 
actually affect execution (ie, a conditional depends on one, you use it 
as an address for a dereference, or pass it to a syscall).

The attached version emits errors as I'd expect:

$ valgrind t10
==30474== Memcheck, a memory error detector.
==30474== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==30474== Using LibVEX rev 1804, a library for dynamic binary translation.
==30474== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==30474== Using valgrind-3.3.0, a dynamic binary instrumentation framework.
==30474== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==30474== For more details, rerun with: -v
==30474== 
f1 set y to 1
==30474== Conditional jump or move depends on uninitialised value(s)
==30474==    at 0x8048420: test (t10.c:22)
==30474==    by 0x8048451: main (t10.c:29)
==30474== 
==30474== Use of uninitialised value of size 4
==30474==    at 0xB5C5B6: _itoa_word (in /lib/libc-2.8.so)
==30474==    by 0xB5FF90: vfprintf (in /lib/libc-2.8.so)
==30474==    by 0xB6769F: printf (in /lib/libc-2.8.so)
==30474==    by 0x8048436: test (t10.c:23)
==30474==    by 0x8048451: main (t10.c:29)
==30474== 
==30474== Conditional jump or move depends on uninitialised value(s)
==30474==    at 0xB5C5BE: _itoa_word (in /lib/libc-2.8.so)
==30474==    by 0xB5FF90: vfprintf (in /lib/libc-2.8.so)
==30474==    by 0xB6769F: printf (in /lib/libc-2.8.so)
==30474==    by 0x8048436: test (t10.c:23)
==30474==    by 0x8048451: main (t10.c:29)
==30474== 
==30474== Conditional jump or move depends on uninitialised value(s)
==30474==    at 0xB5EADE: vfprintf (in /lib/libc-2.8.so)
==30474==    by 0xB6769F: printf (in /lib/libc-2.8.so)
==30474==    by 0x8048436: test (t10.c:23)
==30474==    by 0x8048451: main (t10.c:29)
==30474== 
==30474== Conditional jump or move depends on uninitialised value(s)
==30474==    at 0xB60828: vfprintf (in /lib/libc-2.8.so)
==30474==    by 0xB6769F: printf (in /lib/libc-2.8.so)
==30474==    by 0x8048436: test (t10.c:23)
==30474==    by 0x8048451: main (t10.c:29)
==30474== 
==30474== Conditional jump or move depends on uninitialised value(s)
==30474==    at 0xB5EB88: vfprintf (in /lib/libc-2.8.so)
==30474==    by 0xB6769F: printf (in /lib/libc-2.8.so)
==30474==    by 0x8048436: test (t10.c:23)
==30474==    by 0x8048451: main (t10.c:29)
f2 set y to 13123572
==30474== 
==30474== ERROR SUMMARY: 20 errors from 6 contexts (suppressed: 13 from 1)
==30474== malloc/free: in use at exit: 0 bytes in 0 blocks.
==30474== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==30474== For counts of detected errors, rerun with: -v
==30474== All heap blocks were freed -- no leaks are possible.



    J
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[ANNOUNCE] kmemcheck v7, Vegard Nossum, (Fri Apr 4, 9:44 am)
Re: [ANNOUNCE] kmemcheck v7, Bart Van Assche, (Sat May 10, 5:07 am)
Re: [ANNOUNCE] kmemcheck v7, Pekka Enberg, (Sat May 10, 5:06 am)
Re: [ANNOUNCE] kmemcheck v7, Bart Van Assche, (Sat May 10, 7:04 am)
Re: [ANNOUNCE] kmemcheck v7, Vegard Nossum, (Sat May 10, 8:02 am)
Re: [ANNOUNCE] kmemcheck v7, John Reiser, (Sun May 11, 8:08 am)
Re: [ANNOUNCE] kmemcheck v7, Jeremy Fitzhardinge, (Sat May 10, 1:17 pm)
Re: [ANNOUNCE] kmemcheck v7, Jeff Dike, (Sat May 10, 4:35 pm)
Re: [ANNOUNCE] kmemcheck v7, John Reiser, (Sun May 11, 7:23 am)
Re: [ANNOUNCE] kmemcheck v7, Bart Van Assche, (Sat May 10, 9:29 am)
Re: [ANNOUNCE] kmemcheck v7, Andi Kleen, (Sat May 10, 8:37 am)
Re: [ANNOUNCE] kmemcheck v7, Jeremy Fitzhardinge, (Sat May 10, 1:17 pm)
Re: [ANNOUNCE] kmemcheck v7, Andi Kleen, (Sat May 10, 1:48 pm)
Re: [ANNOUNCE] kmemcheck v7, Jeremy Fitzhardinge, (Sat May 10, 4:45 pm)
Re: [ANNOUNCE] kmemcheck v7, John Reiser, (Sat May 10, 5:29 pm)
Re: [ANNOUNCE] kmemcheck v7, Jeremy Fitzhardinge, (Sat May 10, 7:05 pm)
Re: [ANNOUNCE] kmemcheck v7, Andi Kleen, (Sat May 10, 5:31 pm)
Re: [ANNOUNCE] kmemcheck v7, Jeremy Fitzhardinge, (Sat May 10, 6:59 pm)
Re: [ANNOUNCE] kmemcheck v7, Bart Van Assche, (Sat May 10, 9:22 am)
[PATCH 3/3] slub: add hooks for kmemcheck, Vegard Nossum, (Fri Apr 4, 9:47 am)
[PATCH 2/3] x86: add hooks for kmemcheck, Vegard Nossum, (Fri Apr 4, 9:46 am)
[PATCH 1/3] kmemcheck: add the kmemcheck core, Vegard Nossum, (Fri Apr 4, 9:45 am)