Skip to content

Asan report #13

Description

@nunoplopes

Unclear if it's a bug in Cpp2Rust or LLVM. It's causing tests to fail randomly.

ERROR: AddressSanitizer: use-after-poison on address 0x7d0c4cfe7948 at pc 0x562f7273f914 bp 0x7ffee762d7a0 sp 0x7ffee762cf58
WRITE of size 10 at 0x7d0c4cfe7948 thread T0
    #0 0x562f7273f913 in memcpy (cpp2rust/build/cpp2rust/cpp2rust+0x581913) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #1 0x562f72a9a2db in std::pair<llvm::StringMapIterBase<clang::IdentifierInfo*, false>, bool> llvm::StringMap<clang::IdentifierInfo*, llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>>::try_emplace_with_hash<std::nullptr_t>(llvm::StringRef, unsigned int, std::nullptr_t&&) (cpp2rust/build/cpp2rust/cpp2rust+0x8dc2db) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #2 0x562f72a598fe in clang::IdentifierTable::get(llvm::StringRef) (cpp2rust/build/cpp2rust/cpp2rust+0x89b8fe) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #3 0x562f740b1f06 in clang::Preprocessor::Preprocessor(clang::PreprocessorOptions const&, clang::DiagnosticsEngine&, clang::LangOptions const&, clang::SourceManager&, clang::HeaderSearch&, clang::ModuleLoader&, clang::IdentifierInfoLookup*, bool, clang::TranslationUnitKind) (cpp2rust/build/cpp2rust/cpp2rust+0x1ef3f06) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #4 0x562f7315f0b3 in clang::CompilerInstance::createPreprocessor(clang::TranslationUnitKind) (cpp2rust/build/cpp2rust/cpp2rust+0xfa10b3) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #5 0x562f731422ed in clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&, clang::FrontendInputFile const&) (cpp2rust/build/cpp2rust/cpp2rust+0xf842ed) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #6 0x562f731625c4 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (cpp2rust/build/cpp2rust/cpp2rust+0xfa45c4) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #7 0x562f73b74818 in clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) (cpp2rust/build/cpp2rust/cpp2rust+0x19b6818) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #8 0x562f73b74502 in clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) (cpp2rust/build/cpp2rust/cpp2rust+0x19b6502) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #9 0x562f73b73330 in clang::tooling::ToolInvocation::run() (cpp2rust/build/cpp2rust/cpp2rust+0x19b5330) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #10 0x562f73b72aef in clang::tooling::runToolOnCodeWithArgs(std::unique_ptr<clang::FrontendAction, std::default_delete<clang::FrontendAction>>, llvm::Twine const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, llvm::Twine const&, llvm::Twine const&, std::shared_ptr<clang::PCHContainerOperations>) (cpp2rust/build/cpp2rust/cpp2rust+0x19b4aef) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #11 0x562f73b726ca in clang::tooling::runToolOnCodeWithArgs(std::unique_ptr<clang::FrontendAction, std::default_delete<clang::FrontendAction>>, llvm::Twine const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, llvm::Twine const&, llvm::Twine const&, std::shared_ptr<clang::PCHContainerOperations>, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>> const&) (cpp2rust/build/cpp2rust/cpp2rust+0x19b46ca) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #12 0x562f72a44091 in cpp2rust::TranspileSrc(std::basic_string_view<char, std::char_traits<char>>, cpp2rust::Model, std::vector<std::basic_string_view<char, std::char_traits<char>>, std::allocator<std::basic_string_view<char, std::char_traits<char>>>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) cpp2rust/cpp2rust/cpp2rust_lib.cpp:24:3
    #13 0x562f72a3c762 in main cpp2rust/cpp2rust/cpp2rust.cpp:153:13
    #14 0x7efc4e035ca7 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #15 0x7efc4e035d64 in __libc_start_main csu/../csu/libc-start.c:360:3
    #16 0x562f7269c6e0 in _start (cpp2rust/build/cpp2rust/cpp2rust+0x4de6e0) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)

0x7d0c4cfe7948 is located 72 bytes inside of 4096-byte region [0x7d0c4cfe7900,0x7d0c4cfe8900)
allocated by thread T0 here:
    #0 0x562f7277b236 in operator new(unsigned long, std::align_val_t, std::nothrow_t const&) (cpp2rust/build/cpp2rust/cpp2rust+0x5bd236) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #1 0x562f73bd7700 in llvm::allocate_buffer(unsigned long, unsigned long) (cpp2rust/build/cpp2rust/cpp2rust+0x1a19700) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)

