Bugzilla – Bug 356
tcp-nsc-lfn fails with --valgrind selected
Last modified: 2008-11-18 21:22:33 EST
./waf --run examples/tcp-nsc-lfn --valgrind produces errors.
Pasting discussion from IRC: 05:00 < sam_> NSC works fine in valgrind, if valgrind works.... 05:00 < sam_> valgrind doesn't support all the instructions NSC uses in 64-bit last I checked (with svn version of valgrind) 05:00 < sam_> (due to the linux kernel using quite a few asm statements) 05:01 < sam_> I believe it should work in 32-bit mode fine, though 05:02 < sam_> fw_ has used it in 32-bit successfully at least Due to the lack of information here it isn't clear whether this is a 32-bit or 64-bit problem.
Linux version 2.6.24-19-server (buildd@king) (gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)) #1 SMP Wed Aug 20 18:43:06 UTC 2008 Target: x86_64-linux-gnu do ./waf --run tcp-nsc-lfn --valgrind get Entering directory `/home/craigdo/repos/ns-3-dev/build' [539/539] ==30003== Memcheck, a memory error detector. ==30003== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al. ==30003== Using LibVEX rev 1804, a library for dynamic binary translation. ==30003== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP. ==30003== Using valgrind-3.3.0-Debian, a dynamic binary instrumentation framework. ==30003== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al. ==30003== For more details, rerun with: -v ==30003== ==30003== Invalid read of size 8 ==30003== at 0x4015D6E: (within /lib/ld-2.7.so) ==30003== by 0x4011F31: (within /lib/ld-2.7.so) ==30003== by 0x400DDF5: (within /lib/ld-2.7.so) ==30003== by 0x401191A: (within /lib/ld-2.7.so) ==30003== by 0x5AFEF8A: (within /lib/libdl-2.7.so) ==30003== by 0x400DDF5: (within /lib/ld-2.7.so) ==30003== by 0x5AFF4EC: (within /lib/libdl-2.7.so) ==30003== by 0x5AFEEF0: dlopen (in /lib/libdl-2.7.so) ==30003== by 0x536077B: ns3::NscTcpL4Protocol::SetNscLibrary(std::string const&) (nsc-tcp-l4-protocol.cc:102) ==30003== by 0x52CF198: ns3::AddNscStack(ns3::Ptr<ns3::Node>, std::string const&) (internet-stack.cc:98) ==30003== by 0x52D32EB: ns3::AddNscInternetStack(ns3::Ptr<ns3::Node>, std::string const&) (internet-stack.cc:114) ==30003== by 0x54B5957: ns3::InternetStackHelper::Install(ns3::NodeContainer) (internet-stack-helper.cc:74) ==30003== Address 0xb7db258 is 40 bytes inside a block of size 42 alloc'd ==30003== at 0x4C23809: operator new(unsigned long) (vg_replace_malloc.c:230) ==30003== by 0x7A112E0: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x7A120F4: (within /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x7A12271: std::string::string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x407712: main (tcp-nsc-lfn.cc:62) ==30003== ==30003== Invalid read of size 8 ==30003== at 0x4015D6E: (within /lib/ld-2.7.so) ==30003== by 0x40085B1: (within /lib/ld-2.7.so) ==30003== by 0x4012048: (within /lib/ld-2.7.so) ==30003== by 0x400DDF5: (within /lib/ld-2.7.so) ==30003== by 0x401191A: (within /lib/ld-2.7.so) ==30003== by 0x5AFEF8A: (within /lib/libdl-2.7.so) ==30003== by 0x400DDF5: (within /lib/ld-2.7.so) ==30003== by 0x5AFF4EC: (within /lib/libdl-2.7.so) ==30003== by 0x5AFEEF0: dlopen (in /lib/libdl-2.7.so) ==30003== by 0x536077B: ns3::NscTcpL4Protocol::SetNscLibrary(std::string const&) (nsc-tcp-l4-protocol.cc:102) ==30003== by 0x52CF198: ns3::AddNscStack(ns3::Ptr<ns3::Node>, std::string const&) (internet-stack.cc:98) ==30003== by 0x52D32EB: ns3::AddNscInternetStack(ns3::Ptr<ns3::Node>, std::string const&) (internet-stack.cc:114) ==30003== Address 0xb7db258 is 40 bytes inside a block of size 42 alloc'd ==30003== at 0x4C23809: operator new(unsigned long) (vg_replace_malloc.c:230) ==30003== by 0x7A112E0: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x7A120F4: (within /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x7A12271: std::string::string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x407712: main (tcp-nsc-lfn.cc:62) ==30003== ==30003== Invalid read of size 8 ==30003== at 0x4015EE4: (within /lib/ld-2.7.so) ==30003== by 0x40087D1: (within /lib/ld-2.7.so) ==30003== by 0x4012048: (within /lib/ld-2.7.so) ==30003== by 0x400DDF5: (within /lib/ld-2.7.so) ==30003== by 0x401191A: (within /lib/ld-2.7.so) ==30003== by 0x5AFEF8A: (within /lib/libdl-2.7.so) ==30003== by 0x400DDF5: (within /lib/ld-2.7.so) ==30003== by 0x5AFF4EC: (within /lib/libdl-2.7.so) ==30003== by 0x5AFEEF0: dlopen (in /lib/libdl-2.7.so) ==30003== by 0x536077B: ns3::NscTcpL4Protocol::SetNscLibrary(std::string const&) (nsc-tcp-l4-protocol.cc:102) ==30003== by 0x52CF198: ns3::AddNscStack(ns3::Ptr<ns3::Node>, std::string const&) (internet-stack.cc:98) ==30003== by 0x52D32EB: ns3::AddNscInternetStack(ns3::Ptr<ns3::Node>, std::string const&) (internet-stack.cc:114) ==30003== Address 0xb7db258 is 40 bytes inside a block of size 42 alloc'd ==30003== at 0x4C23809: operator new(unsigned long) (vg_replace_malloc.c:230) ==30003== by 0x7A112E0: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x7A120F4: (within /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x7A12271: std::string::string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x407712: main (tcp-nsc-lfn.cc:62) ==30003== ==30003== Invalid read of size 8 ==30003== at 0x4015EE4: (within /lib/ld-2.7.so) ==30003== by 0x400A99D: (within /lib/ld-2.7.so) ==30003== by 0x40061E4: (within /lib/ld-2.7.so) ==30003== by 0x4008677: (within /lib/ld-2.7.so) ==30003== by 0x4012048: (within /lib/ld-2.7.so) ==30003== by 0x400DDF5: (within /lib/ld-2.7.so) ==30003== by 0x401191A: (within /lib/ld-2.7.so) ==30003== by 0x5AFEF8A: (within /lib/libdl-2.7.so) ==30003== by 0x400DDF5: (within /lib/ld-2.7.so) ==30003== by 0x5AFF4EC: (within /lib/libdl-2.7.so) ==30003== by 0x5AFEEF0: dlopen (in /lib/libdl-2.7.so) ==30003== by 0x536077B: ns3::NscTcpL4Protocol::SetNscLibrary(std::string const&) (nsc-tcp-l4-protocol.cc:102) ==30003== Address 0xb7db258 is 40 bytes inside a block of size 42 alloc'd ==30003== at 0x4C23809: operator new(unsigned long) (vg_replace_malloc.c:230) ==30003== by 0x7A112E0: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x7A120F4: (within /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x7A12271: std::string::string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x407712: main (tcp-nsc-lfn.cc:62) ==30003== ==30003== Invalid read of size 8 ==30003== at 0x4015EFE: (within /lib/ld-2.7.so) ==30003== by 0x400AB93: (within /lib/ld-2.7.so) ==30003== by 0x40061E4: (within /lib/ld-2.7.so) ==30003== by 0x4008677: (within /lib/ld-2.7.so) ==30003== by 0x4012048: (within /lib/ld-2.7.so) ==30003== by 0x400DDF5: (within /lib/ld-2.7.so) ==30003== by 0x401191A: (within /lib/ld-2.7.so) ==30003== by 0x5AFEF8A: (within /lib/libdl-2.7.so) ==30003== by 0x400DDF5: (within /lib/ld-2.7.so) ==30003== by 0x5AFF4EC: (within /lib/libdl-2.7.so) ==30003== by 0x5AFEEF0: dlopen (in /lib/libdl-2.7.so) ==30003== by 0x536077B: ns3::NscTcpL4Protocol::SetNscLibrary(std::string const&) (nsc-tcp-l4-protocol.cc:102) ==30003== Address 0xb7dda00 is 56 bytes inside a block of size 59 alloc'd ==30003== at 0x4C22FAB: malloc (vg_replace_malloc.c:207) ==30003== by 0x4005F47: (within /lib/ld-2.7.so) ==30003== by 0x400885F: (within /lib/ld-2.7.so) ==30003== by 0x4012048: (within /lib/ld-2.7.so) ==30003== by 0x400DDF5: (within /lib/ld-2.7.so) ==30003== by 0x401191A: (within /lib/ld-2.7.so) ==30003== by 0x5AFEF8A: (within /lib/libdl-2.7.so) ==30003== by 0x400DDF5: (within /lib/ld-2.7.so) ==30003== by 0x5AFF4EC: (within /lib/libdl-2.7.so) ==30003== by 0x5AFEEF0: dlopen (in /lib/libdl-2.7.so) ==30003== by 0x536077B: ns3::NscTcpL4Protocol::SetNscLibrary(std::string const&) (nsc-tcp-l4-protocol.cc:102) ==30003== by 0x52CF198: ns3::AddNscStack(ns3::Ptr<ns3::Node>, std::string const&) (internet-stack.cc:98) ==30003== Warning: set address range perms: large range 141221888 (defined) vex amd64->IR: unhandled instruction bytes: 0x15 0xFF 0xFF 0x0 ==30003== valgrind: Unrecognised instruction at address 0xBC47EDB. ==30003== Your program just tried to execute an instruction that Valgrind ==30003== did not recognise. There are two possible reasons for this. ==30003== 1. Your program has a bug and erroneously jumped to a non-code ==30003== location. If you are running Memcheck and you just saw a ==30003== warning about a bad jump, it's probably your program's fault. ==30003== 2. The instruction is legitimate but Valgrind doesn't handle it, ==30003== i.e. it's Valgrind's fault. If you think this is the case or ==30003== you are not sure, please let us know and we'll try to fix it. ==30003== Either way, Valgrind will now raise a SIGILL signal which will ==30003== probably kill your program. ==30003== ==30003== Process terminating with default action of signal 4 (SIGILL) ==30003== Illegal opcode at address 0xBC47EDB ==30003== at 0xBC47EDB: ??? ==30003== by 0xBC5843F: ??? ==30003== by 0xBC5FAF1: ??? ==30003== by 0xBC4706D: ??? ==30003== by 0xBC0608F: ??? ==30003== by 0xBD19E4E: ??? ==30003== by 0xBD390B7: ??? ==30003== by 0x7FEFFFCEF: ??? ==30003== by 0x7FEFFFD5F: ??? ==30003== by 0x1000009FFFFFFFF: ??? ==30003== by 0xD18C2E27FF: ??? ==30003== by 0x7FEFFFD5F: ??? ==30003== ==30003== ERROR SUMMARY: 6 errors from 5 contexts (suppressed: 10 from 1) ==30003== malloc/free: in use at exit: 2,538,537 bytes in 2,919 blocks. ==30003== malloc/free: 7,915 allocs, 4,996 frees, 2,838,221 bytes allocated. ==30003== For counts of detected errors, rerun with: -v ==30003== searching for pointers to 2,919 not-freed blocks. ==30003== checked 17,852,416 bytes. ==30003== ==30003== ==30003== 3,616 (2,176 direct, 1,440 indirect) bytes in 4 blocks are definitely lost in loss record 325 of 337 ==30003== at 0x4C22FAB: malloc (vg_replace_malloc.c:207) ==30003== by 0xBD17A7C: ??? ==30003== by 0xBD17EF8: ??? ==30003== by 0xBD17E10: ??? ==30003== by 0xBD17EC8: ??? ==30003== by 0xBB9A21E: ??? ==30003== by 0xBB9BB65: ??? ==30003== by 0xBB9BD17: ??? ==30003== by 0xBD198F6: ??? ==30003== by 0xBD19C90: ??? ==30003== by 0xBD394B5: ??? ==30003== by 0xBA317D7: ??? ==30003== ==30003== ==30003== 9,827 bytes in 23 blocks are possibly lost in loss record 330 of 337 ==30003== at 0x4C22FAB: malloc (vg_replace_malloc.c:207) ==30003== by 0xBD17A7C: ??? ==30003== by 0xBBAF0E5: ??? ==30003== by 0xBD36BF7: ??? ==30003== by 0xBBC9EC2: ??? ==30003== by 0xBBCA05B: ??? ==30003== by 0xBD36CA5: ??? ==30003== by 0xBD366C2: ??? ==30003== by 0xBD19814: ??? ==30003== by 0xBD392A0: ??? ==30003== by 0x52CF1C3: ns3::AddNscStack(ns3::Ptr<ns3::Node>, std::string const&) (internet-stack.cc:99) ==30003== by 0x52D32EB: ns3::AddNscInternetStack(ns3::Ptr<ns3::Node>, std::string const&) (internet-stack.cc:114) ==30003== ==30003== ==30003== 44,669 bytes in 970 blocks are possibly lost in loss record 334 of 337 ==30003== at 0x4C23809: operator new(unsigned long) (vg_replace_malloc.c:230) ==30003== by 0x7A112E0: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x7A120F4: (within /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x7A12271: std::string::string(char const*, std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.9) ==30003== by 0x5185F05: std::pair<std::string, ns3::LogComponent*>::pair<char const*, ns3::LogComponent*>(std::pair<char const*, ns3::LogComponent*> const&) (stl_pair.h:90) ==30003== by 0x5185610: ns3::LogComponent::LogComponent(char const*) (log.cc:99) ==30003== by 0x54CB62B: __static_initialization_and_destruction_0(int, int) (sqlite-data-output.cc:34) ==30003== by 0x54CB640: _GLOBAL__I__ZN3ns316SqliteDataOutputC2Ev (sqlite-data-output.cc:239) ==30003== by 0x54CD861: (within /home/craigdo/repos/ns-3-dev/build/debug/libns3.so) ==30003== by 0x513CFFA: (within /home/craigdo/repos/ns-3-dev/build/debug/libns3.so) ==30003== by 0x7FF000A57: ??? ==30003== by 0x400E165: (within /lib/ld-2.7.so) ==30003== ==30003== LEAK SUMMARY: ==30003== definitely lost: 2,176 bytes in 4 blocks. ==30003== indirectly lost: 1,440 bytes in 2 blocks. ==30003== possibly lost: 54,496 bytes in 993 blocks. ==30003== still reachable: 2,480,425 bytes in 1,920 blocks. ==30003== suppressed: 0 bytes in 0 blocks. ==30003== Reachable blocks (those to which a pointer was found) are not shown. ==30003== To see them, rerun with: --leak-check=full --show-reachable=yes Compilation finished successfully Command ['valgrind', '--leak-check=full', '/home/craigdo/repos/ns-3-dev/build/debug/examples/tcp-nsc-lfn'] exited with code -4
Valgrind is crashing here because it can't run the binary. This is no fault of NSC; it's just valgrind doesn't support some of the embedded assembler. This has been a continual problem during NSC development, I've reported similar bugs in the past with earlier versions of Linux. Newer versions of Linux seem to break valgrind once again. Actually, I see I've already put that in a comment. I don't think this bug is fixable. The best we can do is report the bug back to the valgrind people and try again with a future release. As I said, Florian has reported that it does work on 32-bit.
I think this bug should be closed with "wont fix" -- this is a bug in Valgrind, not ns-3. Does this prevent any tests or similar from working (other than manually running a test using NSC)? If it doesn't block any other activities, we should just close this bug. Craig, perhaps you can comment on this?
Yes, this bug should be closed. We do, however, need to write down somewhere that we expect that the failure in 64-bit valgrind is expected behavior and it "ain't our fault." Perhaps the right place to do this is in the "Validating an ns-3 compilation" section of http://www.nsnam.org/getting_started.html?
(In reply to comment #5) > Yes, this bug should be closed. > > We do, however, need to write down somewhere that we expect that the failure in > 64-bit valgrind is expected behavior and it "ain't our fault." Perhaps the > right place to do this is in the "Validating an ns-3 compilation" section of > http://www.nsnam.org/getting_started.html? > There are a couple of places in the wiki for this type of disclaimer; e.g. http://www.nsnam.org/wiki/index.php/Troubleshooting
Updated http://www.nsnam.org/wiki/index.php/Troubleshooting with information about this.