@@ -52,8 +52,8 @@ This document serves four purposes:
52
52
ways in which programmers can strengthen its protections (including
53
53
recommendations for language implementors).
54
54
55
- - It documents the language ABIs currently used for C, C++, and Objective-C
56
- on arm64e .
55
+ - It documents the stable ABI of the C, C++, and Objective-C languages on arm64e
56
+ platforms .
57
57
58
58
59
59
Basic concepts
@@ -274,13 +274,16 @@ There are three levels of the pointer authentication language feature:
274
274
including return addresses, function pointers, and C++ virtual functions. The
275
275
intent is for all pointers to code in program memory to be signed in some way
276
276
and for all branches to code in program text to authenticate those
277
- signatures.
277
+ signatures. In addition to the code pointers themselves, we also use pointer
278
+ authentication to protect data values that directly or indirectly influence
279
+ control flow or program integrity.
278
280
279
281
- The language also provides extensions to override the default rules used by
280
282
the language implementation. For example, the ``__ptrauth `` type qualifier
281
- can be used to change how pointers are signed when they are stored in
282
- a particular variable or field; this provides much stronger protection than
283
- is guaranteed by the default rules for C function and data pointers.
283
+ can be used to change how pointers or pointer sized integers are signed when
284
+ they are stored in a particular variable or field; this provides much stronger
285
+ protection than is guaranteed by the default rules for C function and data
286
+ pointers.
284
287
285
288
- Finally, the language provides the ``<ptrauth.h> `` intrinsic interface for
286
289
manually signing and authenticating pointers in code. These can be used in
@@ -360,7 +363,7 @@ signed with address diversity.
360
363
361
364
While this representation of nulls is the safest option for the general case,
362
365
there are some situations in which a null pointer may have important semantic
363
- or security impact. For that purpose clang has the concept of a pointer
366
+ or security impact. For that purpose Clang has the concept of a pointer
364
367
authentication schema that signs and authenticates null values.
365
368
366
369
Return addresses
@@ -397,17 +400,17 @@ Feature testing
397
400
Whether the current target uses pointer authentication can be tested for with
398
401
a number of different tests.
399
402
400
- - ``__has_extension (ptrauth_intrinsics) `` is true if ``<ptrauth.h> `` provides
401
- its normal interface. This may be true even on targets where pointer
403
+ - ``__has_feature (ptrauth_intrinsics) `` is true if ``<ptrauth.h> `` provides its
404
+ normal interface. This may be true even on targets where pointer
402
405
authentication is not enabled by default.
403
406
404
- - ``__has_extension (ptrauth_returns) `` is true if the target uses pointer
407
+ - ``__has_feature (ptrauth_returns) `` is true if the target uses pointer
405
408
authentication to protect return addresses.
406
409
407
- - ``__has_extension (ptrauth_calls) `` is true if the target uses pointer
410
+ - ``__has_feature (ptrauth_calls) `` is true if the target uses pointer
408
411
authentication to protect indirect branches. This implies
409
- ``__has_extension (ptrauth_returns) `` and
410
- ``__has_extension (ptrauth_intrinsics) ``.
412
+ ``__has_feature (ptrauth_returns) `` and
413
+ ``__has_feature (ptrauth_intrinsics) ``.
411
414
412
415
Clang provides several other tests only for historical purposes; for current
413
416
purposes they are all equivalent to ``ptrauth_calls ``.
@@ -477,13 +480,14 @@ rules of C++:
477
480
478
481
- A type may be **non-trivial to copy **.
479
482
480
- - A type may also be **illegal to copy **. Types that are illegal to copy are
483
+ - A type may also be **illegal to copy **. Types that are illegal to copy are
481
484
always non-trivial to copy.
482
485
483
486
- A type may also be **address-sensitive **.
484
487
485
- - A type qualified with a ``ptrauth `` qualifier that requires address diversity
486
- is non-trivial to copy and address-sensitive.
488
+ - A type qualified with a ``ptrauth `` qualifier or implicit authentication
489
+ schema that requires address diversity is non-trivial to copy and
490
+ address-sensitive.
487
491
488
492
- An array type is illegal to copy, non-trivial to copy, or address-sensitive
489
493
if its element type is illegal to copy, non-trivial to copy, or
@@ -829,15 +833,20 @@ the following example of a hand-rolled "v-table":
829
833
void (*logStatus)(Object *);
830
834
};
831
835
832
- This weakness can be mitigated by using a more specific signing schema for each
833
- purpose. For example, in this example, the ``__ptrauth `` qualifier can be used
834
- with a different constant discriminator for each field. Since there's no
835
- particular reason it's important for this v-table to be copyable with
836
- ``memcpy ``, the functions can also be signed with address diversity:
836
+ The weakness in this design is that by lacking any context specific
837
+ discriminator, means an attacker can substiture any of these fields with any
838
+ other correctly signed function pointer. Similarly the lack of address diversity
839
+ allows an attacker to replace the functions in one type's "v-table" with those
840
+ of another. This can be mitigated by overriding the default authentication
841
+ schema with a more specific signing schema for each purpose. For instance, in
842
+ this example, the ``__ptrauth `` qualifier can be used with a different constant
843
+ discriminator for each field. Since there's no particular reason it's important
844
+ for this v-table to be copyable with ``memcpy ``, the functions can also be
845
+ signed with address diversity:
837
846
838
847
.. code-block :: c
839
848
840
- #if __has_extension (ptrauth_calls)
849
+ #if __has_feature (ptrauth_calls)
841
850
#define objectOperation(discriminator) \
842
851
__ptrauth(ptrauth_key_function_pointer, 1, discriminator)
843
852
#else
0 commit comments