Skip to content

AddressSanitizer: heap-buffer-overflow in coroutines.cc:91 TLS_get_cglobals #3326

Open

Description

@AtnNn

With clang address sanitizing and THREADED_COROUTINES=1 (see #3294), about half the unit tests fail with an error such to this one:

[----------] 2 tests from BTreeSindex (22504 ms total)
 ==15269==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62500001e0c0 at pc 0x00000191b997 bp 0x7fff4345e270 sp 0x7fff4345e268
 READ of size 8 at 0x62500001e0c0 thread T0
     #0 0x191b996 in TLS_get_cglobals() /home/atnnn/code/rethinkdb/src/arch/runtime/coroutines.cc:91:1
     #1 0x19215f8 in coroutines_have_been_initialized() /home/atnnn/code/rethinkdb/src/arch/runtime/coroutines.cc:373:12
     #2 0x41062a8 in perfmon_collection_t::remove(perfmon_membership_t*) /home/atnnn/code/rethinkdb/src/perfmon/core.cc:88:9
     #3 0x4107a15 in perfmon_membership_t::~perfmon_membership_t() /home/atnnn/code/rethinkdb/src/perfmon/core.cc:109:5
     #4 0x7fde8ba5f5b0 in __run_exit_handlers /build/buildd/eglibc-2.15/stdlib/exit.c:78
     #5 0x7fde8ba5f634 in exit /build/buildd/eglibc-2.15/stdlib/exit.c:100
     #6 0x7fde8ba45773 in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:258
     #7 0x1671dac in _start (/home/ssd1/atnnn/code/rethinkdb/build/debug_clang_threaded_notcmalloc/rethinkdb-unittest+0x1671dac)

 0x62500001e0c0 is located 64 bytes to the left of 8192-byte region [0x62500001e100,0x625000020100)
 allocated by thread T0 here:
     #0 0x15ece1b in operator new(unsigned long) /home/ssd1/atnnn/src/llvm-3.5.0.src/projects/compiler-rt/lib/asan/asan_new_delete.cc:62:35
     #1 0x195830a in __gnu_cxx::new_allocator<cache_line_padded_t<coro_globals_t*> >::allocate(unsigned long, void const*) /opt/gcc-4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../include/c++/4.9.2/ext/new_allocator.h:104:27
     #2 0x1958078 in std::allocator_traits<std::allocator<cache_line_padded_t<coro_globals_t*> > >::allocate(std::allocator<cache_line_padded_t<coro_globals_t*> >&, unsigned long) /opt/gcc-4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../include/c++/4.9.2/bits/alloc_traits.h:357:16
     #3 0x1957e5a in std::_Vector_base<cache_line_padded_t<coro_globals_t*>, std::allocator<cache_line_padded_t<coro_globals_t*> > >::_M_allocate(unsigned long) /opt/gcc-4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../include/c++/4.9.2/bits/stl_vector.h:170:20
     #4 0x1957b01 in std::_Vector_base<cache_line_padded_t<coro_globals_t*>, std::allocator<cache_line_padded_t<coro_globals_t*> > >::_M_create_storage(unsigned long) /opt/gcc-4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../include/c++/4.9.2/bits/stl_vector.h:185:27
     #5 0x1956077 in std::_Vector_base<cache_line_padded_t<coro_globals_t*>, std::allocator<cache_line_padded_t<coro_globals_t*> > >::_Vector_base(unsigned long, std::allocator<cache_line_padded_t<coro_globals_t*> > const&) /opt/gcc-4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../include/c++/4.9.2/bits/stl_vector.h:136:9
     #6 0x1924a77 in std::vector<cache_line_padded_t<coro_globals_t*>, std::allocator<cache_line_padded_t<coro_globals_t*> > >::vector(unsigned long, cache_line_padded_t<coro_globals_t*> const&, std::allocator<cache_line_padded_t<coro_globals_t*> > const&) /opt/gcc-4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../include/c++/4.9.2/bits/stl_vector.h:292:7
     #7 0x1923dac in __cxx_global_var_init /home/atnnn/code/rethinkdb/src/arch/runtime/coroutines.cc:91:1
     #8 0x19243e7 in _GLOBAL__sub_I_coroutines.cc /home/atnnn/code/rethinkdb/./src/arch/io/concurrency.hpp
     #9 0x6c4aafc in __libc_csu_init (/home/ssd1/atnnn/code/rethinkdb/build/debug_clang_threaded_notcmalloc/rethinkdb-unittest+0x6c4aafc)

Activity

  1. added this to the milestone on Nov 14, 2014
  2. danielmewes commented on Nov 14, 2014

    @danielmewes
    Member

    This is likely a THREADED_COROUTINES only issue (TLS variables work completely different in that case).

  3. modified the milestones: , subsequent on Jan 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions