[llvm] [llvm-exegesis][AArch64] Check for PAC keys before disabling them (PR #138643)

Anatoly Trosinenko via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 2 09:43:19 PDT 2025


atrosinenko wrote:

> The first execution (line 4) completed successfully.
> The second execution (line 6) crashed with a similar output as in my previous test/message.

@tuliom I would expect a crash without `--aarch64-disable-pac-control` (`--aarch64-keep-pac-keys`) when llvm-exegesis itself is built with pac-ret (possibly the default in your configuration) and your hardware supports PAuth (obviously true as well): on return from a non-leaf function you have to authenticate LR, so if the PAC keys were enabled at the time of signing in the prologue and disabled at the time of authentication in epilogue, the return address would be incorrect resulting in SIGSEGV on `ret`. Since `getIgnoredOpcodeReasonOrNull` is virtual and it calls `prctl`, it can hardly been made leaf by any optimization, so llvm-exegesis is likely to crash even before returning to the caller of `getIgnoredOpcodeReasonOrNull`. If you are unlucky enough, you would get a SIGSEGV even before returning from `prctl` to `getIgnoredOpcodeReasonOrNull` itself.

Given the above, it is probably safer to only execute tests with the `--aarch64-keep-pac-keys` option (for usability, it may be better to define an inverted option instead, so that key control logic is disabled unless explicitly requested) and only permit llvm-exegesis to disable the keys when the developer wants to measure timings of `AUT*` instructions and has already built llvm-exegesis (and possibly run-time libraries) without pac-ret.

https://github.com/llvm/llvm-project/pull/138643


More information about the llvm-commits mailing list