SUMMARY: AddressSanitizer: use-after-poison (cpp2rust/build/cpp2rust/cpp2rust+0x581913) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd) in memcpy
Shadow bytes around the buggy address:
  0x7d0c4cfe7680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 fa
  0x7d0c4cfe7700: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x7d0c4cfe7780: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x7d0c4cfe7800: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x7d0c4cfe7880: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x7d0c4cfe7900: 00 00 00 04 f7 f7 f7 f7 f7[f7]f7 f7 f7 f7 f7 f7
  0x7d0c4cfe7980: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x7d0c4cfe7a00: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x7d0c4cfe7a80: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x7d0c4cfe7b00: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x7d0c4cfe7b80: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
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

Memory was manually poisoned by thread T0:
    #0 0x562f72743006 in __asan_poison_memory_region (cpp2rust/build/cpp2rust/cpp2rust+0x585006) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #1 0x562f727a775b in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::StartNewSlab() /usr/lib/llvm-22/include/llvm/Support/Allocator.h:351:5
    #2 0x562f727a775b in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::AllocateSlow(unsigned long, unsigned long, llvm::Align) /usr/lib/llvm-22/include/llvm/Support/Allocator.h:203:5
    #3 0x562f72a9a32c in std::pair<llvm::StringMapIterBase<clang::IdentifierInfo*, false>, bool> llvm::StringMap<clang::IdentifierInfo*, llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>>::try_emplace_with_hash<std::nullptr_t>(llvm::StringRef, unsigned int, std::nullptr_t&&) (cpp2rust/build/cpp2rust/cpp2rust+0x8dc32c) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #4 0x562f72a598fe in clang::IdentifierTable::get(llvm::StringRef) (cpp2rust/build/cpp2rust/cpp2rust+0x89b8fe) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #5 0x562f740b1ec7 in clang::Preprocessor::Preprocessor(clang::PreprocessorOptions const&, clang::DiagnosticsEngine&, clang::LangOptions const&, clang::SourceManager&, clang::HeaderSearch&, clang::ModuleLoader&, clang::IdentifierInfoLookup*, bool, clang::TranslationUnitKind) (cpp2rust/build/cpp2rust/cpp2rust+0x1ef3ec7) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #6 0x562f7315f0b3 in clang::CompilerInstance::createPreprocessor(clang::TranslationUnitKind) (cpp2rust/build/cpp2rust/cpp2rust+0xfa10b3) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #7 0x562f731422ed in clang::FrontendAction::BeginSourceFile(clang::CompilerInstance&, clang::FrontendInputFile const&) (cpp2rust/build/cpp2rust/cpp2rust+0xf842ed) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #8 0x562f731625c4 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (cpp2rust/build/cpp2rust/cpp2rust+0xfa45c4) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #9 0x562f73b74818 in clang::tooling::FrontendActionFactory::runInvocation(std::shared_ptr<clang::CompilerInvocation>, clang::FileManager*, std::shared_ptr<clang::PCHContainerOperations>, clang::DiagnosticConsumer*) (cpp2rust/build/cpp2rust/cpp2rust+0x19b6818) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #10 0x562f73b74502 in clang::tooling::ToolInvocation::runInvocation(char const*, clang::driver::Compilation*, std::shared_ptr<clang::CompilerInvocation>, std::shared_ptr<clang::PCHContainerOperations>) (cpp2rust/build/cpp2rust/cpp2rust+0x19b6502) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #11 0x562f73b73330 in clang::tooling::ToolInvocation::run() (cpp2rust/build/cpp2rust/cpp2rust+0x19b5330) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #12 0x562f73b72aef in clang::tooling::runToolOnCodeWithArgs(std::unique_ptr<clang::FrontendAction, std::default_delete<clang::FrontendAction>>, llvm::Twine const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, llvm::Twine const&, llvm::Twine const&, std::shared_ptr<clang::PCHContainerOperations>) (cpp2rust/build/cpp2rust/cpp2rust+0x19b4aef) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #13 0x562f73b726ca in clang::tooling::runToolOnCodeWithArgs(std::unique_ptr<clang::FrontendAction, std::default_delete<clang::FrontendAction>>, llvm::Twine const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&, llvm::Twine const&, llvm::Twine const&, std::shared_ptr<clang::PCHContainerOperations>, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>> const&) (cpp2rust/build/cpp2rust/cpp2rust+0x19b46ca) (BuildId: 25b8c303757a70546739b7503b43ad8b199f51fd)
    #14 0x562f72a44091 in cpp2rust::TranspileSrc(std::basic_string_view<char, std::char_traits<char>>, cpp2rust::Model, std::vector<std::basic_string_view<char, std::char_traits<char>>, std::allocator<std::basic_string_view<char, std::char_traits<char>>>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) cpp2rust/cpp2rust/cpp2rust_lib.cpp:24:3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions