sanitizer_platform_limits_solaris.h
sanitizer_posix.h
sanitizer_procmaps.h
+ sanitizer_ptrauth.h
sanitizer_quarantine.h
sanitizer_report_decorator.h
sanitizer_ring_buffer.h
#include "sanitizer_placement_new.h"
#include "sanitizer_platform_limits_posix.h"
#include "sanitizer_procmaps.h"
+#include "sanitizer_ptrauth.h"
#if !SANITIZER_IOS
#include <crt_externs.h> // for _NSGetEnviron
return si->si_signo == SIGSEGV && si->si_code != 0;
}
-#if __has_feature(ptrauth_calls)
-# include <ptrauth.h>
-#else
-# define ptrauth_strip(value, key) (value)
-#endif
-
#if defined(__aarch64__) && defined(arm_thread_state64_get_sp)
#define AARCH64_GET_REG(r) \
(uptr)ptrauth_strip( \
--- /dev/null
+//===-- sanitizer_ptrauth.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SANITIZER_PTRAUTH_H
+#define SANITIZER_PTRAUTH_H
+
+#if __has_feature(ptrauth_calls)
+#include <ptrauth.h>
+#else
+// Copied from <ptrauth.h>
+#define ptrauth_strip(__value, __key) __value
+#define ptrauth_auth_data(__value, __old_key, __old_data) __value
+#define ptrauth_string_discriminator(__string) ((int)0)
+#endif
+
+#endif // SANITIZER_PTRAUTH_H
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_posix.h"
#include "sanitizer_common/sanitizer_procmaps.h"
+#include "sanitizer_common/sanitizer_ptrauth.h"
#include "sanitizer_common/sanitizer_stackdepot.h"
#include "tsan_platform.h"
#include "tsan_rtl.h"
#include <errno.h>
#include <sched.h>
-#if __has_feature(ptrauth_calls)
-#include <ptrauth.h>
-#endif
-
namespace __tsan {
#if !SANITIZER_GO
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;
}
#include "ubsan_type_hash.h"
#include "sanitizer_common/sanitizer_common.h"
-
-#if __has_feature(ptrauth_calls)
-#include <ptrauth.h>
-#endif
+#include "sanitizer_common/sanitizer_ptrauth.h"
// The following are intended to be binary compatible with the definitions
// given in the Itanium ABI. We make no attempt to be ODR-compatible with
std::type_info *TypeInfo;
};
VtablePrefix *getVtablePrefix(void *Vtable) {
-#if __has_feature(ptrauth_calls)
Vtable = ptrauth_auth_data(Vtable, ptrauth_key_cxx_vtable_pointer, 0);
-#endif
VtablePrefix *Vptr = reinterpret_cast<VtablePrefix*>(Vtable);
VtablePrefix *Prefix = Vptr - 1;
if (!IsAccessibleMemoryRange((uptr)Prefix, sizeof(VtablePrefix)))