Skip to content

Commit b3dce55

Browse files
committed
Address feedback and small fixes
* Questions and clarifications from @kbeyls * Fixing another example of Oliver breaking doc generation * A couple of other small clarifications
1 parent a7e0208 commit b3dce55

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

clang/docs/PointerAuthentication.rst

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,9 @@ rules of C++:
483483
- A type may also be **illegal to copy**. Types that are illegal to copy are
484484
always non-trivial to copy.
485485

486-
- A type may also be **address-sensitive**.
486+
- A type may also be **address-sensitive**. This includes types that use self
487+
referencing pointers, data protected by address diversified pointer
488+
authentication, or other similar concepts.
487489

488490
- A type qualified with a ``ptrauth`` qualifier or implicit authentication
489491
schema that requires address diversity is non-trivial to copy and
@@ -834,15 +836,15 @@ the following example of a hand-rolled "v-table":
834836
};
835837
836838
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:
839+
discriminator, this means an attacker can substitute any of these fields with
840+
any other function pointer signed with the default schema. Similarly the lack of
841+
address diversity allows an attacker to replace the functions in one type's
842+
"v-table" with those of another. This can be mitigated by overriding the default
843+
authentication schema with a more specific signing schema for each purpose. For
844+
instance, in this example, the ``__ptrauth`` qualifier can be used with a
845+
different constant discriminator for each field. Since there's no particular
846+
reason it's important for this v-table to be copyable with ``memcpy``, the
847+
functions can also be signed with address diversity:
846848

847849
.. code-block:: c
848850
@@ -1191,7 +1193,10 @@ Clang makes a modest set of guarantees in this area:
11911193

11921194
- it takes the address of a global variable or function, or
11931195

1194-
- it is a load from a gl-value of ``__ptrauth``-qualified type.
1196+
- it is a load from a gl-value of ``__ptrauth``-qualified type, or
1197+
1198+
- it is a load from read-only memory that has been initialized from a safely
1199+
derived source, such as the `data const` section of a binary or library.
11951200

11961201
- If a value that is safely derived is assigned to a ``__ptrauth``-qualified
11971202
object, including by initialization, then the value will be directly signed as
@@ -1331,9 +1336,9 @@ is almost entirely reserved for this purpose.
13311336
Global offset tables
13321337
~~~~~~~~~~~~~~~~~~~~
13331338

1334-
The global offset table (GOT) is not language ABI, but it is a common
1335-
implementation technique for dynamic linking which deserves special discussion
1336-
here.
1339+
The global offset table (GOT) is not part of the language ABI, but it is a
1340+
common implementation technique for dynamic linking which deserves special
1341+
discussion here.
13371342

13381343
Whenever possible, signed pointers should be materialized directly in code
13391344
rather than via the GOT, e.g. using an ``adrp+add+pac`` sequence on ARMv8.3.
@@ -1398,9 +1403,11 @@ create :ref:`signing oracles<Signing Oracles>`.
13981403
On arm64e the `dlsym` function is used to resolve a symbol at runtime. If the
13991404
resolved symbol is a function or other code pointer the returned pointer is
14001405
signed using the default function signing schema described in
1401-
`C function pointers`_. If the resolved symbol is not a code pointer it is
1406+
:ref:`C function pointers<C function abi>`. If the resolved symbol is not a code pointer it is
14021407
returned as an unsigned pointer.
14031408

1409+
.. _C function abi:
1410+
14041411
C function pointers
14051412
~~~~~~~~~~~~~~~~~~~
14061413

0 commit comments

Comments
 (0)