Index: cmake/config-ix.cmake =================================================================== --- cmake/config-ix.cmake +++ cmake/config-ix.cmake @@ -267,7 +267,7 @@ set(ALL_MSAN_SUPPORTED_ARCH ${X86_64} mips64 mips64el) set(ALL_PROFILE_SUPPORTED_ARCH ${X86_64} i386 i686 ${ARM32} mips mips64 mipsel mips64el ${ARM64} powerpc64 powerpc64le) -set(ALL_TSAN_SUPPORTED_ARCH ${X86_64} mips64 mips64el) +set(ALL_TSAN_SUPPORTED_ARCH ${X86_64} mips64 mips64el ${ARM64}) set(ALL_UBSAN_SUPPORTED_ARCH ${X86_64} i386 i686 ${ARM32} ${ARM64} mips mipsel mips64 mips64el powerpc64 powerpc64le) set(ALL_SAFESTACK_SUPPORTED_ARCH ${X86_64} i386 i686) Index: lib/sanitizer_common/sanitizer_allocator.h =================================================================== --- lib/sanitizer_common/sanitizer_allocator.h +++ lib/sanitizer_common/sanitizer_allocator.h @@ -822,6 +822,10 @@ void PrintStats() { } + static uptr AdditionalSize() { + return 0; + } + typedef SizeClassMap SizeClassMapT; static const uptr kNumClasses = SizeClassMap::kNumClasses; Index: lib/sanitizer_common/sanitizer_platform.h =================================================================== --- lib/sanitizer_common/sanitizer_platform.h +++ lib/sanitizer_common/sanitizer_platform.h @@ -146,6 +146,8 @@ #if defined(__mips__) || (defined(__aarch64__) && SANITIZER_AARCH64_VMA == 39) # define SANITIZER_POINTER_FORMAT_LENGTH FIRST_32_SECOND_64(8, 10) +#elif defined(__aarch64__) && SANITIZER_AARCH64_VMA == 42 +# define SANITIZER_POINTER_FORMAT_LENGTH FIRST_32_SECOND_64(8, 11) #else # define SANITIZER_POINTER_FORMAT_LENGTH FIRST_32_SECOND_64(8, 12) #endif Index: lib/tsan/rtl/tsan_platform.h =================================================================== --- lib/tsan/rtl/tsan_platform.h +++ lib/tsan/rtl/tsan_platform.h @@ -87,6 +87,7 @@ const uptr kAppMemXor = 0x0400000000ull; const uptr kVdsoBeg = 0xfffff00000ull; #elif defined(__aarch64__) +# if SANITIZER_AARCH64_VMA == 39 /* C/C++ on linux/aarch64 (39-bit VMA) 0000 4000 00 - 0200 0000 00: main binary @@ -113,6 +114,37 @@ const uptr kAppMemMsk = 0x7800000000ull; const uptr kAppMemXor = 0x0800000000ull; const uptr kVdsoBeg = 0x7f00000000ull; +# elif SANITIZER_AARCH64_VMA == 42 +/* +C/C++ on linux/aarch64 (42-bit VMA) +00000 4000 00 - 01000 0000 00: main binary +01000 0000 00 - 10000 0000 00: - +10000 0000 00 - 20000 0000 00: shadow memory +20000 0000 00 - 26000 0000 00: - +26000 0000 00 - 28000 0000 00: metainfo +28000 0000 00 - 36200 0000 00: - +36200 0000 00 - 36240 0000 00: traces +36240 0000 00 - 3e000 0000 00: - +3e000 0000 00 - 3f000 0000 00: heap +3c000 0000 00 - 3ff00 0000 00: - +3ff00 0000 00 - 3ffff f000 00: modules and main thread stack +*/ +const uptr kLoAppMemBeg = 0x00000400000ull; +const uptr kLoAppMemEnd = 0x01000000000ull; +const uptr kShadowBeg = 0x10000000000ull; +const uptr kShadowEnd = 0x20000000000ull; +const uptr kMetaShadowBeg = 0x26000000000ull; +const uptr kMetaShadowEnd = 0x28000000000ull; +const uptr kTraceMemBeg = 0x36200000000ull; +const uptr kTraceMemEnd = 0x36400000000ull; +const uptr kHeapMemBeg = 0x3e000000000ull; +const uptr kHeapMemEnd = 0x3f000000000ull; +const uptr kHiAppMemBeg = 0x3ff00000000ull; +const uptr kHiAppMemEnd = 0x3fffff00000ull; +const uptr kAppMemMsk = 0x3c000000000ull; +const uptr kAppMemXor = 0x04000000000ull; +const uptr kVdsoBeg = 0x37f00000000ull; +# endif #endif ALWAYS_INLINE Index: lib/tsan/rtl/tsan_rtl.h =================================================================== --- lib/tsan/rtl/tsan_rtl.h +++ lib/tsan/rtl/tsan_rtl.h @@ -754,11 +754,7 @@ #ifndef SANITIZER_GO uptr ALWAYS_INLINE HeapEnd() { -#if SANITIZER_CAN_USE_ALLOCATOR64 return kHeapMemEnd + PrimaryAllocator::AdditionalSize(); -#else - return kHeapMemEnd; -#endif } #endif Index: test/tsan/ignore_lib0.cc =================================================================== --- test/tsan/ignore_lib0.cc +++ test/tsan/ignore_lib0.cc @@ -9,7 +9,7 @@ // suppression are ignored. // Some aarch64 kernels do not support non executable write pages -// XFAIL: aarch64 +// REQUIRES: stable-runtime #ifndef LIB Index: test/tsan/ignore_lib1.cc =================================================================== --- test/tsan/ignore_lib1.cc +++ test/tsan/ignore_lib1.cc @@ -8,7 +8,7 @@ // Tests that interceptors coming from a dynamically loaded library specified // in called_from_lib suppression are ignored. -// XFAIL: aarch64 +// REQUIRES: stable-runtime #ifndef LIB Index: test/tsan/ignore_lib3.cc =================================================================== --- test/tsan/ignore_lib3.cc +++ test/tsan/ignore_lib3.cc @@ -6,7 +6,7 @@ // causes program crash (this is not supported). // Some aarch64 kernels do not support non executable write pages -// XFAIL: aarch64 +// REQUIRES: stable-runtime #ifndef LIB Index: test/tsan/lit.cfg =================================================================== --- test/tsan/lit.cfg +++ test/tsan/lit.cfg @@ -63,3 +63,8 @@ # ThreadSanitizer tests are currently supported on FreeBSD and Linux only. if config.host_os not in ['FreeBSD', 'Linux']: config.unsupported = True + +# Allow tests to use REQUIRES=stable-runtime. For use when you cannot use XFAIL +# because the test hangs. +if config.target_arch != 'aarch64': + config.available_features.add('stable-runtime') Index: test/tsan/test.h =================================================================== --- test/tsan/test.h +++ test/tsan/test.h @@ -40,7 +40,19 @@ // to the format used in the diagnotic message. #ifdef __x86_64__ fprintf(stderr, "0x%012lx", (unsigned long) address); -#elif defined(__mips64) || defined(__aarch64__) +#elif defined(__mips64) fprintf(stderr, "0x%010lx", (unsigned long) address); +#elif defined(__aarch64__) + // AArch64 currently has 3 different VMA (39, 42, and 48 bits) and it require + // different pointer size to match the diagnostic message. + const char *format = NULL; + unsigned long vma = (unsigned long)__builtin_frame_address(0); + vma = 64 - __builtin_clzll(vma); + if (vma == 39) + format = "0x%010lx"; + else if (vma == 42) + format = "0x%011lx"; + + fprintf(stderr, format, (unsigned long) address); #endif }