[PAC][libunwind] Pass ptrauth-qualified values as const references (#173765)
For Apple's arm64e or Linux's pauthtest, `Registers_arm64::link_reg_t`
type is `__ptrauth`-qualified. When passing a value of such a type to a
function accepting non-`__ptrauth`-qualified parameter with `pint_t`
type, an authentication is performed. So, the corresponding callee
argument does not contain an embedded signature, making it prone to
substitution if spilled to the stack.
This patch prevents early authentication of signed values of
`link_reg_t` type by passing them as const l-value references instead of
passing by value with type `pint_t`. This way, the callee would operate
with a `__ptrauth`-qualified value containing a signature, allowing to
detect a substitution if the value is spilled to the stack.
Note that this approach was introduced previously in #143230 for some
other functions. In this patch, we apply the approach to the functions
which were not considered previously.
GitOrigin-RevId: 2b25e92948403c15d1adf07daa09defcd0b38caf
6 files changed