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