Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-86610

Add tcmalloc back under UBSAN

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Service Arch
    • Service Arch 2024-04-01, Service Arch 2024-04-15, Service Arch 2024-04-29, Service Arch 2024-05-13

      In SERVER-85737, we set the allocator for ubsan to system to get the latest tcmalloc merged in. However we should try to sanitize with the allocator as that more closely matches our release, and we even found and fixed an issue with the new tcmalloc via UBSAN.

      UBSAN with new tcmalloc was working at one point, and then through the development process it became broken with this segfault ONLY on x86 platforms:

      (gdb) run
      Starting program: /data/mci/mongo/build/install/bin/wt
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/lib64/libthread_db.so.1".

      Program received signal SIGSEGV, Segmentation fault.
      0x00007ffff65d1a50 in clock_gettime () from /lib64/libc.so.6
      (gdb) bt
      #0 0x00007ffff65d1a50 in clock_gettime () from /lib64/libc.so.6
      #1 0x00005555564c3b86 in absl::lts_20230802::base_internal::ReadMonotonicClockNanos () at src/third_party/abseil-cpp/dist/absl/base/internal/sysinfo.cc:238
      #2 0x00005555564c3741 in absl::lts_20230802::base_internal::GetTimeTscPair () at src/third_party/abseil-cpp/dist/absl/base/internal/sysinfo.cc:268
      #3 0x00005555564c3659 in absl::lts_20230802::base_internal::MeasureTscFrequencyWithSleep (sleep_nanoseconds=sleep_nanoseconds@entry=1000000) at src/third_party/abseil-cpp/dist/absl/base/internal/sysinfo.cc:284
      #4 0x00005555564c34aa in absl::lts_20230802::base_internal::MeasureTscFrequency () at src/third_party/abseil-cpp/dist/absl/base/internal/sysinfo.cc:302
      #5 0x00005555564c3250 in absl::lts_20230802::base_internal::GetNominalCPUFrequency () at src/third_party/abseil-cpp/dist/absl/base/internal/sysinfo.cc:343
      #6 absl::lts_20230802::base_internal::NominalCPUFrequency()::$_1::operator()() const (this=<optimized out>) at src/third_party/abseil-cpp/dist/absl/base/internal/sysinfo.cc:380
      #7 std::_invoke_impl<void, absl::lts_20230802::base_internal::NominalCPUFrequency()::$_1>(std::invoke_other, absl::lts_20230802::base_internal::NominalCPUFrequency()::$_1&&) (_f=...)
      at /opt/mongodbtoolchain/revisions/69f4f0673ffcb290ce2307560a4883ecf2ad138c/stow/gcc-v4.35T/lib/gcc/x86_64-mongodb-linux/11.3.0/../../../../include/c++/11.3.0/bits/invoke.h:61
      #8 std::_invoke<absl::lts_20230802::base_internal::NominalCPUFrequency()::$_1>(absl::lts_20230802::base_internal::NominalCPUFrequency()::$_1&&) (_fn=...)
      at /opt/mongodbtoolchain/revisions/69f4f0673ffcb290ce2307560a4883ecf2ad138c/stow/gcc-v4.35T/lib/gcc/x86_64-mongodb-linux/11.3.0/../../../../include/c++/11.3.0/bits/invoke.h:96
      #9 std::invoke<absl::lts_20230802::base_internal::NominalCPUFrequency()::$1>(absl::lts_20230802::base_internal::NominalCPUFrequency()::$_1&&) (_fn=...)
      at /opt/mongodbtoolchain/revisions/69f4f0673ffcb290ce2307560a4883ecf2ad138c/stow/gcc-v4.35T/lib/gcc/x86_64-mongodb-linux/11.3.0/../../../../include/c++/11.3.0/functional:97
      #10 absl::lts_20230802::base_internal::CallOnceImpl<absl::lts_20230802::base_internal::NominalCPUFrequency()::$_1>(std::atomic<unsigned int>*, absl::lts_20230802::base_internal::SchedulingMode, absl::lts_20230802::base_internal::NominalCPUFrequency()::$_1&&) (control=0x555557bee4d8 <absl::lts_20230802::base_internal::init_nominal_cpu_frequency_once>, scheduling_mode=<optimized out>, scheduling_mode@entry=absl::lts_20230802::base_internal::SCHEDULE_KERNEL_ONLY, fn=...)
      at src/third_party/abseil-cpp/dist/absl/base/call_once.h:178
      #11 0x00005555564c2f99 in absl::lts_20230802::base_internal::LowLevelCallOnce<absl::lts_20230802::base_internal::NominalCPUFrequency()::$_1>(absl::lts_20230802::once_flag*, absl::lts_20230802::base_internal::NominalCPUFrequency()::$_1&&) (
      fn=..., flag=<optimized out>) at src/third_party/abseil-cpp/dist/absl/base/call_once.h:197
      #12 absl::lts_20230802::base_internal::NominalCPUFrequency () at src/third_party/abseil-cpp/dist/absl/base/internal/sysinfo.cc:378
      #13 0x00005555565ff45d in absl::lts_20230802::base_internal::CycleClock::Frequency () at src/third_party/abseil-cpp/dist/absl/base/internal/cycleclock.h:135
      #14 tcmalloc::tcmalloc_internal::PageAllocInfo::PageAllocInfo (this=0x5555572bcc40 <tcmalloc::tcmalloc_internal::Static::page_allocator_+8>, label=<optimized out>) at src/third_party/tcmalloc/dist/tcmalloc/stats.h:253
      #15 0x00005555565ede85 in tcmalloc::tcmalloc_internal::PageAllocatorInterface::PageAllocatorInterface (this=0x5555572bcc38 <tcmalloc::tcmalloc_internal::Static::page_allocator_>, label=0x7fffffffda50 "\240\332\377\377\377\177",
      map=<optimized out>, tag=tcmalloc::tcmalloc_internal::MemoryTag::kNormalP0) at src/third_party/tcmalloc/dist/tcmalloc/page_allocator_interface.cc:39
      #16 tcmalloc::tcmalloc_internal::PageAllocatorInterface::PageAllocatorInterface (this=0x5555572bcc38 <tcmalloc::tcmalloc_internal::Static::page_allocator_>, label=0x7fffffffda50 "\240\332\377\377\377\177",
      tag=tcmalloc::tcmalloc_internal::MemoryTag::kNormalP0) at src/third_party/tcmalloc/dist/tcmalloc/page_allocator_interface.cc:35
      #17 0x00005555565cafea in tcmalloc::tcmalloc_internal::HugePageAwareAllocator::HugePageAwareAllocator (this=this@entry=0x5555572bcc38 <tcmalloc::tcmalloc_internal::Static::page_allocator_>,
      tag=tcmalloc::tcmalloc_internal::MemoryTag::kNormalP0, use_huge_region_more_often=<optimized out>, lifetime_options=...) at src/third_party/tcmalloc/dist/tcmalloc/huge_page_aware_allocator.cc:150
      #18 0x00005555565caf6b in tcmalloc::tcmalloc_internal::HugePageAwareAllocator::HugePageAwareAllocator (this=0x5555572bcc38 <tcmalloc::tcmalloc_internal::Static::page_allocator_>, tag=tcmalloc::tcmalloc_internal::MemoryTag::kNormalP0)
      at src/third_party/tcmalloc/dist/tcmalloc/huge_page_aware_allocator.cc:139
      #19 0x00005555565ed36f in tcmalloc::tcmalloc_internal::PageAllocator::PageAllocator (this=0x5555572bcc38 <tcmalloc::tcmalloc_internal::Static::page_allocator_>) at src/third_party/tcmalloc/dist/tcmalloc/page_allocator.cc:92
      #20 0x00005555565facda in tcmalloc::tcmalloc_internal::Static::SlowInitIfNecessary () at src/third_party/tcmalloc/dist/tcmalloc/static_vars.cc:160
      #21 0x000055555658831a in tcmalloc::tcmalloc_internal::Static::InitIfNecessary () at src/third_party/tcmalloc/dist/tcmalloc/static_vars.h:244
      #22 slow_alloc<tcmalloc::tcmalloc_internal::TCMallocPolicy<tcmalloc::tcmalloc_internal::MallocOomPolicy, tcmalloc::tcmalloc_internal::MallocAlignPolicy, tcmalloc::tcmalloc_internal::AllocationAccessHotPolicy, tcmalloc::tcmalloc_internal::InvokeHooksPolicy, tcmalloc::tcmalloc_internal::LocalNumaPartitionPolicy>, decltype(nullptr)>(tcmalloc::tcmalloc_internal::TCMallocPolicy<tcmalloc::tcmalloc_internal::MallocOomPolicy, tcmalloc::tcmalloc_internal::MallocAlignPolicy, tcmalloc::tcmalloc_internal::AllocationAccessHotPolicy, tcmalloc::tcmalloc_internal::InvokeHooksPolicy, tcmalloc::tcmalloc_internal::LocalNumaPartitionPolicy>, unsigned long, decltype(nullptr)) (policy=..., size=size@entry=32, capacity=capacity@entry=void)
      at src/third_party/tcmalloc/dist/tcmalloc/tcmalloc.cc:1022
      #23 0x0000555556576012 in fast_alloc<tcmalloc::tcmalloc_internal::TCMallocPolicy<tcmalloc::tcmalloc_internal::MallocOomPolicy, tcmalloc::tcmalloc_internal::MallocAlignPolicy, tcmalloc::tcmalloc_internal::AllocationAccessHotPolicy, tcmalloc::tcmalloc_internal::InvokeHooksPolicy, tcmalloc::tcmalloc_internal::LocalNumaPartitionPolicy>, decltype(nullptr)>(tcmalloc::tcmalloc_internal::TCMallocPolicy<tcmalloc::tcmalloc_internal::MallocOomPolicy, tcmalloc::tcmalloc_internal::MallocAlignPolicy, tcmalloc::tcmalloc_internal::AllocationAccessHotPolicy, tcmalloc::tcmalloc_internal::InvokeHooksPolicy, tcmalloc::tcmalloc_internal::LocalNumaPartitionPolicy>, unsigned long, decltype(nullptr)) (size=32, capacity=void, policy=...)
      at src/third_party/tcmalloc/dist/tcmalloc/tcmalloc.cc:1069
      #24 TCMallocInternalCalloc (n=<optimized out>, elem_size=<optimized out>) at src/third_party/tcmalloc/dist/tcmalloc/tcmalloc.cc:1241
      #25 0x00007ffff6ecd9d5 in _dlerror_run () from /lib64/libdl.so.2
      #26 0x00007ffff6ecd393 in dlsym () from /lib64/libdl.so.2
      #27 0x0000555555de41fc in InitializeSwiftDemangler () at /data/mci/0daf2ee55223f87d23db2ac2806d764d/toolchain-builder/tmp/build-llvm-v4.sh-PAU/llvm-project-llvmorg/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp:74
      #28 LateInitialize () at /data/mci/0daf2ee55223f87d23db2ac2806d764d/toolchain-builder/tmp/build-llvm-v4.sh-PAU/llvm-project-llvmorg/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp:487
      #29 0x0000555555de6ce4 in CommonStandaloneInit () at /data/mci/0daf2ee55223f87d23db2ac2806d764d/toolchain-builder/tmp/build-llvm-v4.sh-PAU/llvm-project-llvmorg/compiler-rt/lib/ubsan/ubsan_init.cpp:45
      #30 InitAsStandalone () at /data/mci/0daf2ee55223f87d23db2ac2806d764d/toolchain-builder/tmp/build-llvm-v4.sh-PAU/llvm-project-llvmorg/compiler-rt/lib/ubsan/ubsan_init.cpp:51
      #31 0x0000555555dec276 in __ubsan::PreInitAsStandalone() () at /data/mci/0daf2ee55223f87d23db2ac2806d764d/toolchain-builder/tmp/build-llvm-v4.sh-PAU/llvm-project-llvmorg/compiler-rt/lib/ubsan/ubsan_init_standalone_preinit.cpp:27
      #32 0x00007ffff7de3e8e in _dl_init () from /lib64/ld-linux-x86-64.so.2
      #33 0x00007ffff7dd506a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
      #34 0x0000000000000001 in ?? ()
      #35 0x00007fffffffe559 in ?? ()
      #36 0x0000000000000000 in ?? ()

            Assignee:
            blake.oler@mongodb.com Blake Oler
            Reporter:
            daniel.moody@mongodb.com Daniel Moody
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: