[PATCH] D156505: [AArch64][ELF] Support R_AARCH64_AUTH_ABS64 static relocation

Daniil Kovalev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 22:58:13 PDT 2023


kovdan01 created this revision.
kovdan01 added reviewers: efriedma, hiraditya.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
kovdan01 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The patch adds parser, MCExpr, and emitter support for the authenticated
pointer auth relocation.

In assembly, this is expressed using:

  .quad <symbol>@AUTH(<key>, <discriminator> [, addr])

For example:

  .quad _g3 at AUTH(ib, 1234, addr)

The optional 'addr' specifier represents whether the generated pointer
authentication code will also include address diversity (by blending the
address of the storage location of the relocated pointer with the
user-specified constant discriminator).

The @AUTH expression lowers to R_AARCH64_AUTH_ABS64 ELF relocation.

The signing schema is encoded in the place of relocation to be applied
as follows:

  | 63                | 62 | 61:60 | 59:48 |  47:32        | 31:0   |
  | ----------------- | -- | ----- | ----- | ------------- | ------ |
  | address diversity | 0  | key   | 0     | discriminator | addend |

See the following for details:
https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#static-relocations

Co-authored-by: Ahmed Bougacha <ahmed at bougacha.org>
Co-authored-by: Peter Collingbourne <peter at pcc.me.uk>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156505

Files:
  llvm/docs/PointerAuth.md
  llvm/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
  llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h
  llvm/test/MC/AArch64/arm64-ptrauth-elf-reloc.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156505.545021.patch
Type: text/x-patch
Size: 19801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230728/d2eb682c/attachment.bin>


More information about the llvm-commits mailing list