Version: 3.1.1 (using KDE KDE 3.5.0KDE 1.2) Compiler: 3.3.6 OS: Linux Checking my application with valgrind crashes with the above assertion. The output befores the assertion is: 0:aspacem NSegment{anon, start=0xBCEC000, end=0xBCEEFFF, smode=SmFixed, dev=0, ino=0, offset=12288, fnIdx=-1, hasR=1, hasW=1, hasX=1, hasT=0, mark=0, name="(none)"} My application is a multi-threaded built with shared libraries and even generates code at runtime (in case this matters). I can provide you with any debug info as I compiled valgrind myself and I have sources for my app, but I can't send you my app. The bahavior is the same as in valgrind 3.1.0. Hope this is enough info.
The problem is that it is an anonymous segment but it has a non-zero offset. I assume this is after your program has been running for a while and not something that happens at startup before your program gets a chance to run at all? Can you trying running with --trace-syscalls=yes and provide the last few lines of that trace before the assertion - there is likely to be an mmap call or similar at that point in the trace which is what I am interested in.
I can even show you the source code of the mmap: mmap(0, mSize, PROT_EXEC | PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS,0 , mSize);
So why are you specifiying an offset for an anonymous map? I guess valgrind should probably ignore it, as the kernel presumably does, but it is entirely pointless as far as I know.
I don't know why. I haven't written the code. You know that code is changed until it works, no matter why it works :-)
Changing offset to 0 indeed cures the valgrind crash wihout other ill effects. Thanks for your analysis.
I've committed a fix to make valgrind ignore the offset in anonymous mmap calls as valgrind revision 5888.