[llvm] [BOLT][binary-analysis] Add initial pac-ret gadget scanner (PR #122304)

Jacob Bramley via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 03:46:24 PST 2025


================
@@ -0,0 +1,46 @@
+// RUN: %clang %cflags -march=armv8.3-a -mbranch-protection=pac-ret %s %p/../../Inputs/asm_main.c -o %t.exe
+// RUN: llvm-bolt-binary-analysis --scanners=pacret %t.exe 2>&1 | FileCheck %s
+
+
+// Verify that we can also detect gadgets across basic blocks
----------------
jacobbramley wrote:

I think the implementation attempts to correctly handle cases like this:

```
    cbnz x0, 1f
    autibsp
    b 2f
1:  autiasp
2:  ret
```

That is, two (or more) basic blocks that all authenticate.

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


More information about the llvm-commits mailing list