Skip to content

Commit

Permalink
Revert "Move the sanitizer build from LLVM 18 to 19"
Browse files Browse the repository at this point in the history
This reverts commit a67c5e8.

LLVM 19 has use-after-poison errors under ASAN inside of ClangTool:

==95109==ERROR: AddressSanitizer: use-after-poison on address 0x62100000291a at pc 0x00010994cffc bp 0x00016d742690 sp 0x00016d741e40
WRITE of size 13 at 0x62100000291a thread T0
    #0 0x00010994cff8 in memcpy+0x4c0 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x50ff8)
    #1 0x0001050b7f68 in llvm::StringSaver::save(llvm::Twine const&)+0xf4 (subdoc_unittests:arm64+0x1029fff68)
    #2 0x000102ffc1c8 in void llvm::function_ref<void (llvm::Twine const&)>::callback_fn<clang::CompilerInvocationBase::generateCC1CommandLine(llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>) const::'lambda'(llvm::Twine const&)>(long, llvm::Twine const&)+0x2c (subdoc_unittests:arm64+0x1009441c8)
    #3 0x000102fba4e4 in clang::CompilerInvocationBase::GenerateDiagnosticArgs(clang::DiagnosticOptions const&, llvm::function_ref<void (llvm::Twine const&)>, bool)+0x9d4 (subdoc_unittests:arm64+0x1009024e4)
    #4 0x000102fe47b0 in clang::CompilerInvocationBase::generateCC1CommandLine(llvm::function_ref<void (llvm::Twine const&)>) const+0xe80 (subdoc_unittests:arm64+0x10092c7b0)
    #5 0x000102ffd914 in void llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>::callback_fn<clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)::$_1>(long, clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)+0x64 (subdoc_unittests:arm64+0x100945914)
    #6 0x000102fa0554 in RoundTrip(llvm::function_ref<bool (clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)>, llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>, clang::CompilerInvocation&, clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*, bool, bool)+0x358 (subdoc_unittests:arm64+0x1008e8554)
    #7 0x000102fe07d0 in clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)+0x64 (subdoc_unittests:arm64+0x1009287d0)
    #8 0x000102f5f85c in clang::tooling::ToolInvocation::run()+0x364 (subdoc_unittests:arm64+0x1008a785c)
    #9 0x000102f625f8 in clang::tooling::ClangTool::run(clang::tooling::ToolAction*)+0xd40 (subdoc_unittests:arm64+0x1008aa5f8)
    #10 0x000102d428a8 in subdoc::run_files(clang::tooling::CompilationDatabase const&, sus::collections::Vec<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, subdoc::RunOptions const&)+0x750 (subdoc_unittests:arm64+0x10068a8a8)
    #11 0x000102d41a84 in subdoc::run_test(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, sus::collections::Slice<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, subdoc::RunOptions const&)+0x6b8 (subdoc_unittests:arm64+0x100689a84)
    #12 0x00010276b63c in SubDocTest::run_code_with_options(subdoc::RunOptions const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)+0x2ec (subdoc_unittests:arm64+0x1000b363c)
    #13 0x00010276af98 in SubDocTest::run_code(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)+0x2b8 (subdoc_unittests:arm64+0x1000b2f98)
    #14 0x0001027f75a0 in SubDocTest_NamespaceNested_Test::TestBody()+0x2b8 (subdoc_unittests:arm64+0x10013f5a0)
    #15 0x0001092a242c in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)+0xc8 (libgtest.1.13.0.dylib:arm64+0x10a42c)
    #16 0x0001091d9234 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)+0x1a0 (libgtest.1.13.0.dylib:arm64+0x41234)
    #17 0x0001091d8fe0 in testing::Test::Run()+0x18c (libgtest.1.13.0.dylib:arm64+0x40fe0)
    #18 0x0001091db5a4 in testing::TestInfo::Run()+0x46c (libgtest.1.13.0.dylib:arm64+0x435a4)
    #19 0x0001091ddeb0 in testing::TestSuite::Run()+0x3f8 (libgtest.1.13.0.dylib:arm64+0x45eb0)
    #20 0x0001091ff73c in testing::internal::UnitTestImpl::RunAllTests()+0xa60 (libgtest.1.13.0.dylib:arm64+0x6773c)
    #21 0x0001092a3a2c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)+0xc8 (libgtest.1.13.0.dylib:arm64+0x10ba2c)
    #22 0x0001091fe85c in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*)+0x1a0 (libgtest.1.13.0.dylib:arm64+0x6685c)
    #23 0x0001091fe47c in testing::UnitTest::Run()+0x244 (libgtest.1.13.0.dylib:arm64+0x6647c)
    #24 0x000102ba685c in RUN_ALL_TESTS()+0xc (subdoc_unittests:arm64+0x1004ee85c)
    #25 0x000102ba5bd4 in main+0x2bc (subdoc_unittests:arm64+0x1004edbd4)
    #26 0x00019643f150  (<unknown module>)
    #27 0xa2187ffffffffffc  (<unknown module>)

0x62100000291a is located 26 bytes inside of 4096-byte region [0x621000002900,0x621000003900)
allocated by thread T0 here:
    #0 0x00010994f944 in __sanitizer_mz_memalign+0x78 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x53944)
    #1 0x0001966041bc in _malloc_zone_memalign+0x138 (libsystem_malloc.dylib:arm64+0x2c1bc)
    #2 0xf071800196782cd4  (<unknown module>)
    #3 0x1510000102a3830c  (<unknown module>)
    #4 0x000102a38714 in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::StartNewSlab()+0x4c (subdoc_unittests:arm64+0x100380714)
    #5 0x000102a38070 in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul, 128ul>::AllocateSlow(unsigned long, unsigned long, llvm::Align)+0x2d0 (subdoc_unittests:arm64+0x100380070)
    #6 0x0001050b7fe8 in llvm::StringSaver::save(llvm::Twine const&)+0x174 (subdoc_unittests:arm64+0x1029fffe8)
    #7 0x000102ffc1c8 in void llvm::function_ref<void (llvm::Twine const&)>::callback_fn<clang::CompilerInvocationBase::generateCC1CommandLine(llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>) const::'lambda'(llvm::Twine const&)>(long, llvm::Twine const&)+0x2c (subdoc_unittests:arm64+0x1009441c8)
    #8 0x000102feb5e4 in denormalizeStringImpl(llvm::function_ref<void (llvm::Twine const&)>, llvm::Twine const&, llvm::opt::Option::OptionClass, unsigned int, llvm::Twine const&)+0xb0 (subdoc_unittests:arm64+0x1009335e4)
    #9 0x000102feb884 in denormalizeStringVector(llvm::function_ref<void (llvm::Twine const&)>, llvm::Twine const&, llvm::opt::Option::OptionClass, unsigned int, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&)+0x1b4 (subdoc_unittests:arm64+0x100933884)
    #10 0x000102fb9d74 in clang::CompilerInvocationBase::GenerateDiagnosticArgs(clang::DiagnosticOptions const&, llvm::function_ref<void (llvm::Twine const&)>, bool)+0x264 (subdoc_unittests:arm64+0x100901d74)
    #11 0x000102fe47b0 in clang::CompilerInvocationBase::generateCC1CommandLine(llvm::function_ref<void (llvm::Twine const&)>) const+0xe80 (subdoc_unittests:arm64+0x10092c7b0)
    #12 0x000102ffd914 in void llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>::callback_fn<clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)::$_1>(long, clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)+0x64 (subdoc_unittests:arm64+0x100945914)
    #13 0x000102fa0554 in RoundTrip(llvm::function_ref<bool (clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)>, llvm::function_ref<void (clang::CompilerInvocation&, llvm::SmallVectorImpl<char const*>&, llvm::function_ref<char const* (llvm::Twine const&)>)>, clang::CompilerInvocation&, clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*, bool, bool)+0x358 (subdoc_unittests:arm64+0x1008e8554)
    #14 0x000102fe07d0 in clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, llvm::ArrayRef<char const*>, clang::DiagnosticsEngine&, char const*)+0x64 (subdoc_unittests:arm64+0x1009287d0)
    #15 0x000102f5f85c in clang::tooling::ToolInvocation::run()+0x364 (subdoc_unittests:arm64+0x1008a785c)
    #16 0x000102f625f8 in clang::tooling::ClangTool::run(clang::tooling::ToolAction*)+0xd40 (subdoc_unittests:arm64+0x1008aa5f8)
    #17 0x000102d428a8 in subdoc::run_files(clang::tooling::CompilationDatabase const&, sus::collections::Vec<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, subdoc::RunOptions const&)+0x750 (subdoc_unittests:arm64+0x10068a8a8)
    #18 0x000102d41a84 in subdoc::run_test(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, sus::collections::Slice<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>, subdoc::RunOptions const&)+0x6b8 (subdoc_unittests:arm64+0x100689a84)

It's not immediately obvious what is wrong, maybe a bug in StringSaver.
The StringSaver itself should be on the stack still, I think.
  • Loading branch information
danakj committed Dec 29, 2024
1 parent 2af9134 commit fce12ae
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/try.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,20 @@ jobs:
clang_version: 18,
installed_clang_version: 16
}

- {
name: "Ubuntu Clang-19 Debug",
name: "Ubuntu Clang-18 Sanitizer",
os: ubuntu-latest,
build_type: "Debug",
cc: "clang-19",
cxx: "clang++-19",
clang_version: 19,
build_type: "Release",
cc: "clang-18",
cxx: "clang++-18",
clang_version: 18,
installed_clang_version: 16
}

- {
name: "Ubuntu Clang-19 Sanitizer",
name: "Ubuntu Clang-19 Debug",
os: ubuntu-latest,
build_type: "Release",
build_type: "Debug",
cc: "clang-19",
cxx: "clang++-19",
clang_version: 19,
Expand Down

0 comments on commit fce12ae

Please sign in to comment.