[IR] Define ptrauth intrinsics.
authorAhmed Bougacha <ahmed@bougacha.org>
Mon, 27 Sep 2021 15:00:00 +0000 (08:00 -0700)
committerAhmed Bougacha <ahmed@bougacha.org>
Sun, 14 Nov 2021 15:59:00 +0000 (07:59 -0800)
commit68854f4e572afec802299e36b2db71dfc4cf2f27
tree3e287c869b084c1f723dae456b41f4855496e21a
parentb2839610124bd8a3a881a65ab14005c9405479ef
[IR] Define ptrauth intrinsics.

This defines the new `@llvm.ptrauth.` pointer authentication intrinsics:
sign, auth, strip, blend, and sign_generic, documented in PointerAuth.md.

Pointer Authentication is a mechanism by which certain pointers are
signed.  When a pointer gets signed, a cryptographic hash of its value
and other values (pepper and salt) is stored in unused bits of that
pointer.

Before the pointer is used, it needs to be authenticated, i.e., have its
signature checked.  This prevents pointer values of unknown origin from
being used to replace the signed pointer value.

sign and auth provide the core operations.  strip removes the ptrauth
bits from a signed pointer without checking them.  sign_generic allows
signing non-pointer values.  Finally, blend combines salt values
("discriminators") to derive more targeted and less reusable ones.

In later patches, we implement primary backend support for these
intrinsics using the AArch64 PAuth feature, and build on that to
implement the arm64e Darwin ABI and ELF PAuth ABI Extension in clang.

For more details, see the docs page, as well as our llvm-dev RFC:
  http://lists.llvm.org/pipermail/llvm-dev/2019-October/136091.html
or our 2019 Developers' Meeting talk.

Differential Revision: https://reviews.llvm.org/D90868
llvm/docs/LangRef.rst
llvm/docs/PointerAuth.md [new file with mode: 0644]
llvm/docs/Reference.rst
llvm/include/llvm/IR/Intrinsics.td