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

Anton Korobeynikov via llvm-commits llvm-commits at lists.llvm.org
Wed May 7 01:37:33 PDT 2025


================
@@ -207,15 +207,28 @@ class ExegesisAArch64Target : public ExegesisTarget {
 
     if (isPointerAuth(Opcode)) {
 #if defined(__aarch64__) && defined(__linux__)
+
+      // For some systems with existing PAC keys set, it is better to
+      // check the existing state of the key before setting it.
+      // For systems without PAC, this is a No-op but with PAC, it is
+      // safer to check the existing key state and then disable/enable them.
+      // Hence the guard placed for switching.
+      unsigned long pac_keys = 0;
----------------
asl wrote:

Thanks! Tagging @atrosinenko 

Essentially we expect two things:
 - If full pauth ABI is enabled, it is done in platform-specific manner. E.g. via ABI field in target quadruple for common platforms, or some other way for downstream
 - PAC-RET is expected to work regardless of settings since it is an ABI-neutral change.

My expectation is that PAC instructions in hint space should be handled gracefully regardless of PAC state. But maybe I am missing some context. 

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


More information about the llvm-commits mailing list