valgrind reporting 'Invalid read' *entirely within still-allocated block*

↘锁芯ラ 提交于 2019-12-13 16:11:50

问题


I'm seeing a truly baffling series of error reports from Valgrind's Memcheck tool:

==29456== Invalid read of size 8
==29456==    at 0x4D5C90: CkIndex_Ping1::_callthr_trecv_PingMsg(CkThrCallArg*) (in /scratch/phil/charm/net-linux-x86_64-bigsim/tests/charm++/pingpong/pgm)
==29456==    by 0x503ECB: CthStartThread (libthreads-default.c:1690)
==29456==    by 0x56A08AF: ??? (in /lib/x86_64-linux-gnu/libc-2.19.so)
==29456==  Address 0x5b09a90 is 0 bytes inside a block of size 16 alloc'd
==29456==    at 0x4C2B0E0: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==29456==    by 0x4D5C14: CkIndex_Ping1::_call_trecv_PingMsg(void*, void*) (in /scratch/phil/charm/net-linux-x86_64-bigsim/tests/charm++/pingpong/pgm)
==29456==    by 0x517D79: CkDeliverMessageFree (ck.C:593)
==29456==    by 0x5378C3: CkLocRec_local::invokeEntry(CkMigratable*, void*, int, bool) (cklocation.C:1795)
==29456==    by 0x537CA7: CkLocRec_local::deliver(CkArrayMessage*, CkDeliver_t, int) (cklocation.C:1862)
==29456==    by 0x539977: CkLocMgr::deliver(CkMessage*, CkDeliver_t, int) (cklocation.C:2834)
==29456==    by 0x51F091: CkLocMgr::deliverInline(CkMessage*) (cklocation.h:313)
==29456==    by 0x51A6EF: _processArrayEltMsg(CkCoreState*, envelope*) (ck.C:1181)
==29456==    by 0x51A8C8: _processHandler(void*, CkCoreState*) (ck.C:1266)
==29456==    by 0x4EE7EF: BgProcessMessageDefault(threadInfo*, char*) (blue.C:1339)
==29456==    by 0x5C5928: BgProcessMessageFreezeMode(threadInfo*, char*) (middle-ccs.C:165)
==29456==    by 0x4F590D: workThreadInfo::scheduler(int) (bigsim_proc.C:282)

Note that it's saying that the offending address is inside a still-allocated (i.e. not yet free()'d) block, and that the read size plus offset is well less than the size of the block.

This is on Ubuntu Linux 14.04, with Valgrind version valgrind-3.10.0.SVN (package 1:3.10~20140411-0ubuntu1), and the code was compiled with gcc/g++ 4.8.4-2ubuntu1~14.04.

I've found a similar question, to which the answer was "this is a bug on Mac OS X". Am I really looking at a Valgrind bug here, or is there something else my code might have wrong?

Edit: I also found a mailing list post covering a similar environment - user-level threads that might be screwing with Valgrind's understanding. It doesn't seem to actually answer anything though.

来源:https://stackoverflow.com/questions/30985301/valgrind-reporting-invalid-read-entirely-within-still-allocated-block

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!