[PATCH] D55704: [AArch64][libunwind] Unwinding support for return address signing with B Key

Luke Cheeseman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 14 05:30:38 PST 2018


LukeCheeseman created this revision.
LukeCheeseman added a reviewer: olista01.
Herald added subscribers: llvm-commits, JDevlieghere, kristof.beyls, javed.absar.

- Support for the case where the return address has been signed with the B key
- When the B key is used, a 'B' character is present in the augmentation string of CIE associated with the FDE for the function.


Repository:
  rL LLVM

https://reviews.llvm.org/D55704

Files:
  src/DwarfInstructions.hpp
  src/DwarfParser.hpp


Index: src/DwarfParser.hpp
===================================================================
--- src/DwarfParser.hpp
+++ src/DwarfParser.hpp
@@ -49,6 +49,9 @@
     bool      isSignalFrame;
     bool      fdesHaveAugmentationData;
     uint8_t   returnAddressRegister;
+#if defined(_LIBUNWIND_TARGET_AARCH64)
+    bool      addressesSignedWithBKey;
+#endif
   };
 
   /// Information about an FDE (Frame Description Entry)
@@ -263,6 +266,9 @@
   cieInfo->dataAlignFactor = 0;
   cieInfo->isSignalFrame = false;
   cieInfo->fdesHaveAugmentationData = false;
+#if defined(_LIBUNWIND_TARGET_AARCH64)
+  cieInfo->addressesSignedWithBKey = false;
+#endif
   cieInfo->cieStart = cie;
   pint_t p = cie;
   pint_t cieLength = (pint_t)addressSpace.get32(p);
@@ -326,6 +332,11 @@
       case 'S':
         cieInfo->isSignalFrame = true;
         break;
+#if defined(_LIBUNWIND_TARGET_AARCH64)
+      case 'B':
+        cieInfo->addressesSignedWithBKey = true;
+        break;
+#endif
       default:
         // ignore unknown letters
         break;
Index: src/DwarfInstructions.hpp
===================================================================
--- src/DwarfInstructions.hpp
+++ src/DwarfInstructions.hpp
@@ -213,7 +213,10 @@
 
         // This is the autia1716 instruction. The hint instruction is used here
         // as gcc does not assemble autia1716 for pre armv8.3a targets.
-        asm("hint 0xc": "+r"(x17): "r"(x16));
+        if (cieInfo.addressesSignedWithBKey)
+          asm("hint 0xe": "+r"(x17): "r"(x16));
+        else
+          asm("hint 0xc": "+r"(x17): "r"(x16));
         returnAddress = x17;
 #endif
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55704.178226.patch
Type: text/x-patch
Size: 1633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181214/76abdc78/attachment.bin>


More information about the llvm-commits mailing list