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

Abhilash Majumder via llvm-commits llvm-commits at lists.llvm.org
Tue May 13 08:52:43 PDT 2025


================
@@ -199,6 +200,12 @@ class ExegesisAArch64Target : public ExegesisTarget {
     PM.add(createAArch64ExpandPseudoPass());
   }
 
+  // Converts variadic arguments to `long` and passes zeros for the unused
+  // arg2-arg5, as tested by the Linux kernel.
+  static long prctl_wrapper(int op, long arg2 = 0, long arg3 = 0) {
+    return prctl(op, arg2, arg3, /*arg4=*/0L, /*arg5=*/0L);
+  }
----------------
abhilash1910 wrote:

Thanks, I have also added the nullptr return so as to not throw the exceptions. 
For having something like: ```--aarch64-disable-pac-control```
I was thinking something like this:
```
const char *getIgnoredOpcodeReasonOrNull(const LLVMState &State,
                                           unsigned Opcode) const override {
    bool DisablePACControl = !State.getExegesisTarget().getOptions().AArch64DisablePACControl;
    
    if (const char *Reason =
            ExegesisTarget::getIgnoredOpcodeReasonOrNull(State, Opcode))
      return Reason;

    if (isPointerAuth(Opcode)) {
#if defined(__aarch64__) && defined(__linux__)
   if (DisablePACControl) {
   
   //rest of the code as is///....
   }
#endif
```

@atrosinenko  @davemgreen  what do you think ? 


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


More information about the llvm-commits mailing list