You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[AArch64][PAC] Simplify emission of authenticated pointer check (NFC)
The AArch64AsmPrinter::emitPtrauthCheckAuthenticatedValue method accepts
two arguments, `bool ShouldTrap` and `const MCSymbol *OnFailure`, that
control the behavior of the emitted instruction sequence when the check
fails:
* `ShouldTrap` requests an error to be generated
* `OnFailure` requests branching to the given label after clearing the
PAC field
An assertion in `emitPtrauthCheckAuthenticatedValue` ensures that
`OnFailure` must be null when `ShouldTrap` is set. But the opposite is
also true: when `ShouldTrap` is false, `OnFailure` is always non-null,
as otherwise the entire sequence following `AUT[ID][AB]` instruction
would turn into a very expensive equivalent of XPAC (unless the CPU
implements FEAT_FPAC):
authenticate Xn
inspect PAC field of Xn
if PAC field was not cleared:
clear PAC field
The only caller that makes use of checking-but-not-trapping mode of
emitPtrauthCheckAuthenticatedValue is emitPtrauthAuthResign, and it
passes a non-null pointer as OnFailure when ShouldTrap is false.
This commit makes the invariant explicit by omitting the ShouldTrap
argument and inferring its value from the OnFailure argument instead.
0 commit comments