Skip to content

Commit 73c9c8d

Browse files
committed
Add relocation types for code pointers
1 parent 8c5f2f1 commit 73c9c8d

File tree

1 file changed

+54
-25
lines changed

1 file changed

+54
-25
lines changed

aaelf64-morello/aaelf64-morello.rst

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,11 @@ The following nomenclature is used in the descriptions of relocation operations:
476476
the second entry holds a platform-specific offset or pointer. The pair of
477477
pointer-sized entries will be relocated with ``R_MORELLO_TLSDESC(S+A)``.
478478

479+
- ``Delta(S)`` if ``S`` is a normal symbol, resolves to the difference between the
480+
static link address of ``S`` and the execution address of ``S``. If ``S`` is the
481+
null symbol (ELF symbol index 0), resolves to the difference between the static
482+
link address of ``P`` and the execution address of ``P``.
483+
479484
- ``TPREL(S)`` resolves to a pair of two 64-bit values. The first value
480485
contains the offset in the static TLS block of the thread-local symbol ``S``.
481486
The second value contains the size of the symbol ``S``
@@ -688,31 +693,40 @@ Dynamic Morello relocations
688693

689694
.. table:: Dynamic relocations
690695

691-
+-------+-------------------------+-----------------------------------------+------------------------------------------+
692-
| ELF64 | Name | Operation | Comment |
693-
| Code | | | |
694-
+=======+=========================+=========================================+==========================================+
695-
| 59392 | ``R_MORELLO_CAPINIT`` | ``CAP_INIT(S, A, CAP_SIZE, CAP_PERM)`` | See note below. |
696-
| | | | |
697-
+-------+-------------------------+-----------------------------------------+------------------------------------------+
698-
| 59393 | ``R_MORELLO_GLOB_DAT`` | ``CAP_INIT(S, A, CAP_SIZE, CAP_PERM)`` | See note below. |
699-
| | | | |
700-
+-------+-------------------------+-----------------------------------------+------------------------------------------+
701-
| 59394 | ``R_MORELLO_JUMP_SLOT`` | ``CAP_INIT(S, A, CAP_SIZE, CAP_PERM)`` | See note below. |
702-
| | | | |
703-
+-------+-------------------------+-----------------------------------------+------------------------------------------+
704-
| 59395 | ``R_MORELLO_RELATIVE`` | ``CAP_INIT(S, A, CAP_SIZE, CAP_PERM)`` | See note below. |
705-
| | | | |
706-
+-------+-------------------------+-----------------------------------------+------------------------------------------+
707-
| 59396 | ``R_MORELLO_IRELATIVE`` | ``CAP_INIT(S, A, CAP_SIZE, CAP_PERM)`` | See note below. |
708-
| | | | |
709-
+-------+-------------------------+-----------------------------------------+------------------------------------------+
710-
| 59397 | ``R_MORELLO_TLSDESC`` | ``TLSDESC(S+A)`` | Identifies a TLS descriptor to be filled.|
711-
| | | | |
712-
+-------+-------------------------+-----------------------------------------+------------------------------------------+
713-
| 59398 | ``R_MORELLO_TPREL128`` | ``TPREL(S)`` | See note below. |
714-
| | | | |
715-
+-------+-------------------------+-----------------------------------------+------------------------------------------+
696+
+-------+-----------------------------+-----------------------------------------+------------------------------------------+
697+
| ELF64 | Name | Operation | Comment |
698+
| Code | | | |
699+
+=======+=============================+=========================================+==========================================+
700+
| 59392 | ``R_MORELLO_CAPINIT`` | ``CAP_INIT(S, A, CAP_SIZE, CAP_PERM)`` | See note below. |
701+
| | | | |
702+
+-------+-----------------------------+-----------------------------------------+------------------------------------------+
703+
| 59393 | ``R_MORELLO_GLOB_DAT`` | ``CAP_INIT(S, A, CAP_SIZE, CAP_PERM)`` | See note below. |
704+
| | | | |
705+
+-------+-----------------------------+-----------------------------------------+------------------------------------------+
706+
| 59394 | ``R_MORELLO_JUMP_SLOT`` | ``CAP_INIT(S, A, CAP_SIZE, CAP_PERM)`` | See note below. |
707+
| | | | |
708+
+-------+-----------------------------+-----------------------------------------+------------------------------------------+
709+
| 59395 | ``R_MORELLO_RELATIVE`` | ``CAP_INIT(S, A, CAP_SIZE, CAP_PERM)`` | See note below. |
710+
| | | | |
711+
+-------+-----------------------------+-----------------------------------------+------------------------------------------+
712+
| 59396 | ``R_MORELLO_IRELATIVE`` | ``CAP_INIT(S, A, CAP_SIZE, CAP_PERM)`` | See note below. |
713+
| | | | |
714+
+-------+-----------------------------+-----------------------------------------+------------------------------------------+
715+
| 59397 | ``R_MORELLO_TLSDESC`` | ``TLSDESC(S+A)`` | Identifies a TLS descriptor to be filled.|
716+
| | | | |
717+
+-------+-----------------------------+-----------------------------------------+------------------------------------------+
718+
| 59398 | ``R_MORELLO_TPREL128`` | ``TPREL(S)`` | See note below. |
719+
| | | | |
720+
+-------+-----------------------------+-----------------------------------------+------------------------------------------+
721+
| 59399 | ``R_MORELLO_CODE_CAPINIT`` | ``CAP_INIT(S, A, CAP_SIZE, CAP_PERM)`` | See note below. |
722+
| | | | |
723+
+-------+-----------------------------+-----------------------------------------+------------------------------------------+
724+
| 59400 | ``R_MORELLO_FUNC_RELATIVE`` | ``CAP_INIT(S, A, CAP_SIZE, CAP_PERM)`` | See note below. |
725+
| | | | |
726+
+-------+-----------------------------+-----------------------------------------+------------------------------------------+
727+
| 59401 | ``R_AARCH64_FUNC_RELATIVE`` | ``Delta(S) + A`` | See note below. |
728+
| | | | |
729+
+-------+-----------------------------+-----------------------------------------+------------------------------------------+
716730

717731
.. note::
718732

@@ -759,6 +773,21 @@ Dynamic Morello relocations
759773

760774
``| 64-bits offset | 64-bits size |``
761775

776+
``R_MORELLO_CODE_CAPINIT`` is similar to ``R_MORELLO_CAPINIT`` but signifies
777+
that the capability being relocated is a code pointer as opposed to a data
778+
pointer or function pointer. As such, it must only be used against
779+
``STT_FUNC`` symbols. This relocation type is needed for library-based
780+
compartmentalization (c18n). Currently for security reasons this relocation
781+
may only be used against non-preemptible symbols, and thus will be converted
782+
to ``R_MORELLO_RELATIVE`` at link time, making it in effect a static
783+
relocation. However, this restriction may be removed in future if needed, and
784+
it is therefore classed as a dynamic relocation.
785+
786+
``R_MORELLO_FUNC_RELATIVE`` and ``R_AARCH64_FUNC_RELATIVE`` : similar to
787+
their non-``_FUNC`` counterparts but signify that the capability being
788+
relocated is a function pointer as opposed to a data pointer or code pointer.
789+
This distinction is needed for library-based compartmentalization (c18n).
790+
762791
Static linking with Morello
763792
^^^^^^^^^^^^^^^^^^^^^^^^^^^
764793

0 commit comments

Comments
 (0)