HomePhabricator

[AArch64][v8.3A] Avoid inserting implicit landing pads (PACI*SP)

Authored by pbarrio on Jun 15 2021, 7:04 AM.

Description

[AArch64][v8.3A] Avoid inserting implicit landing pads (PACI*SP)

PACI*SP have the advantage that they are in HINT space, meaning
they can be run successfully in hardware without PAuth support -
they will just behave as a NOP. However, PACI*SP are also implicit
landing pads (think of an extra BTI jc). Therefore, they allow
indirect jumps of all kinds into them, potentially inserting new
gadgets. This patch replaces PACI*SP by PACI* LR, SP when
compiling explicitly for hardware with full PAuth support. PACI*
is not in the HINT space, therefore it will fault when run in
hardware without PAuth support, but it is also not a landing pad,
making programs safer in newer HW.

Differential Revision: https://reviews.llvm.org/D101920

Details