forked from OSchip/llvm-project
[TSan] Refine longjmp key management on Darwin
NFC. llvm-svn: 365554
This commit is contained in:
parent
9abe8c4805
commit
c11c43b64f
|
@ -238,8 +238,7 @@ void InitializePlatformEarly() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uptr kPthreadSetjmpXorKeySlot = 0x7;
|
static uptr longjmp_xor_key = 0;
|
||||||
extern "C" uptr __tsan_darwin_setjmp_xor_key = 0;
|
|
||||||
|
|
||||||
void InitializePlatform() {
|
void InitializePlatform() {
|
||||||
DisableCoreDumperIfNecessary();
|
DisableCoreDumperIfNecessary();
|
||||||
|
@ -254,8 +253,9 @@ void InitializePlatform() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (GetMacosVersion() >= MACOS_VERSION_MOJAVE) {
|
if (GetMacosVersion() >= MACOS_VERSION_MOJAVE) {
|
||||||
__tsan_darwin_setjmp_xor_key =
|
// Libsystem currently uses a process-global key; this might change.
|
||||||
(uptr)pthread_getspecific(kPthreadSetjmpXorKeySlot);
|
const unsigned kTLSLongjmpXorKeySlot = 0x7;
|
||||||
|
longjmp_xor_key = (uptr)pthread_getspecific(kTLSLongjmpXorKeySlot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,8 @@ void InitializePlatform() {
|
||||||
|
|
||||||
uptr ExtractLongJmpSp(uptr *env) {
|
uptr ExtractLongJmpSp(uptr *env) {
|
||||||
uptr mangled_sp = env[LONG_JMP_SP_ENV_SLOT];
|
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
|
#if !SANITIZER_GO
|
||||||
|
|
Loading…
Reference in New Issue