AddressSanitizer: container-overflow
Created by: NAThompson
In the CMakeLists.txt add the line
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
and then run the unit tests. Then we obtain the container-overflow error
284: Process wrank 0 rank 0 calls MainWriters
284: There are 1 Writers
284: Process wrank 1 rank 0 calls MainReaders
284: There are 1 Readers
284: =================================================================
284: ==99274==ERROR: AddressSanitizer: container-overflow on address 0x60200002e310 at pc 0x000109eca751 bp 0x7ffee7018
0 sp 0x7ffee7017c30
284: WRITE of size 4 at 0x60200002e310 thread T0
284: =================================================================
284: ==99273==ERROR: AddressSanitizer: container-overflow on address 0x60200002e3d0 at pc 0x00010baf5751 bp 0x7ffee53f6
0 sp 0x7ffee53f5ed0
284: WRITE of size 4 at 0x60200002e3d0 thread T0
284: #0 0x10baf5750 in wrap_memcpy (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x1e750)
284: #1 0x10c9aaed3 in non_overlap_copy_content_same_ddt (libopen-pal.40.dylib:x86_64+0x1aed3)
284: #2 0x10b9d4397 in ompi_datatype_sndrcv (libmpi.40.dylib:x86_64+0x2c397)
284: #3 0x10b9e6a5e in MPI_Gather (libmpi.40.dylib:x86_64+0x3ea5e)
284: #4 0x10b3eeef7 in adios2::insitumpi::FindPeers(ompi_communicator_t*, std::__1::basic_string<char, std::__1::ch
_traits<char>, std::__1::allocator<char> > const&, bool, ompi_communicator_t*) (libadios2.2.dylib:x86_64+0xaadef7)
284: #5 0x10b385250 in adios2::core::engine::InSituMPIWriter::InSituMPIWriter(adios2::core::IO&, std::__1::basic_st
ng<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, adios2::Mode, ompi_communicator_t*) (libadios
2.dylib:x86_64+0xa44250)
284: #6 0x10aac12b3 in adios2::core::IO::Open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::a
ocator<char> > const&, adios2::Mode, ompi_communicator_t*) (libadios2.2.dylib:x86_64+0x1802b3)
284: #7 0x10b563fe1 in adios2::IO::Open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocat
<char> > const&, adios2::Mode, ompi_communicator_t*) (libadios2.2.dylib:x86_64+0xc22fe1)
284: #8 0x10a815fad in TestStagingMPMD::MainWriters(ompi_communicator_t*, unsigned long, unsigned long, int, unsign
int) (TestStagingMPMD:x86_64+0x10000ffad)
284: #9 0x10a80d8e2 in TestStagingMPMD::TestCommon(RunParams, int, unsigned int, unsigned int, float) (TestStagingM
D:x86_64+0x1000078e2)
284: #10 0x10a80d02e in TestStagingMPMD_SingleStep_Test::TestBody() (TestStagingMPMD:x86_64+0x10000702e)
Or, a somewhat different route to nullptr segfault:
build/bin$ ./TestStagingMPMD
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1299==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fff589be712 bp 0x7ffee40d0f40 sp 0x7ffee40d0f40 T0)
==1299==The signal is caused by a READ memory access.
==1299==Hint: address points to the zero page.
#0 0x7fff589be711 in _platform_strlen (libsystem_platform.dylib:x86_64+0x1711)
#1 0x10ce0eed8 in wrap_strlen (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x17ed8)
#2 0x10bb38faf in main (TestStagingMPMD:x86_64+0x10000afaf)
#3 0x7fff587dc3d4 in start (libdyld.dylib:x86_64+0x163d4)
==1299==Register values:
rax = 0x000000010daa250c rbx = 0x00007ffee40d1900 rcx = 0x0000000000000000 rdx = 0x0000000000000000
rdi = 0x0000000000000000 rsi = 0x0000000000000000 rbp = 0x00007ffee40d0f40 rsp = 0x00007ffee40d0f40
r8 = 0x0000000000000000 r9 = 0xffffffff00000000 r10 = 0x0000000112be0c30 r11 = 0x000000010cd048d8
r12 = 0x0000000000000000 r13 = 0x00001fffdc81a2f8 r14 = 0x0000000000000000 r15 = 0x000000010daa2508
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (libsystem_platform.dylib:x86_64+0x1711) in _platform_strlen
==1299==ABORTING
[:01299] *** Process received signal ***
[:01299] Signal: Abort trap: 6 (6)
[:01299] Signal code: (0)
[:01299] *** End of error message ***
[1] 1299 abort ./TestStagingMPMD