Skip to content

Commit 2e51520

Browse files
committed
[clang][AArch64][PAC] Update documentation
- vtable type discrimination - init/fini arrays signing
1 parent 4fb933c commit 2e51520

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

clang/docs/PointerAuthentication.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,9 @@ The use of a uniform constant discriminator is seen as a serious defect which sh
783783
C++ virtual tables
784784
~~~~~~~~~~~~~~~~~~
785785

786-
The pointer to a C++ virtual table is currently signed with the ``DA`` key, no address diversity, and a constant discriminator of 0. The use of no address diversity, as well as the uniform constant discriminator, are seen as weaknesses. Not using address diversity allows attackers to simply copy valid v-table pointers from one object to another. However, using a uniform discriminator of 0 does have positive performance and code-size implications on ARMv8.3, and diversity for the most important v-table access pattern (virtual dispatch) is already better assured by the signing schemas used on the virtual functions. It is also known that some code in practice copies objects containing v-tables with ``memcpy``, and while this is not permitted formally, it is something that may be invasive to eliminate.
786+
On Apple's arm64e, the pointer to a C++ virtual table is currently signed with the ``DA`` key, no address diversity, and a constant discriminator of 0. The use of no address diversity, as well as the uniform constant discriminator, are seen as weaknesses. Not using address diversity allows attackers to simply copy valid v-table pointers from one object to another. However, using a uniform discriminator of 0 does have positive performance and code-size implications on ARMv8.3, and diversity for the most important v-table access pattern (virtual dispatch) is already better assured by the signing schemas used on the virtual functions. It is also known that some code in practice copies objects containing v-tables with ``memcpy``, and while this is not permitted formally, it is something that may be invasive to eliminate.
787+
788+
When building for ELF platforms with ``-mbranch-protection=pauthabi``, C++ virtual tables are signed with the ``DA`` key, address diversity enabled and a type-dependent discriminator (options ``-fptrauth-vtable-type-discrimination`` and ``-fptrauth-vtable-address-discrimination`` are implicitly passed).
787789

788790
Virtual functions in a C++ virtual table are signed with the ``IA`` key, address diversity, and a constant discriminator equal to the string hash (see `ptrauth_string_discriminator`_) of the mangled name of the function which originally gave rise to the v-table slot.
789791

@@ -800,6 +802,11 @@ The use of dispatch thunks means that ``==`` on member function pointers is no l
800802

801803
The use of dispatch thunks also potentially enables v-tables to be signed using a declaration-specific constant discriminator in the future; otherwise this discriminator would also need to be stored in the member pointer.
802804

805+
Function pointers in init/fini arrays
806+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
807+
808+
A command-line option ``-fptrauth-init-fini`` can be used to enable signing of pointers stored in ``.init_array`` and ``.fini_array`` sections. A constant discriminator distinguishing them from other function pointers is used. See ``ptrauth.h`` for the discriminator value. The option is disabled by default and is automatically enabled when building for ELF platforms with ``-mbranch-protection=pauthabi``.
809+
803810
Blocks
804811
~~~~~~
805812

0 commit comments

Comments
 (0)