mirror of
https://github.com/intel/llvm.git
synced 2026-01-17 14:48:27 +08:00
[TSan] Support pointer authentication in setjmp/longjmp interceptors
arm64e adds support for pointer authentication, which was adopted by libplatform to harden setjmp/longjmp and friends. We need to teach the TSan interceptors for those functions about this. Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D76257
This commit is contained in:
@@ -41,6 +41,10 @@
|
||||
#include <errno.h>
|
||||
#include <sched.h>
|
||||
|
||||
#if __has_feature(ptrauth_calls)
|
||||
#include <ptrauth.h>
|
||||
#endif
|
||||
|
||||
namespace __tsan {
|
||||
|
||||
#if !SANITIZER_GO
|
||||
@@ -274,6 +278,10 @@ void InitializePlatform() {
|
||||
uptr ExtractLongJmpSp(uptr *env) {
|
||||
uptr mangled_sp = env[LONG_JMP_SP_ENV_SLOT];
|
||||
uptr sp = mangled_sp ^ longjmp_xor_key;
|
||||
#if __has_feature(ptrauth_calls)
|
||||
sp = (uptr)ptrauth_auth_data((void *)sp, ptrauth_key_asdb,
|
||||
ptrauth_string_discriminator("sp"));
|
||||
#endif
|
||||
return sp;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user