Skip to content

lldb crash while debugging asan program #147145

Closed
@nfrmtk

Description

@nfrmtk
(lldb) target create "ydb_interface_merge_test_ut"
Current executable set to '/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut' (x86_64).
(lldb) run
Process 15240 launched: '/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut' (x86_64)
Running main() from ./googletest/src/gtest_main.cc
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from YDBMergeInterface
[ RUN      ] YDBMergeInterface.Random
=================================================================
==15240==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7ffff7371800 at pc 0x55555575bfc8 bp 0x7fffffffbb30 sp 0x7fffffffb2f0
WRITE of size 256 at 0x7ffff7371800 thread T0
    #0 0x55555575bfc7 in __asan_memcpy (/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut+0x207fc7) (BuildId: 970b89ab0b8687cf)
    #1 0x555555874e92 in TSpilling::Load(TSpillingBlock, unsigned long, void*, unsigned long) /home/nfrmtk/ysda/p-way-merge/pmerge/ydb/spilling_mem.cpp:52:3
    #2 0x5555558234f4 in TInputData<1u>::Next(TSpilling&) /home/nfrmtk/ysda/p-way-merge/include/pmerge/ydb/merge_reference.hpp:50:10
    #3 0x5555557a6470 in unsigned int ydb_reference::merge2pway<false, 1u, 4u>(unsigned long*, unsigned int, TSpilling&, std::deque<TSpillingBlock, std::allocator<TSpillingBlock>>&) /home/nfrmtk/ysda/p-way-merge/include/pmerge/ydb/merge_reference.hpp:152:27
    #4 0x55555579fea7 in YDBMergeInterface_Random_Test::TestBody() /home/nfrmtk/ysda/p-way-merge/pmerge/tests/ydb_interface_merge_test.cpp:40:3
    #5 0x5555558b499e in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut+0x36099e) (BuildId: 970b89ab0b8687cf)
    #6 0x555555896335 in testing::Test::Run() (/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut+0x342335) (BuildId: 970b89ab0b8687cf)
    #7 0x5555558964f4 in testing::TestInfo::Run() (/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut+0x3424f4) (BuildId: 970b89ab0b8687cf)
    #8 0x5555558966de in testing::TestSuite::Run() (/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut+0x3426de) (BuildId: 970b89ab0b8687cf)
    #9 0x5555558a454b in testing::internal::UnitTestImpl::RunAllTests() (/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut+0x35054b) (BuildId: 970b89ab0b8687cf)
    #10 0x5555558b5076 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut+0x361076) (BuildId: 970b89ab0b8687cf)
    #11 0x5555558968d7 in testing::UnitTest::Run() (/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut+0x3428d7) (BuildId: 970b89ab0b8687cf)
    #12 0x555555878a13 in main (/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut+0x324a13) (BuildId: 970b89ab0b8687cf)
    #13 0x7ffff782a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #14 0x7ffff782a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #15 0x5555556c3234 in _start (/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut+0x16f234) (BuildId: 970b89ab0b8687cf)

0x7ffff7371800 is located 0 bytes after 196608-byte region [0x7ffff7341800,0x7ffff7371800)
allocated by thread T0 here:
    #0 0x55555579c721 in operator new(unsigned long) (/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut+0x248721) (BuildId: 970b89ab0b8687cf)
    #1 0x5555557b3a5f in std::__new_allocator<unsigned long>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/new_allocator.h:151:27
    #2 0x5555557b2c41 in std::allocator<unsigned long>::allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/allocator.h:196:32
    #3 0x5555557b2c41 in std::allocator_traits<std::allocator<unsigned long>>::allocate(std::allocator<unsigned long>&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/alloc_traits.h:478:20
    #4 0x5555557b2c41 in std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_M_allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:380:20
    #5 0x5555557b1a71 in std::vector<unsigned long, std::allocator<unsigned long>>::_M_default_append(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/vector.tcc:834:34
    #6 0x5555557a5be5 in std::vector<unsigned long, std::allocator<unsigned long>>::resize(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:1016:4
    #7 0x55555579fe67 in YDBMergeInterface_Random_Test::TestBody() /home/nfrmtk/ysda/p-way-merge/pmerge/tests/ydb_interface_merge_test.cpp:39:8
    #8 0x5555558b499e in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut+0x36099e) (BuildId: 970b89ab0b8687cf)

SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/nfrmtk/ysda/p-way-merge/build/ydb_interface_merge_test_ut+0x207fc7) (BuildId: 970b89ab0b8687cf) in __asan_memcpy
Shadow bytes around the buggy address:
  0x7ffff7371580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7ffff7371600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7ffff7371680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7ffff7371700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x7ffff7371780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x7ffff7371800:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x7ffff7371880: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x7ffff7371900: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x7ffff7371980: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x7ffff7371a00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x7ffff7371a80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==15240==ABORTING
(lldb) PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
 #0 0x00007c17a2ba63bf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) build-llvm/tools/clang/stage2-bins/llvm/lib/Support/Unix/Signals.inc:723:13
 #1 0x00007c17a2ba44f9 llvm::sys::RunSignalHandlers() build-llvm/tools/clang/stage2-bins/llvm/lib/Support/Signals.cpp:106:18
 #2 0x00007c17a2ba6b00 SignalHandler build-llvm/tools/clang/stage2-bins/llvm/lib/Support/Unix/Signals.inc:413:1
 #3 0x00007c17a1645330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
 #4 0x00007c17aa0205a0 RetrieveReportData build-llvm/tools/clang/stage2-bins/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp:102:23
 #5 0x00007c17aa0239e6 ~__shared_count /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1070:12
 #6 0x00007c17aa0239e6 ~__shared_ptr /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1524:31
 #7 0x00007c17aa0239e6 NotifyBreakpointHit build-llvm/tools/clang/stage2-bins/lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp:202:37
 #8 0x00007c17a9d6973a NotifyBreakpointHit build-llvm/tools/clang/stage2-bins/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp:75:10
 #9 0x00007c17a9c07f91 PerformAction build-llvm/tools/clang/stage2-bins/lldb/source/Target/StopInfo.cpp:535:47
#10 0x00007c17a9bd657c get /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1666:16
#11 0x00007c17a9bd657c _M_get /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1363:66
#12 0x00007c17a9bd657c operator-> /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1357:9
#13 0x00007c17a9bd657c ShouldStop build-llvm/tools/clang/stage2-bins/lldb/source/Target/Process.cpp:4060:13
#14 0x00007c17a9bd69f7 GetRestarted build-llvm/tools/clang/stage2-bins/lldb/include/lldb/Target/Process.h:423:40
#15 0x00007c17a9bd69f7 DoOnRemoval build-llvm/tools/clang/stage2-bins/lldb/source/Target/Process.cpp:4118:7
#16 0x00007c17a9c9637b __shared_count /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1242:17
#17 0x00007c17a9c9637b __shared_ptr<lldb_private::Event, void> /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1548:4
#18 0x00007c17a9c9637b shared_ptr<lldb_private::Event, void> /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr.h:381:4
#19 0x00007c17a9c9637b shared_from_this /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr.h:935:16
#20 0x00007c17a9c9637b DoOnRemoval build-llvm/tools/clang/stage2-bins/lldb/source/Utility/Event.cpp:90:19
#21 0x00007c17a9c9c85b FindNextEventInternal build-llvm/tools/clang/stage2-bins/lldb/source/Utility/Listener.cpp:0:17
#22 0x00007c17a9c9cde1 GetEventInternal build-llvm/tools/clang/stage2-bins/lldb/source/Utility/Listener.cpp:280:9
#23 0x00007c17a9a2f71d DefaultEventHandler build-llvm/tools/clang/stage2-bins/lldb/source/Core/Debugger.cpp:1887:9
#24 0x00007c17a9a32dc0 _M_invoke /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:290:2
#25 0x00007c17a9af9dab operator() /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/std_function.h:591:9
#26 0x00007c17a9af9dab ThreadCreateTrampoline build-llvm/tools/clang/stage2-bins/lldb/source/Host/common/HostNativeThreadBase.cpp:62:10
#27 0x00007c17a169caa4 start_thread ./nptl/pthread_create.c:447:8
#28 0x00007c17a1729c3c clone3 ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80:0
LLDB diagnostics will be written to /home/nfrmtk/tmp/diagnostics-01d006
Please include the directory content when filing a bug report
Segmentation fault

diagnostics dir contains 1 empty diagnostics.log file

Metadata

Metadata

Assignees

No one assigned

    Labels

    compiler-rt:asanAddress sanitizercrashPrefer [crash-on-valid] or [crash-on-invalid]lldb

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions