Skip to content

Commit ec2569f

Browse files
authored
[PAuthABIELF64] Clarify the interaction between Memtag and PAuthAbi (#366)
The PAuthABI introduces some new dynamic relocations and the MemtagABI adds additional semantics to existing core dynamic relocations. The additional semantics for MemtagABI can be applied to the new PAuthABI dynamic relocations. In most cases the extension is natural as the LDG and SIGN operations operate on different bits in the pointer and can apply in either order. Both the MemtagABI and the PAuthABI require additional metadata for the R_AARCH64_AUTH_RELATIVE relocation which is stored in the place of the relocation. The MemtagABI stores an additional addend compensator so that the dynamic linker can derive the start address of the datatype so that it can materialize the correct tag. The PAuthABI stores the signing schema, including an addend field which contains the relocation addend when RELR compression is used. As the MemtagABI excludes any relocations with an addend compensator from RELR compression, and PAuthABI requires the addend field in the signing schema to be 0 when RELR compression is not used; we can use the signing schema addend field for the Memtag addend compensator. Document the relocation operators and how the MemtagABI applies to the PAuthABI relocations. This behaviour was implemented in LLD PR llvm/llvm-project#173291
1 parent 341e3d5 commit ec2569f

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

pauthabielf64/pauthabielf64.rst

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
.. _ARM64E: https://github.com/apple/llvm-project/blob/a63a81bd9911f87a0b5dcd5bdd7ccdda7124af87/clang/docs/PointerAuthentication.rst
1313
.. _CPPABI64: https://github.com/ARM-software/abi-aa/releases
1414
.. _LSB: https://refspecs.linuxfoundation.org/LSB_1.2.0/gLSB/noteabitag.html
15+
.. _MEMTAGABI: https://github.com/ARM-software/abi-aa/releases
1516
.. _SCO-ELF: http://www.sco.com/developers/gabi/
1617
.. _SYSVABI64: https://github.com/ARM-software/abi-aa/releases
1718
.. _TLSDESC: http://www.fsfla.org/~lxoliva/writeups/TLS/paper-lk2006.pdf
@@ -248,6 +249,8 @@ changes to the content of the document for that release.
248249
| | | - Move AUTH GOT generating relocations out of private experiment |
249250
| | | Range. |
250251
+------------+-----------------------------+------------------------------------------------------------------+
252+
| 2026Q2 | 6\ :sup:`th` January 2026 | - Clarify combination of MemtagABI and PAuthABI relocations |
253+
+------------+-----------------------------+------------------------------------------------------------------+
251254

252255
References
253256
----------
@@ -269,6 +272,8 @@ This document refers to, or is referred to by, the following documents.
269272
+-----------------------------------------------------------------------------------------+-------------------------------------------------------------+--------------------------------------------------------------------------+
270273
| LSB_ | | Linux Standards Base |
271274
+-----------------------------------------------------------------------------------------+-------------------------------------------------------------+--------------------------------------------------------------------------+
275+
| MEMTAGABI_ | memtagabi64 | Memtag ABI Extension for the Arm 64-bit Architecture |
276+
+-----------------------------------------------------------------------------------------+-------------------------------------------------------------+--------------------------------------------------------------------------+
272277
| SCO-ELF_ | http://www.sco.com/developers/gabi/ | System V Application Binary Interface – DRAFT |
273278
+-----------------------------------------------------------------------------------------+-------------------------------------------------------------+--------------------------------------------------------------------------+
274279
| SYSVABI64_ | sysvabi64 | System V Application Binary Interface (ABI) for the Arm 64-bit |
@@ -667,7 +672,7 @@ this should be sufficient.
667672
* ``reserved for addend`` is used in ``SHT_AUTH_RELR`` or ``SHT_REL``
668673
relocation implementations where the relocation addend is written to
669674
the contents of the place. It must be set to 0 if not used for an
670-
addend.
675+
addend, or not used for the (MEMTAGABI_) addend correction.
671676

672677
* ``reserved`` are bits reserved for future expansion. These bits must
673678
be set to 0 by a producer. A consumer must not assume that reserved
@@ -1229,6 +1234,47 @@ The ``R_AARCH64_AUTH_GOT_ADR_PREL_LO21`` relocation is used with the
12291234
| 0x414 (1044) | R\_AARCH64\_AUTH\_IRELATIVE | SIGN(Indirect(S + A), SCHEMA(\*P)) |
12301235
+--------------------+------------------------------+------------------------------------+
12311236

1237+
Combination of PAuthABI with the Memtag ABI Extension
1238+
-----------------------------------------------------
1239+
1240+
The Memtag ABI Extension (MEMTAGABI_) extends the semantics of some
1241+
dynamic relocations in (AAELF64_) to support memory tagging. The
1242+
extended semantics described in (MEMTAGABI_) can be extended to the
1243+
AUTH variant dynamic relocations described in this document.
1244+
1245+
For ``R_AARCH64_AUTH_ABS64`` and ``R_AARCH64_AUTH_GLOB_DAT`` the
1246+
extension is for the dynamic linker to materialize the tag for the
1247+
pointer, then to sign it.
1248+
1249+
For ``R_AARCH64_AUTH_RELATIVE``, both the (MEMTAGABI_) and the
1250+
PAuthABI require metadata to be stored in the place of the
1251+
relocation. The (MEMTAGABI_) stores an optional addend correction, and
1252+
the PAuthABI stores the signing schema with an addend field for use
1253+
with RELR compression. As the (MEMTAGABI_) excludes relocations that
1254+
require addend correction from RELR compression, and the addend
1255+
correction is expected to be small, the 32-bit addend field in the
1256+
signing schema can be used for the (MEMTAGABI_) addend correction.
1257+
1258+
Relocation Operation
1259+
====================
1260+
1261+
* ``LDG(pointer)`` is defined in (MEMTAGABI_).
1262+
1263+
* ``ADDEND(\*P)`` represents the dynamic linker reading the addend
1264+
field from the contents of the place ``P``.
1265+
1266+
.. table:: Relocations with extended semantics with MemtagABI
1267+
1268+
+--------------+-----------------------------+---------------------------------+-------------------------------------------------------------------+
1269+
| ELF64 Code | Name | PAuthABI Base Operation | MemtagABI Extended Operation |
1270+
+==============+=============================+=================================+===================================================================+
1271+
| 0x244 (580) | R\_AARCH64\_AUTH\_ABS64 | SIGN((S + A), SCHEMA(\*P)) | SIGN((LDG(S) + A), SCHEMA(\*P)) |
1272+
+--------------+-----------------------------+---------------------------------+-------------------------------------------------------------------+
1273+
| 0x413 (1043) | R\_AARCH64\_AUTH\_RELATIVE | SIGN(DELTA(S) + A, SCHEMA(\*P)) | SIGN((LDG(Delta(S) + A + ADDEND(\*P)) - ADDEND(\*P), SCHEMA(\*P)) |
1274+
+--------------+-----------------------------+---------------------------------+-------------------------------------------------------------------+
1275+
| 0x414 (1044) | R\_AARCH64\_AUTH\_GLOB\_DAT | SIGN((S + A), SCHEMA(\*P)) | SIGN((LDG(S) + A), SCHEMA(\*P)) |
1276+
+--------------+-----------------------------+---------------------------------+-------------------------------------------------------------------+
1277+
12321278
Compatibility between relocatable object files
12331279
----------------------------------------------
12341280

0 commit comments

Comments
 (0)