[libunwind] [libunwind] Fix problems caused by combining BTI and GCS (PR #102322)

Daniel Kiss via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 7 08:36:31 PDT 2024


================
@@ -82,7 +82,22 @@
 #define PPC64_OPD2
 #endif
 
-#if defined(__aarch64__) && defined(__ARM_FEATURE_BTI_DEFAULT)
+#if defined(__aarch64__)
+#if defined(__ARM_FEATURE_GCS_DEFAULT) && defined(__ARM_FEATURE_BTI_DEFAULT)
+// Set BTI, PAC, and GCS gnu property bits
+#define GNU_PROPERTY 7
+// We indirectly branch to __libunwind_Registers_arm64_jumpto from
+// __unw_phase2_resume, so we need to use bti jc.
+#define AARCH64_BTI bti jc
----------------
DanielKristofKiss wrote:

`__unw_getcontext`  will also get the `bti jc` so slightly weakens the BTI protection but since `paciasp` is also `bti jc` might not be a big problem.

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


More information about the cfe-commits mailing list