[libcxx-commits] [compiler-rt] [libcxxabi] [libunwind] [runtimes][PAC] Harden unwinding when possible (#138571) (PR #143230)

Oliver Hunt via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 5 23:06:56 PDT 2025


================
@@ -21,6 +21,44 @@
 #include "cxa_handlers.h"
 #include "private_typeinfo.h"
 #include "unwind.h"
+#include "libunwind.h"
+
+#if __has_include(<ptrauth.h>)
+#  include <ptrauth.h>
+#endif
+
+#if __has_extension(ptrauth_qualifier)
+// The actual value of the discriminators listed below is not important.
+// The derivation of the constants is only being included for the purpose
+// of maintaining a record of how they were originally produced.
+
+// ptrauth_string_discriminator("scan_results::languageSpecificData") == 0xE50D)
+#define __ptrauth_scan_results_lsd \
+  __ptrauth(ptrauth_key_process_dependent_code, 1, 0xE50D)
+
+// ptrauth_string_discriminator("scan_results::actionRecord") == 0x9823
+#define __ptrauth_scan_results_action_record \
+  __ptrauth(ptrauth_key_process_dependent_code, 1, 0x9823)
+
+// scan result is broken up as we have a manual re-sign that requires each component
+#define __ptrauth_scan_results_landingpad_key ptrauth_key_process_dependent_code
+// ptrauth_string_discriminator("scan_results::landingPad") == 0xD27C
+#define __ptrauth_scan_results_landingpad_disc 0xD27C
+#define __ptrauth_scan_results_landingpad \
+   __ptrauth(__ptrauth_scan_results_landingpad_key, 1, __ptrauth_scan_results_landingpad_disc)
+#define __ptrauth_scan_results_landingpad_intptr \
+   __ptrauth_restricted_intptr(__ptrauth_scan_results_landingpad_key, 1, \
+                               __ptrauth_scan_results_landingpad_disc)
+
+#else
+#define __ptrauth_scan_results_lsd
+#define __ptrauth_scan_results_action_record
+#define __ptrauth_scan_results_landingpad
+#define __ptrauth_scan_results_landingpad_intptr
+#endif
+
+
+#include "libunwind.h"
----------------
ojhunt wrote:

have removed this now

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


More information about the libcxx-commits mailing list