File tree Expand file tree Collapse file tree 5 files changed +25
-18
lines changed Expand file tree Collapse file tree 5 files changed +25
-18
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,7 @@ set(SANITIZER_IMPL_HEADERS
164
164
sanitizer_platform_limits_solaris.h
165
165
sanitizer_posix.h
166
166
sanitizer_procmaps.h
167
+ sanitizer_ptrauth.h
167
168
sanitizer_quarantine.h
168
169
sanitizer_report_decorator.h
169
170
sanitizer_ring_buffer.h
Original file line number Diff line number Diff line change 30
30
#include " sanitizer_placement_new.h"
31
31
#include " sanitizer_platform_limits_posix.h"
32
32
#include " sanitizer_procmaps.h"
33
+ #include " sanitizer_ptrauth.h"
33
34
34
35
#if !SANITIZER_IOS
35
36
#include < crt_externs.h> // for _NSGetEnviron
@@ -765,12 +766,6 @@ bool SignalContext::IsTrueFaultingAddress() const {
765
766
return si->si_signo == SIGSEGV && si->si_code != 0 ;
766
767
}
767
768
768
- #if __has_feature(ptrauth_calls)
769
- # include < ptrauth.h>
770
- #else
771
- # define ptrauth_strip (value, key ) (value)
772
- #endif
773
-
774
769
#if defined(__aarch64__) && defined(arm_thread_state64_get_sp)
775
770
#define AARCH64_GET_REG (r ) \
776
771
(uptr)ptrauth_strip( \
Original file line number Diff line number Diff line change
1
+ // ===-- sanitizer_ptrauth.h -------------------------------------*- C++ -*-===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+
9
+ #ifndef SANITIZER_PTRAUTH_H
10
+ #define SANITIZER_PTRAUTH_H
11
+
12
+ #if __has_feature(ptrauth_calls)
13
+ #include < ptrauth.h>
14
+ #else
15
+ // Copied from <ptrauth.h>
16
+ #define ptrauth_strip (__value, __key ) __value
17
+ #define ptrauth_auth_data (__value, __old_key, __old_data ) __value
18
+ #define ptrauth_string_discriminator (__string ) ((int )0 )
19
+ #endif
20
+
21
+ #endif // SANITIZER_PTRAUTH_H
Original file line number Diff line number Diff line change 19
19
#include " sanitizer_common/sanitizer_libc.h"
20
20
#include " sanitizer_common/sanitizer_posix.h"
21
21
#include " sanitizer_common/sanitizer_procmaps.h"
22
+ #include " sanitizer_common/sanitizer_ptrauth.h"
22
23
#include " sanitizer_common/sanitizer_stackdepot.h"
23
24
#include " tsan_platform.h"
24
25
#include " tsan_rtl.h"
41
42
#include < errno.h>
42
43
#include < sched.h>
43
44
44
- #if __has_feature(ptrauth_calls)
45
- #include < ptrauth.h>
46
- #endif
47
-
48
45
namespace __tsan {
49
46
50
47
#if !SANITIZER_GO
@@ -278,10 +275,8 @@ void InitializePlatform() {
278
275
uptr ExtractLongJmpSp (uptr *env) {
279
276
uptr mangled_sp = env[LONG_JMP_SP_ENV_SLOT];
280
277
uptr sp = mangled_sp ^ longjmp_xor_key;
281
- #if __has_feature(ptrauth_calls)
282
278
sp = (uptr)ptrauth_auth_data ((void *)sp, ptrauth_key_asdb,
283
279
ptrauth_string_discriminator (" sp" ));
284
- #endif
285
280
return sp;
286
281
}
287
282
Original file line number Diff line number Diff line change 16
16
#include " ubsan_type_hash.h"
17
17
18
18
#include " sanitizer_common/sanitizer_common.h"
19
-
20
- #if __has_feature(ptrauth_calls)
21
- #include < ptrauth.h>
22
- #endif
19
+ #include " sanitizer_common/sanitizer_ptrauth.h"
23
20
24
21
// The following are intended to be binary compatible with the definitions
25
22
// given in the Itanium ABI. We make no attempt to be ODR-compatible with
@@ -198,9 +195,7 @@ struct VtablePrefix {
198
195
std::type_info *TypeInfo;
199
196
};
200
197
VtablePrefix *getVtablePrefix (void *Vtable) {
201
- #if __has_feature(ptrauth_calls)
202
198
Vtable = ptrauth_auth_data (Vtable, ptrauth_key_cxx_vtable_pointer, 0 );
203
- #endif
204
199
VtablePrefix *Vptr = reinterpret_cast <VtablePrefix*>(Vtable);
205
200
VtablePrefix *Prefix = Vptr - 1 ;
206
201
if (!IsAccessibleMemoryRange ((uptr)Prefix, sizeof (VtablePrefix)))
You can’t perform that action at this time.
0 commit comments