xref: /xnu-11215.1.10/bsd/dev/dtrace/scripts/ptrauth_arm64.d (revision 8d741a5de7ff4191bf97d57b9f54c2f6d4a15585)
1*8d741a5dSApple OSS Distributions /*
2*8d741a5dSApple OSS Distributions  * Copyright (c) 2019 Apple Computer, Inc. All rights reserved.
3*8d741a5dSApple OSS Distributions  *
4*8d741a5dSApple OSS Distributions  * @APPLE_LICENSE_HEADER_START@
5*8d741a5dSApple OSS Distributions  *
6*8d741a5dSApple OSS Distributions  * The contents of this file constitute Original Code as defined in and
7*8d741a5dSApple OSS Distributions  * are subject to the Apple Public Source License Version 1.1 (the
8*8d741a5dSApple OSS Distributions  * "License").  You may not use this file except in compliance with the
9*8d741a5dSApple OSS Distributions  * License.  Please obtain a copy of the License at
10*8d741a5dSApple OSS Distributions  * http://www.apple.com/publicsource and read it before using this file.
11*8d741a5dSApple OSS Distributions  *
12*8d741a5dSApple OSS Distributions  * This Original Code and all software distributed under the License are
13*8d741a5dSApple OSS Distributions  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14*8d741a5dSApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15*8d741a5dSApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16*8d741a5dSApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
17*8d741a5dSApple OSS Distributions  * License for the specific language governing rights and limitations
18*8d741a5dSApple OSS Distributions  * under the License.
19*8d741a5dSApple OSS Distributions  *
20*8d741a5dSApple OSS Distributions  * @APPLE_LICENSE_HEADER_END@
21*8d741a5dSApple OSS Distributions  */
22*8d741a5dSApple OSS Distributions 
23*8d741a5dSApple OSS Distributions enum ptrauth_key {
24*8d741a5dSApple OSS Distributions   ptrauth_key_asia = 0,
25*8d741a5dSApple OSS Distributions   ptrauth_key_asib = 1,
26*8d741a5dSApple OSS Distributions   ptrauth_key_asda = 2,
27*8d741a5dSApple OSS Distributions   ptrauth_key_asdb = 3,
28*8d741a5dSApple OSS Distributions 
29*8d741a5dSApple OSS Distributions   /* A process-independent key which can be used to sign code pointers.
30*8d741a5dSApple OSS Distributions      Signing and authenticating with this key is a no-op in processes
31*8d741a5dSApple OSS Distributions      which disable ABI pointer authentication. */
32*8d741a5dSApple OSS Distributions   ptrauth_key_process_independent_code = ptrauth_key_asia,
33*8d741a5dSApple OSS Distributions 
34*8d741a5dSApple OSS Distributions   /* A process-specific key which can be used to sign code pointers.
35*8d741a5dSApple OSS Distributions      Signing and authenticating with this key is enforced even in processes
36*8d741a5dSApple OSS Distributions      which disable ABI pointer authentication. */
37*8d741a5dSApple OSS Distributions   ptrauth_key_process_dependent_code = ptrauth_key_asib,
38*8d741a5dSApple OSS Distributions 
39*8d741a5dSApple OSS Distributions   /* A process-independent key which can be used to sign data pointers.
40*8d741a5dSApple OSS Distributions      Signing and authenticating with this key is a no-op in processes
41*8d741a5dSApple OSS Distributions      which disable ABI pointer authentication. */
42*8d741a5dSApple OSS Distributions   ptrauth_key_process_independent_data = ptrauth_key_asda,
43*8d741a5dSApple OSS Distributions 
44*8d741a5dSApple OSS Distributions   /* A process-specific key which can be used to sign data pointers.
45*8d741a5dSApple OSS Distributions      Signing and authenticating with this key is a no-op in processes
46*8d741a5dSApple OSS Distributions      which disable ABI pointer authentication. */
47*8d741a5dSApple OSS Distributions   ptrauth_key_process_dependent_data = ptrauth_key_asdb,
48*8d741a5dSApple OSS Distributions 
49*8d741a5dSApple OSS Distributions   /* The key used to sign C function pointers.
50*8d741a5dSApple OSS Distributions      The extra data is always 0. */
51*8d741a5dSApple OSS Distributions   ptrauth_key_function_pointer = ptrauth_key_process_independent_code,
52*8d741a5dSApple OSS Distributions 
53*8d741a5dSApple OSS Distributions   /* The key used to sign return addresses on the stack.
54*8d741a5dSApple OSS Distributions      The extra data is based on the storage address of the return address.
55*8d741a5dSApple OSS Distributions      On ARM64, that is always the storage address of the return address plus 8
56*8d741a5dSApple OSS Distributions      (or, in other words, the value of the stack pointer on function entry) */
57*8d741a5dSApple OSS Distributions   ptrauth_key_return_address = ptrauth_key_process_dependent_code,
58*8d741a5dSApple OSS Distributions 
59*8d741a5dSApple OSS Distributions   /* The key used to sign frame pointers on the stack.
60*8d741a5dSApple OSS Distributions      The extra data is based on the storage address of the frame pointer.
61*8d741a5dSApple OSS Distributions      On ARM64, that is always the storage address of the frame pointer plus 16
62*8d741a5dSApple OSS Distributions      (or, in other words, the value of the stack pointer on function entry) */
63*8d741a5dSApple OSS Distributions   ptrauth_key_frame_pointer = ptrauth_key_process_dependent_data,
64*8d741a5dSApple OSS Distributions 
65*8d741a5dSApple OSS Distributions   /* The key used to sign block function pointers, including:
66*8d741a5dSApple OSS Distributions        invocation functions,
67*8d741a5dSApple OSS Distributions        block object copy functions,
68*8d741a5dSApple OSS Distributions        block object destroy functions,
69*8d741a5dSApple OSS Distributions        __block variable copy functions, and
70*8d741a5dSApple OSS Distributions        __block variable destroy functions.
71*8d741a5dSApple OSS Distributions      The extra data is always the address at which the function pointer
72*8d741a5dSApple OSS Distributions      is stored.
73*8d741a5dSApple OSS Distributions 
74*8d741a5dSApple OSS Distributions      Note that block object pointers themselves (i.e. the direct
75*8d741a5dSApple OSS Distributions      representations of values of block-pointer type) are not signed. */
76*8d741a5dSApple OSS Distributions   ptrauth_key_block_function = ptrauth_key_asia,
77*8d741a5dSApple OSS Distributions 
78*8d741a5dSApple OSS Distributions   /* The key used to sign C++ v-table pointers.
79*8d741a5dSApple OSS Distributions      The extra data is always 0. */
80*8d741a5dSApple OSS Distributions   ptrauth_key_cxx_vtable_pointer = ptrauth_key_asda
81*8d741a5dSApple OSS Distributions 
82*8d741a5dSApple OSS Distributions };
83*8d741a5dSApple OSS Distributions 
84