[compiler-rt] 2f856a3 - [msan] Blacklist __gxx_personality_v0.
Joel E. Denny via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 19 18:16:43 PST 2019
Thanks. That fixed it. Sorry, I should have thought to try that.
Joel
On Tue, Nov 19, 2019 at 5:24 PM Evgenii Stepanov <eugenis at google.com> wrote:
> Please try a clean build.
>
> On Tue, Nov 19, 2019 at 2:04 PM Joel E. Denny <jdenny.ornl at gmail.com>
> wrote:
>
>> Hi,
>>
>> This commit broke check-all for me:
>>
>> [5/13] Generating Msan-x86_64-Test
>> FAILED: projects/compiler-rt/lib/msan/tests/Msan-x86_64-Test
>> cd
>> /home/jdenny/ornl/llvm/llvm-mono-git-build/projects/compiler-rt/lib/msan/tests
>> && /home/jdenny/ornl/llvm/llvm-mono-git-build/./bin/clang
>> MSAN_INST_TEST_OBJECTS.msan_test.cpp.x86_64.o
>> MSAN_INST_TEST_OBJECTS.msan_test_main.cpp.x86_64.o
>> MSAN_INST_GTEST.gtest-all.cc.x86_64.o
>> /home/jdenny/ornl/llvm/llvm-mono-git-build/projects/compiler-rt/lib/msan/tests/../libcxx_msan_x86_64/lib//libc++.a
>> /home/jdenny/ornl/llvm/llvm-mono-git-build/projects/compiler-rt/lib/msan/tests/../libcxx_msan_x86_64/lib//libc++abi.a
>> -o
>> /home/jdenny/ornl/llvm/llvm-mono-git-build/projects/compiler-rt/lib/msan/tests/./Msan-x86_64-Test
>> -fuse-ld=lld -Wl,--color-diagnostics -Wl,-allow-shlib-undefined
>> -fsanitize=memory -ldl -m64 -m64
>> ld.lld: error: undefined symbol: __cxa_begin_catch
>>
>> I'm on an Ubuntu 18.04.3 system. Let me know if any other details are
>> needed.
>>
>> Thanks.
>>
>> Joel
>>
>> On Thu, Oct 31, 2019 at 1:23 PM Evgenii Stepanov via llvm-commits <
>> llvm-commits at lists.llvm.org> wrote:
>>
>>>
>>> Author: Evgenii Stepanov
>>> Date: 2019-10-31T10:22:52-07:00
>>> New Revision: 2f856a36e0b270b184051d10a18d4b4238b4c033
>>>
>>> URL:
>>> https://github.com/llvm/llvm-project/commit/2f856a36e0b270b184051d10a18d4b4238b4c033
>>> DIFF:
>>> https://github.com/llvm/llvm-project/commit/2f856a36e0b270b184051d10a18d4b4238b4c033.diff
>>>
>>> LOG: [msan] Blacklist __gxx_personality_v0.
>>>
>>> Summary:
>>> Fixes https://bugs.llvm.org/show_bug.cgi?id=31877.
>>> Fixes https://github.com/google/sanitizers/issues/1155.
>>>
>>> Enables exceptions in msan/tsan buid of libcxx, and in msan tests.
>>>
>>> -fdepfile-entry stuff is a workaround for
>>> https://reviews.llvm.org/D69290 (default blacklist missing from -MMD
>>> output).
>>>
>>> Reviewers: pcc, dvyukov
>>>
>>> Subscribers: mgorny, christof, #sanitizers, llvm-commits
>>>
>>> Tags: #sanitizers, #llvm
>>>
>>> Differential Revision: https://reviews.llvm.org/D69587
>>>
>>> Added:
>>>
>>>
>>> Modified:
>>> compiler-rt/cmake/Modules/AddCompilerRT.cmake
>>> compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt
>>> compiler-rt/lib/msan/CMakeLists.txt
>>> compiler-rt/lib/msan/msan_blacklist.txt
>>> compiler-rt/lib/msan/tests/CMakeLists.txt
>>> compiler-rt/lib/msan/tests/msan_test.cpp
>>>
>>> Removed:
>>>
>>>
>>>
>>>
>>> ################################################################################
>>> diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
>>> b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
>>> index 7c9505e66cec..b87ab6a91d42 100644
>>> --- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
>>> +++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
>>> @@ -623,6 +623,7 @@ macro(add_custom_libcxx name prefix)
>>> USES_TERMINAL_BUILD 1
>>> USES_TERMINAL_INSTALL 1
>>> EXCLUDE_FROM_ALL TRUE
>>> + BUILD_BYPRODUCTS "${prefix}/lib/libc++.a"
>>> "${prefix}/lib/libc++abi.a"
>>> )
>>>
>>> if (CMAKE_GENERATOR MATCHES "Make")
>>>
>>> diff --git a/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt
>>> b/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt
>>> index 3b1eb910ec86..e61c222587e6 100644
>>> --- a/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt
>>> +++ b/compiler-rt/cmake/Modules/CustomLibcxx/CMakeLists.txt
>>> @@ -4,7 +4,7 @@ project(custom-libcxx C CXX)
>>> # Build static libcxxabi.
>>> set(LIBCXXABI_STANDALONE_BUILD 1)
>>> set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
>>> -set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
>>> +set(LIBCXXABI_ENABLE_EXCEPTIONS ON CACHE BOOL "")
>>> set(LIBCXXABI_HERMETIC_STATIC_LIBRARY ON CACHE STRING "")
>>> set(LIBCXXABI_LIBCXX_PATH ${COMPILER_RT_LIBCXX_PATH} CACHE PATH "")
>>> set(LIBCXXABI_INCLUDE_TESTS OFF CACHE BOOL "")
>>>
>>> diff --git a/compiler-rt/lib/msan/CMakeLists.txt
>>> b/compiler-rt/lib/msan/CMakeLists.txt
>>> index 9e9bf6543932..86e96a01a118 100644
>>> --- a/compiler-rt/lib/msan/CMakeLists.txt
>>> +++ b/compiler-rt/lib/msan/CMakeLists.txt
>>> @@ -81,6 +81,7 @@ foreach(arch ${MSAN_SUPPORTED_ARCH})
>>> endforeach()
>>>
>>> add_compiler_rt_resource_file(msan_blacklist msan_blacklist.txt msan)
>>> +list(APPEND MSAN_RUNTIME_LIBRARIES msan_blacklist)
>>>
>>> if(COMPILER_RT_INCLUDE_TESTS)
>>> add_subdirectory(tests)
>>>
>>> diff --git a/compiler-rt/lib/msan/msan_blacklist.txt
>>> b/compiler-rt/lib/msan/msan_blacklist.txt
>>> index 44a5680d4d06..3efef5712185 100644
>>> --- a/compiler-rt/lib/msan/msan_blacklist.txt
>>> +++ b/compiler-rt/lib/msan/msan_blacklist.txt
>>> @@ -5,3 +5,6 @@
>>> # Example usage:
>>> # fun:*bad_function_name*
>>> # src:file_with_tricky_code.cc
>>> +
>>> +# https://bugs.llvm.org/show_bug.cgi?id=31877
>>> +fun:__gxx_personality_*
>>>
>>> diff --git a/compiler-rt/lib/msan/tests/CMakeLists.txt
>>> b/compiler-rt/lib/msan/tests/CMakeLists.txt
>>> index 9949e81a2c12..541356fc68d8 100644
>>> --- a/compiler-rt/lib/msan/tests/CMakeLists.txt
>>> +++ b/compiler-rt/lib/msan/tests/CMakeLists.txt
>>> @@ -8,7 +8,9 @@ include_directories(../..)
>>> set(MSAN_LIBCXX_CFLAGS
>>> -fsanitize=memory
>>> -fsanitize-memory-track-origins
>>> - -Wno-pedantic)
>>> + -Wno-pedantic
>>> + -Xclang
>>> -fdepfile-entry=${COMPILER_RT_OUTPUT_DIR}/share/msan_blacklist.txt
>>> + )
>>>
>>> # Unittest sources and build flags.
>>> set(MSAN_UNITTEST_SOURCES
>>> @@ -32,7 +34,6 @@ set(MSAN_UNITTEST_COMMON_CFLAGS
>>> -I${COMPILER_RT_SOURCE_DIR}/lib/msan
>>> -g
>>> -O2
>>> - -fno-exceptions
>>> -fno-omit-frame-pointer
>>> -mno-omit-leaf-frame-pointer
>>> -Wno-deprecated-declarations
>>> @@ -114,13 +115,14 @@ macro(add_msan_tests_for_arch arch kind cflags)
>>>
>>> set(MSAN_TEST_OBJECTS ${MSAN_INST_TEST_OBJECTS} ${MSAN_INST_GTEST})
>>> set(MSAN_TEST_DEPS ${MSAN_TEST_OBJECTS} libcxx_msan_${arch}-build
>>> - ${MSAN_LOADABLE_SO})
>>> + ${MSAN_LOADABLE_SO}
>>> + "${MSAN_LIBCXX_DIR}/libc++.a"
>>> "${MSAN_LIBCXX_DIR}/libc++abi.a")
>>> if(NOT COMPILER_RT_STANDALONE_BUILD)
>>> list(APPEND MSAN_TEST_DEPS msan)
>>> endif()
>>> get_target_flags_for_arch(${arch} TARGET_LINK_FLAGS)
>>> add_compiler_rt_test(MsanUnitTests "Msan-${arch}${kind}-Test" ${arch}
>>> - OBJECTS ${MSAN_TEST_OBJECTS} "${MSAN_LIBCXX_DIR}/libc++.a"
>>> + OBJECTS ${MSAN_TEST_OBJECTS} "${MSAN_LIBCXX_DIR}/libc++.a"
>>> "${MSAN_LIBCXX_DIR}/libc++abi.a"
>>> DEPS ${MSAN_TEST_DEPS}
>>> LINK_FLAGS ${MSAN_UNITTEST_LINK_FLAGS}
>>> ${TARGET_LINK_FLAGS})
>>>
>>> diff --git a/compiler-rt/lib/msan/tests/msan_test.cpp
>>> b/compiler-rt/lib/msan/tests/msan_test.cpp
>>> index c1cae3dad1fc..2d67b6ff645a 100644
>>> --- a/compiler-rt/lib/msan/tests/msan_test.cpp
>>> +++ b/compiler-rt/lib/msan/tests/msan_test.cpp
>>> @@ -4798,3 +4798,32 @@ TEST(MemorySanitizer, Bmi) {
>>> }
>>> }
>>> #endif // defined(__x86_64__)
>>> +
>>> +namespace {
>>> +volatile long z;
>>> +
>>> +__attribute__((noinline,optnone)) void f(long a, long b, long c, long
>>> d, long e, long f) {
>>> + z = a + b + c + d + e + f;
>>> +}
>>> +
>>> +__attribute__((noinline,optnone)) void throw_stuff() {
>>> + throw 5;
>>> +}
>>> +
>>> +TEST(MemorySanitizer, throw_catch) {
>>> + long x;
>>> + // Poison __msan_param_tls.
>>> + __msan_poison(&x, sizeof(x));
>>> + f(x, x, x, x, x, x);
>>> + try {
>>> + // This calls __gxx_personality_v0 through some libgcc_s function.
>>> + // __gxx_personality_v0 is instrumented, libgcc_s is not; as a
>>> result,
>>> + // __msan_param_tls is not updated and __gxx_personality_v0 can find
>>> + // leftover poison from the previous call.
>>> + // A suppression in msan_blacklist.txt makes it work.
>>> + throw_stuff();
>>> + } catch (const int &e) {
>>> + // pass
>>> + }
>>> +}
>>> +} // namespace
>>>
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191119/cc5f7ebe/attachment.html>
More information about the llvm-commits
mailing list