Skip to content

msan tests FAIL on FreeBSD 14/amd64 #84482

Open
@rorth

Description

@rorth

When trying to build LLVM 18.1.0 on FreeBSD 14.0/amd64 with test-release.sh, the failure of two msan tests badly broke llvm-lits summary of the test results for the complete ninja check-all.

FAIL: MemorySanitizer-Unit :: ./Msan-x86_64-Test/5/9 (77408 of 97112)
FAIL: MemorySanitizer-Unit :: ./Msan-x86_64-with-call-Test/5/9 (77455 of 97112)

The primary problem with those failures is that both tests produce 0-byte *.json files, which cause llvm-lit to throw an exception and abort summarizing the run (will report that separately).

For both tests, the log shows

[...]
[ RUN      ] MemorySanitizer.m128
[       OK ] MemorySanitizer.m128 (0 ms)
[ RUN      ] MemorySanitizer.dlopenFailed
MemorySanitizer:DEADLYSIGNAL
==87117==ERROR: MemorySanitizer: SEGV on unknown address 0x000000000038 (pc 0x0000002ea290 bp 0x7fffffffe0b0 sp 0x7fffffffe020 T144217)
==87117==The signal is caused by a READ memory access.
==87117==Hint: address points to the zero page.
    #0 0x2ea290 in __sanitizer::ForEachMappedRegion(link_map*, void (*)(void const*, unsigned long)) /var/llvm/reltest/llvm-18.1.0/final/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp:1238:35
    #1 0x329424 in dlopen /var/llvm/reltest/llvm-18.1.0/final/llvm-project/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:6343:3
    #2 0x4910b0 in MemorySanitizer_dlopenFailed_Test::TestBody() /var/llvm/reltest/llvm-18.1.0/final/llvm-project/compiler-rt/lib/msan/tests/msan_test.cpp:3238:15
    #3 0x6901bc in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /var/llvm/reltest/llvm-18.1.0/final/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2612:10
    #4 0x6901bc in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) /var/llvm/reltest/llvm-18.1.0/final/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2648:14
    #5 0x68fc8c in testing::Test::Run() /var/llvm/reltest/llvm-18.1.0/final/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2687:5
    #6 0x6974ab in testing::TestInfo::Run() /var/llvm/reltest/llvm-18.1.0/final/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2836:11
    #7 0x69cbe6 in testing::TestSuite::Run() /var/llvm/reltest/llvm-18.1.0/final/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:3015:30
    #8 0x6fcd21 in testing::internal::UnitTestImpl::RunAllTests() /var/llvm/reltest/llvm-18.1.0/final/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:5920:44
    #9 0x6fa85b in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /var/llvm/reltest/llvm-18.1.0/final/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2612:10
    #10 0x6fa85b in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) /var/llvm/reltest/llvm-18.1.0/final/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2648:14
    #11 0x6f9f2e in testing::UnitTest::Run() /var/llvm/reltest/llvm-18.1.0/final/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:5484:10
    #12 0x603e4b in RUN_ALL_TESTS() /var/llvm/reltest/llvm-18.1.0/final/llvm-project/runtimes/../third-party/unittest/googletest/include/gtest/gtest.h:2317:73
    #13 0x603e4b in main /var/llvm/reltest/llvm-18.1.0/final/llvm-project/compiler-rt/lib/msan/tests/msan_test_main.cpp:19:10
    #14 0x800b7faf9 in __libc_start1 /usr/src/lib/libc/csu/libc_start1.c:157:7
    #15 0x2df13f in _start /usr/src/lib/csu/amd64/crt1_s.S:83

MemorySanitizer can not provide additional info.
SUMMARY: MemorySanitizer: SEGV /var/llvm/reltest/llvm-18.1.0/final/llvm-project/runtimes/../third-party/unittest/googletest/src/gtest.cc:2612:10 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*)
==87117==ABORTING

--
exit: 1
--
shard JSON output does not exist: /var/llvm/reltest/llvm-18.1.0/final/Phase3/Release/llvmCore-18.1.0-final.obj/runtimes/runtimes-bins/compiler-rt/lib/msan/tests/./Msan-x86_64-with-call-Test-MemorySanitizer-Unit-37844-5-9.json

To allow making any progress with the build/test at all, I've disabled msan on FreeBSD wholesale:

-- compiler-rt/cmake/config-ix.cmake.dist	2024-02-27 18:18:54.000000000 +0100
+++ compiler-rt/cmake/config-ix.cmake	2024-03-08 10:13:59.131220000 +0100
@@ -774,7 +774,7 @@ if (COMPILER_RT_HAS_SANITIZER_COMMON AND MSAN_SUPPORTE
 endif()
 
 if (COMPILER_RT_HAS_SANITIZER_COMMON AND MSAN_SUPPORTED_ARCH AND
-    OS_NAME MATCHES "Linux|FreeBSD|NetBSD")
+    OS_NAME MATCHES "Linux|NetBSD")
   set(COMPILER_RT_HAS_MSAN TRUE)
 else()
   set(COMPILER_RT_HAS_MSAN FALSE)

Just a hack, of course, but the alternative is worse (@DimitryAndric, @brooksdavis).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions