-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rtsan] Re-enable rtsan tests #98219
[rtsan] Re-enable rtsan tests #98219
Conversation
Created using spr 1.3.4
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Vitaly Buka (vitalybuka) ChangesDEPS llvm_gtest is not used by compiler-rt, This reverts commit e217f98. Full diff: https://github.com/llvm/llvm-project/pull/98219.diff 2 Files Affected:
diff --git a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
index c8bec41db36e9..bc152e304aaaf 100644
--- a/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
+++ b/compiler-rt/cmake/Modules/AllSupportedArchDefs.cmake
@@ -32,9 +32,9 @@ set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
${LOONGARCH64})
set(ALL_ASAN_ABI_SUPPORTED_ARCH ${X86_64} ${ARM64} ${ARM64_32})
set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${LOONGARCH64})
-#set(ALL_RTSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
-# ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
-# ${LOONGARCH64})
+set(ALL_RTSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${RISCV64}
+ ${MIPS32} ${MIPS64} ${PPC64} ${S390X} ${SPARC} ${SPARCV9} ${HEXAGON}
+ ${LOONGARCH64})
if(ANDROID)
set(OS_NAME "Android")
diff --git a/compiler-rt/lib/rtsan/tests/CMakeLists.txt b/compiler-rt/lib/rtsan/tests/CMakeLists.txt
index d96e538b255f4..a489719f09228 100644
--- a/compiler-rt/lib/rtsan/tests/CMakeLists.txt
+++ b/compiler-rt/lib/rtsan/tests/CMakeLists.txt
@@ -94,7 +94,6 @@ foreach(arch ${RTSAN_TEST_ARCH})
COMPILE_DEPS ${RTSAN_UNITTEST_HEADERS}
SOURCES ${RTSAN_NOINST_TEST_SOURCES}
${COMPILER_RT_GOOGLETEST_SOURCES}
- DEPS llvm_gtest
CFLAGS ${RTSAN_UNITTEST_CFLAGS}
LINK_FLAGS ${RTSAN_UNITTEST_LINK_FLAGS}
RUNTIME ${RTSAN_TEST_RUNTIME})
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also have the failure on fuchsia and windows as outlined here:
Fuchsia we can "fix" I believe via this patch that disables the problematic interceptors for now:
diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
index 3a65f9d3f779..ad9a97bdae7c 100644
--- a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
@@ -42,6 +42,8 @@ void ExpectNotRealtime(const char *intercepted_function_name) {
// Filesystem
+#if !SANITIZER_FUCHSIA
+
INTERCEPTOR(int, open, const char *path, int oflag, ...) {
// TODO Establish whether we should intercept here if the flag contains
// O_NONBLOCK
@@ -70,6 +72,8 @@ INTERCEPTOR(int, openat, int fd, const char *path, int oflag, ...) {
return result;
}
+#endif //!SANITIZER_FUCHSIA
+
INTERCEPTOR(int, creat, const char *path, mode_t mode) {
// TODO Establish whether we should intercept here if the flag contains
// O_NONBLOCK
@@ -359,8 +363,11 @@ void __rtsan::InitializeInterceptors() {
INTERCEPT_FUNCTION(pvalloc);
#endif
+#ifndef SANITIZER_FUCHSIA
INTERCEPT_FUNCTION(open);
INTERCEPT_FUNCTION(openat);
+#endif //SANITIZER_FUCHSIA
+
INTERCEPT_FUNCTION(close);
INTERCEPT_FUNCTION(fopen);
INTERCEPT_FUNCTION(fread);
diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
index f5b016089087..e250df41b53a 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors.cpp
@@ -172,6 +172,7 @@ TEST(TestRtsanInterceptors, NanosleepDiesWhenRealtime) {
Filesystem
*/
+#if !SANITIZER_FUCHSIA
TEST_F(RtsanFileTest, OpenDiesWhenRealtime) {
auto func = [this]() { open(GetTemporaryFilePath(), O_RDONLY); };
ExpectRealtimeDeath(func, "open");
@@ -197,6 +198,7 @@ TEST_F(RtsanFileTest, OpenCreatesFileWithProperMode) {
// Mask st_mode to get permission bits only
ASSERT_THAT(st.st_mode & 0777, Eq(mode));
}
+#endif // !SANITIZER_FUCHSIA
TEST_F(RtsanFileTest, CreatDiesWhenRealtime) {
auto func = [this]() { creat(GetTemporaryFilePath(), S_IWOTH | S_IROTH); };
Windows we can just disable the entire sanitizer. the guts rely on pthread, so there is no chance of it working at this point, possibly in the future
Sincere thanks for your help @vitalybuka , really appreciate it as an LLVM newbie |
Oh, as I remember fuchia does not have interceptors at all |
I think adding this patch would disable on windows and fuchsia, and we can evaluate in the future to enable them:
|
(to be clear, I don't have a windows or fuchsia machine to test this change on, please be as skeptical as possible - this is just based on the code I see around it, and trying out disabling Darwin) |
@@ -751,7 +751,8 @@ else() | |||
set(COMPILER_RT_HAS_ASAN FALSE) | |||
endif() | |||
|
|||
if (COMPILER_RT_HAS_SANITIZER_COMMON AND RTSAN_SUPPORTED_ARCH) | |||
if (COMPILER_RT_HAS_SANITIZER_COMMON AND RTSAN_SUPPORTED_ARCH AND | |||
OS_NAME MATCHES "Android|Darwin|Linux") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cjappl how about this and let motivated folks with access to those OSes to test and enable when needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me.
I believe we need to add the conditional check for COMPILER_RT_HAS_RTSAN in compiler-rt/lib/rtsan/CMakeLists.txt. We missed that in the first PR.
With that change, this should be good! I'm going to approve, assuming that you add that conditional in there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually rather limit to whatever you are willing to work in near future.
What is your platforms of interest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linux and Darwin are the platforms that we have easiest development access to in ubuntu and MacOS. I think starting there and building up would be just fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we need to add the conditional check for COMPILER_RT_HAS_RTSAN in compiler-rt/lib/rtsan/CMakeLists.txt. We missed that in the first PR.
COMPILER_RT_HAS_${} checked by root lib/ and test/ CMakeLists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See one last comment before submission, we need to wrap some cmake in the improved conditional.
Thanks again for the help. Do let me know if there are any more failures, I will keep an eye on my indbox
@@ -751,7 +751,8 @@ else() | |||
set(COMPILER_RT_HAS_ASAN FALSE) | |||
endif() | |||
|
|||
if (COMPILER_RT_HAS_SANITIZER_COMMON AND RTSAN_SUPPORTED_ARCH) | |||
if (COMPILER_RT_HAS_SANITIZER_COMMON AND RTSAN_SUPPORTED_ARCH AND | |||
OS_NAME MATCHES "Android|Darwin|Linux") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me.
I believe we need to add the conditional check for COMPILER_RT_HAS_RTSAN in compiler-rt/lib/rtsan/CMakeLists.txt. We missed that in the first PR.
With that change, this should be good! I'm going to approve, assuming that you add that conditional in there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Let me know if any more failures come up and I'm happy to help
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/95/builds/1044 Here is the relevant piece of the build log for the reference:
|
Looking at this error as we speak |
-lpthread ? |
Asan has append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread ASAN_UNITTEST_NOINST_LINK_FLAGS) ? |
As it does not reproduce for me, if you don't mind, I'll leave this one you? |
(llvm#98250)" This reverts commit 14f7450.
…98256) Follow up to #98219 This reverts commit [14f7450](14f7450) Ensure that -pthread is explicitly linked when running the rtsan tests. Issue this fixes: ``` FAILED: compiler-rt/lib/rtsan/tests/Rtsan-powerpc64le-NoInstTest /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/Rtsan-powerpc64le-NoInstTest cd /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests && /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./bin/clang++ RtsanNoInstTestObjects.rtsan_preinit.cpp.powerpc64le.o RtsanNoInstTestObjects.rtsan_test_context.cpp.powerpc64le.o RtsanNoInstTestObjects.rtsan_test_main.cpp.powerpc64le.o RtsanNoInstTestObjects.gtest-all.cc.powerpc64le.o RtsanNoInstTestObjects.gmock-all.cc.powerpc64le.o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/libRTRtsanTest.powerpc64le.a -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/./Rtsan-powerpc64le-NoInstTest -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -resource-dir=/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./lib/../lib/clang/19 -Wl,-rpath,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./lib/../lib/clang/19/lib/powerpc64le-unknown-linux-gnu -lstdc++ -no-pie -latomic -m64 -fno-function-sections /usr/bin/ld: RtsanNoInstTestObjects.gtest-all.cc.powerpc64le.o: undefined reference to symbol 'pthread_getspecific@@GLIBC_2.17' //usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line ```
I saw https://lab.llvm.org/buildbot/#/builders/41/builds/506 still failing, due to gtest crash. Let me disable again. (9ae24c9) |
Thanks @chapuni !! |
Follow up to llvm#92460 DEPS llvm_gtest is not used by compiler-rt, compiler-rt compiles them with COMPILER_RT_GOOGLETEST_SOURCES. This reverts commit e217f98.
…m#98250) New failures after llvm#98219
…lvm#98256) Follow up to llvm#98219 This reverts commit [14f7450](llvm@14f7450) Ensure that -pthread is explicitly linked when running the rtsan tests. Issue this fixes: ``` FAILED: compiler-rt/lib/rtsan/tests/Rtsan-powerpc64le-NoInstTest /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/Rtsan-powerpc64le-NoInstTest cd /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests && /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./bin/clang++ RtsanNoInstTestObjects.rtsan_preinit.cpp.powerpc64le.o RtsanNoInstTestObjects.rtsan_test_context.cpp.powerpc64le.o RtsanNoInstTestObjects.rtsan_test_main.cpp.powerpc64le.o RtsanNoInstTestObjects.gtest-all.cc.powerpc64le.o RtsanNoInstTestObjects.gmock-all.cc.powerpc64le.o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/libRTRtsanTest.powerpc64le.a -o /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/./Rtsan-powerpc64le-NoInstTest -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -resource-dir=/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./lib/../lib/clang/19 -Wl,-rpath,/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-test-suite/clang-ppc64le-test-suite/build/./lib/../lib/clang/19/lib/powerpc64le-unknown-linux-gnu -lstdc++ -no-pie -latomic -m64 -fno-function-sections /usr/bin/ld: RtsanNoInstTestObjects.gtest-all.cc.powerpc64le.o: undefined reference to symbol 'pthread_getspecific@@GLIBC_2.17' //usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line ```
Follow up to #92460
DEPS llvm_gtest is not used by compiler-rt,
compiler-rt compiles them with COMPILER_RT_GOOGLETEST_SOURCES.
This reverts commit e217f98.