[compiler-rt] r365554 - [TSan] Refine longjmp key management on Darwin
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 13:47:37 PDT 2019
Author: yln
Date: Tue Jul 9 13:47:37 2019
New Revision: 365554
URL: http://llvm.org/viewvc/llvm-project?rev=365554&view=rev
Log:
[TSan] Refine longjmp key management on Darwin
NFC.
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_platform_mac.cc
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_platform_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform_mac.cc?rev=365554&r1=365553&r2=365554&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_platform_mac.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_platform_mac.cc Tue Jul 9 13:47:37 2019
@@ -238,8 +238,7 @@ void InitializePlatformEarly() {
#endif
}
-static const uptr kPthreadSetjmpXorKeySlot = 0x7;
-extern "C" uptr __tsan_darwin_setjmp_xor_key = 0;
+static uptr longjmp_xor_key = 0;
void InitializePlatform() {
DisableCoreDumperIfNecessary();
@@ -254,8 +253,9 @@ void InitializePlatform() {
#endif
if (GetMacosVersion() >= MACOS_VERSION_MOJAVE) {
- __tsan_darwin_setjmp_xor_key =
- (uptr)pthread_getspecific(kPthreadSetjmpXorKeySlot);
+ // Libsystem currently uses a process-global key; this might change.
+ const unsigned kTLSLongjmpXorKeySlot = 0x7;
+ longjmp_xor_key = (uptr)pthread_getspecific(kTLSLongjmpXorKeySlot);
}
}
@@ -268,7 +268,8 @@ void InitializePlatform() {
uptr ExtractLongJmpSp(uptr *env) {
uptr mangled_sp = env[LONG_JMP_SP_ENV_SLOT];
- return mangled_sp ^ __tsan_darwin_setjmp_xor_key;
+ uptr sp = mangled_sp ^ longjmp_xor_key;
+ return sp;
}
#if !SANITIZER_GO
More information about the llvm-commits
mailing list