TSan doesn't seem to work on ppc64le with kernel-4.14: x.c: int main () { } # ./xgcc -B. -B ../powerpc64le-unknown-linux-gnu/libsanitizer/tsan/ -B ../powerpc64le-unknown-linux-gnu/libsanitizer/tsan/.libs/ -Wl,-rpath=../powerpc64le-unknown-linux-gnu/libsanitizer/tsan/.libs/ x.c -fsanitize=thread # ./a.out FATAL: ThreadSanitizer: unsupported VMA range FATAL: Found 47 - Supported 44 and 46 Target: powerpc64le-unknown-linux-gnu Configured with: /root/gcc/configure --enable-languages=c,c++ --enable-checking=yes -with-system-zlib --disable-bootstrap --disable-libvtv --disable-libitm --disable-libgomp --disable-libcc1 --disable-libstdcxx-pch --disable-libssp --disable-isl --disable-libmpx Thread model: posix gcc version 9.0.0 20180731 (experimental) (GCC)
Fixed on trunk in libsanitizer: https://reviews.llvm.org/D39924 Thus libsanitizer update will fix that.
I think we can just cherry-pick that to trunk and perhaps 8.3 too (for full merge from libsanitizer I'd rather wait for later, say October).
Created attachment 44482 [details] fix Fix I'm testing
We actually also need commit 4b8cb24bb7cf820f095b20edaa5812d4b78189a4 Author: Bill Seurer <seurer@linux.vnet.ibm.com> Date: Tue Nov 28 16:28:54 2017 +0000 [PowerPC][tsan] Update tsan to handle changed memory layouts in newer kernels In more recent Linux kernels with 47 bit VMAs the layout of virtual memory for powerpc64 changed causing the thread sanitizer to not work properly. This patch adds support for 47 bit VMA kernels for powerpc64. (second part) Tested on several 4.x and 3.x kernel releases. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319180 91177308-0d34-0410-b5e6-96231b3b80d8 diff --git a/lib/tsan/rtl/tsan_platform_linux.cc b/lib/tsan/rtl/tsan_platform_linux.cc index 216eef93c..e14d5f575 100644 --- a/lib/tsan/rtl/tsan_platform_linux.cc +++ b/lib/tsan/rtl/tsan_platform_linux.cc @@ -217,9 +217,9 @@ void InitializePlatformEarly() { Die(); } #elif defined(__powerpc64__) - if (vmaSize != 44 && vmaSize != 46) { + if (vmaSize != 44 && vmaSize != 46 && vmaSize != 47) { Printf("FATAL: ThreadSanitizer: unsupported VMA range\n"); - Printf("FATAL: Found %d - Supported 44 and 46\n", vmaSize); + Printf("FATAL: Found %d - Supported 44, 46, and 47\n", vmaSize); Die(); } #endif
Author: mpolacek Date: Wed Aug 1 17:17:29 2018 New Revision: 263229 URL: https://gcc.gnu.org/viewcvs?rev=263229&root=gcc&view=rev Log: Cherry-pick compiler-rt revision 318044 and 319180. [PowerPC][tsan] Update tsan to handle changed memory layouts in newer kernels In more recent Linux kernels with 47 bit VMAs the layout of virtual memory for powerpc64 changed causing the thread sanitizer to not work properly. This patch adds support for 47 bit VMA kernels for powerpc64. Tested on several 4.x and 3.x kernel releases. Regtested/bootstrapped on ppc64le-linux with kernel 4.14; applying to trunk/8.3. 2018-08-01 Marek Polacek <polacek@redhat.com> PR sanitizer/86759 * tsan/tsan_platform.h: Cherry-pick compiler-rt revision 318044. * tsan/tsan_platform_linux.cc: Cherry-pick compiler-rt revision 319180. Modified: trunk/libsanitizer/ChangeLog trunk/libsanitizer/tsan/tsan_platform.h trunk/libsanitizer/tsan/tsan_platform_linux.cc
Author: jakub Date: Wed Aug 1 18:17:29 2018 New Revision: 263231 URL: https://gcc.gnu.org/viewcvs?rev=263231&root=gcc&view=rev Log: PR sanitizer/86759 * tsan/tsan_platform.h: Cherry-pick compiler-rt revision 318044. * tsan/tsan_platform_linux.cc: Cherry-pick compiler-rt revision 319180. Modified: branches/gcc-8-branch/libsanitizer/ChangeLog branches/gcc-8-branch/libsanitizer/tsan/tsan_platform.h branches/gcc-8-branch/libsanitizer/tsan/tsan_platform_linux.cc
Fixed.