[PATCH] D156716: [AArch64][PAC] Check authenticated LR value during tail call

Anatoly Trosinenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 05:40:10 PDT 2023


atrosinenko added a comment.

Ping.

Here is a summary of the contents of this patch:

- implemented a standalone `llvm::AArch64PAuth::checkAuthenticatedRegister` utility function to emit one of a number of checks in case a pointer is AUT'ed and not immediately used for memory access
  - placed this function into a sub-namespace instead of making it a static class member, so I don't have to put otherwise irrelevant `AArch64PointerAuth` class definition to header file
  - note that the checks that are inserted by `checkAuthenticatedRegister` function are not specific to tail calls (but some of the checks may have restrictions - such as requiring `AuthenticatedReg == LR` because XPACLRI is encoded as HINT while generic XPAC* instructions require FEAT_PAUTH)
- hooked it to `AArch64PointerAuth` class via `checkAuthenticatedLR` method dedicated to hardening tail calls
- in machine outliner, update the costs computed by `AArch64InstrInfo::getOutliningCandidateInfo` method on a best-effort basis:
  - in `MachineOutlinerTailCall` outlining mode, we need to insert checks in each caller of OUTLINED_FUNCTION
  - in `MachineOutlinerThunk` mode, at most a single extra check is inserted in OUTLINED_FUNCTION itself
  - other modes do not introduce new tail calls, so let's just try to account for the checks that would possibly be inserted later into the original candidates by the `AArch64PointerAuth` pass (including in the two aboves modes)
- factored out `isTailCallReturnInst` and `needsShadowCallStackPrologueEpilogue` utility functions


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156716/new/

https://reviews.llvm.org/D156716



More information about the llvm-commits mailing list