Skip to content

Commit 5c9d8e4

Browse files
committed
More substantive doc updates
Adds more information (and documents arm64e abi) for dynamic symbol resolution. Clarifies remap of readonly sections Fix incoherent sentence about the ptrauth_vtable_pointer attribute
1 parent b00177a commit 5c9d8e4

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

clang/docs/PointerAuthentication.rst

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,11 +1164,12 @@ pointer authentication.
11641164
inject code that can be used as a :ref:`signing oracle<Signing Oracles>`.
11651165
The same is true if they can write to the instruction stream.
11661166

1167-
- If an attacker can remap read-only program sections to be writable, then any
1168-
use of :ref:`relative addresses` in global data becomes insecure.
1167+
- If an attacker can remap read-only program data sections to be writable, then
1168+
any use of :ref:`relative addresses` in global data becomes insecure.
11691169

1170-
- If an attacker can remap read-only program sections to be writable, then it is
1171-
unsafe to use unsigned pointers in `global offset tables`_.
1170+
- On platforms that use them, if an attacker can remap the memory containing
1171+
the `global offset tables`_ as writable, then any unsigned pointers in those
1172+
tables are insecure.
11721173

11731174
Remapping memory in this way often requires the attacker to have already
11741175
substantively subverted the control flow of the process. Nonetheless, if the
@@ -1330,8 +1331,9 @@ is almost entirely reserved for this purpose.
13301331
Global offset tables
13311332
~~~~~~~~~~~~~~~~~~~~
13321333

1333-
The global offset table (GOT) is not ABI, but it is a common implementation
1334-
technique for dynamic linking which deserves special discussion here.
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.
13351337

13361338
Whenever possible, signed pointers should be materialized directly in code
13371339
rather than via the GOT, e.g. using an ``adrp+add+pac`` sequence on ARMv8.3.
@@ -1383,6 +1385,22 @@ entry as part of producing a signed pointer constant is not vulnerable to
13831385
`register clobbering`_. If the linker also generates code for this, e.g. for
13841386
call stubs, this generated code must take the same precautions.
13851387

1388+
Dynamic symbol lookup
1389+
~~~~~~~~~~~~~~~~~~~~~
1390+
1391+
On platforms that support dynamically loading or resolving symbols it is
1392+
necessary for them to define the pointer authentication semantics of the APIs
1393+
provided to perform such lookups. While the platform may choose to reply
1394+
unsigned pointers from such function and rely on the caller performing the
1395+
initial signing, doing so creates the opportunity for caller side errors that
1396+
create :ref:`signing oracles<Signing Oracles>`.
1397+
1398+
On arm64e the `dlsym` function is used to resolve a symbol at runtime. If the
1399+
resolved symbol is a function or other code pointer the returned pointer is
1400+
signed using the default function signing schema described in
1401+
`C function pointers`_. If the resolved symbol is not a code pointer it is
1402+
returned as an unsigned pointer.
1403+
13861404
C function pointers
13871405
~~~~~~~~~~~~~~~~~~~
13881406

@@ -1415,8 +1433,9 @@ By default the pointer to a C++ virtual table is currently signed with the
14151433
hash (see `ptrauth_string_discriminator`_) of the mangled v-table identifier
14161434
of the primary base class for the v-table. To support existing code or ABI
14171435
constraints it is possible to use the `ptrauth_vtable_pointer` attribute to
1418-
override the policy configure the key, address discrimination, and extra
1419-
discriminator used.
1436+
override the schema used for the v-table pointer of the base type of
1437+
polymorphic class hierarchy. This attribute permits the configuration of the
1438+
key, address diversity mode, and any extra constant discriminator to be used.
14201439

14211440
Virtual functions in a C++ virtual table are signed with the ``IA`` key, address
14221441
diversity, and a constant discriminator equal to the string hash (see

0 commit comments

Comments
 (0)