Bug 136989

Summary: false positives for Invalid reads
Product: [Developer tools] valgrind Reporter: neal <nnorwitz>
Component: memcheckAssignee: Julian Seward <jseward>
Status: RESOLVED NOT A BUG    
Severity: normal    
Priority: NOR    
Version: 3.2.1   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: V output on amd64
V output on x86

Description neal 2006-11-07 07:58:36 UTC
Let me start by saying, I'm not really sure V is at fault.  I'm running V on
Python 2.5 (version doesn't seem to matter, it probably affects all versions 2.3
and later).

Python has a somewhat usual memory allocator so there are a bunch of
reads/conditionals on uninitialized memory.  This is not an issue.  You can read
more about it here: 
http://svn.python.org/projects/python/trunk/Misc/README.valgrind

There *shouldn't* be any invalid reads though.  I looked through the open bugs
and didn't see anything that looked similar.  I've run V 3.2.1 on gentoo on both
x86 and amd64, both compiled from source.

The strange thing is that all the addresses which are reported invalid end with
the same value 0x4...010 on x86 and 0x5...020 on amd64.  I will attach the full
output of V for both platforms.  The options probably don't matter, but:

neal@python r25 $ echo $VALGRIND_OPTS 
--tool=memcheck --error-limit=no --trace-children=yes --leak-resolution=med
--leak-check=yes --num-callers=15
~/local/bin/valgrind -q --leak-check=no ./python -c pass

I don't know how to make a small test case, but I can try to debug this if you
can provide some guidance.  I'd be happy to build V from src if you think this
problem might have been fixed.
Comment 1 neal 2006-11-07 08:01:11 UTC
Created attachment 18452 [details]
V output on amd64
Comment 2 neal 2006-11-07 08:01:37 UTC
Created attachment 18453 [details]
V output on x86
Comment 3 Tom Hughes 2006-11-07 09:46:49 UTC
I can't see any problem here, and certainly not any one in valgrind.

It seems to me that the document you referred to explains exactly what is happening here and why it is not a problem. It also clearly explains how to build python to avoid the problem.

There is nothing in that document to say that you should only get "conditional depends on" errors - indeed the example it quotes is not such an error.

In any case you should probably talk to the python developers first - it is far more likely that you have found a problem in python than one in valgrind...