Skip to content

Stack overflow in __ubsan_handle_dynamic_type_cache_miss (?) #80

Open
@DimanNe

Description

@DimanNe

I am building both my application (gtest, to be precise) and libc from sources (branch release/9.x) with clang-9 with ubsan (-fsanitize=undefined).

When I try to run it, I get stackoverflow (due to infinite recursion) that looks like this:

#27562 0x0000000000602f9e in is_equal (x=0x72f2b8 <typeinfo for __cxxabiv1::__si_class_type_info>, y=0x72f2a0 <typeinfo for __cxxabiv1::__class_type_info>, use_strcmp=false) at /home/dimanne/devel/scripts/contrib/llvm-project/libcxxabi/src/private_typeinfo.cpp:66
#27563 0x000000000060a4c8 in __dynamic_cast (static_ptr=0x72f2b8 <typeinfo for __cxxabiv1::__si_class_type_info>, static_type=0x72f180 <typeinfo for std::type_info>, dst_type=0x72f2a0 <typeinfo for __cxxabiv1::__class_type_info>, src2dst_offset=0) at /home/dimanne/devel/scripts/contrib/llvm-project/libcxxabi/src/private_typeinfo.cpp:637
#27564 0x00000000003c16a7 in __ubsan::checkDynamicType(void*, void*, unsigned long) ()
#27565 0x00000000003c0502 in HandleDynamicTypeCacheMiss(__ubsan::DynamicTypeCacheMissData*, unsigned long, unsigned long, __ubsan::ReportOptions) ()
#27566 0x00000000003c04da in __ubsan_handle_dynamic_type_cache_miss ()
#27567 0x0000000000602f9e in is_equal (x=0x72f2b8 <typeinfo for __cxxabiv1::__si_class_type_info>, y=0x72f2a0 <typeinfo for __cxxabiv1::__class_type_info>, use_strcmp=false) at /home/dimanne/devel/scripts/contrib/llvm-project/libcxxabi/src/private_typeinfo.cpp:66
#27568 0x000000000060a4c8 in __dynamic_cast (static_ptr=0x72f2b8 <typeinfo for __cxxabiv1::__si_class_type_info>, static_type=0x72f180 <typeinfo for std::type_info>, dst_type=0x72f2a0 <typeinfo for __cxxabiv1::__class_type_info>, src2dst_offset=0) at /home/dimanne/devel/scripts/contrib/llvm-project/libcxxabi/src/private_typeinfo.cpp:637
#27569 0x00000000003c16a7 in __ubsan::checkDynamicType(void*, void*, unsigned long) ()
#27570 0x00000000003c0502 in HandleDynamicTypeCacheMiss(__ubsan::DynamicTypeCacheMissData*, unsigned long, unsigned long, __ubsan::ReportOptions) ()
#27571 0x00000000003c04da in __ubsan_handle_dynamic_type_cache_miss ()
#27572 0x0000000000602f9e in is_equal (x=0x72f2a0 <typeinfo for __cxxabiv1::__class_type_info>, y=0x72f2a0 <typeinfo for __cxxabiv1::__class_type_info>, use_strcmp=false) at /home/dimanne/devel/scripts/contrib/llvm-project/libcxxabi/src/private_typeinfo.cpp:66
#27573 0x000000000060a4c8 in __dynamic_cast (static_ptr=0x2f1ce8 <typeinfo for testing::internal::UnitTestImpl>, static_type=0x72f180 <typeinfo for std::type_info>, dst_type=0x72f2a0 <typeinfo for __cxxabiv1::__class_type_info>, src2dst_offset=0) at /home/dimanne/devel/scripts/contrib/llvm-project/libcxxabi/src/private_typeinfo.cpp:637
#27574 0x00000000003c16a7 in __ubsan::checkDynamicType(void*, void*, unsigned long) ()
#27575 0x00000000003c0502 in HandleDynamicTypeCacheMiss(__ubsan::DynamicTypeCacheMissData*, unsigned long, unsigned long, __ubsan::ReportOptions) ()
#27576 0x00000000003c04da in __ubsan_handle_dynamic_type_cache_miss ()
#27577 0x000000000065f73b in testing::internal::UnitTestImpl::UnitTestImpl (this=0x253b5b0, parent=0x1174da8 <testing::UnitTest::GetInstance()::instance>) at /home/dimanne/devel/scripts/contrib/googletest/googletest/googletest/src/gtest.cc:5005
#27578 0x000000000065ec8d in testing::UnitTest::UnitTest (this=0x1174da8 <testing::UnitTest::GetInstance()::instance>) at /home/dimanne/devel/scripts/contrib/googletest/googletest/googletest/src/gtest.cc:4974
#27579 0x000000000061cb10 in testing::UnitTest::GetInstance () at /home/dimanne/devel/scripts/contrib/googletest/googletest/googletest/src/gtest.cc:4619
#27580 0x000000000067eda5 in testing::internal::GetUnitTestImpl () at /home/dimanne/devel/scripts/contrib/googletest/googletest/googletest/src/gtest-internal-inl.h:951
#27581 0x0000000000638c6a in testing::internal::MakeAndRegisterTestInfo (test_suite_name=0x2a2a76 "NActors_TActorId", name=0x294d2a "ServiceCtorSetsDataInExpectedWay", type_param=0x0, value_param=0x0, code_location=..., fixture_class_id=0x1174e70 <testing::internal::TypeIdHelper<testing::Test>::dummy_>, set_up_tc=0x0, tear_down_tc=0x0, factory=0x253b370) at /home/dimanne/devel/scripts/contrib/googletest/googletest/googletest/src/gtest.cc:2589
#27582 0x00000000003c93e3 in __cxx_global_var_init () at /home/dimanne/devel/scripts/actors/ut/actor_id.t.cpp:8
#27583 0x00000000003c9d79 in _GLOBAL__sub_I_actor_id.t.cpp ()
#27584 0x000000000072953d in __libc_csu_init ()
#27585 0x00007f903a74916e in __libc_start_main () from /usr/lib/x86_64-linux-gnu/libc.so.6
#27586 0x00000000003a002e in _start ()
(gdb)

According to the backtrace, my code is not even executed. Something wrong goes during global initialisation in GoogleTest.
I am sure I am missing something easy and obvious... Can you please help?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions