File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,13 @@ namespace detail {
2626 unw_word_t pc;
2727 unw_word_t sp;
2828 unw_get_reg (&cursor, UNW_REG_IP, &pc);
29+ #if defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__))
30+ // Apple's unw_get_reg(UNW_REG_IP) may return pointer-authenticated addresses with PAC
31+ // signature bits in the upper bytes
32+ uintptr_t stripped = static_cast <uintptr_t >(pc);
33+ __asm__ volatile (" xpaci %0" : " +r" (stripped));
34+ pc = static_cast <unw_word_t >(stripped);
35+ #endif
2936 unw_get_reg (&cursor, UNW_REG_SP, &sp);
3037 if (skip) {
3138 skip--;
@@ -53,6 +60,13 @@ namespace detail {
5360 unw_word_t sp;
5461 // thread and signal-safe https://www.nongnu.org/libunwind/man/unw_get_reg(3).html
5562 unw_get_reg (&cursor, UNW_REG_IP, &pc);
63+ #if defined(__APPLE__) && (defined(__arm64__) || defined(__aarch64__))
64+ {
65+ uintptr_t stripped = static_cast <uintptr_t >(pc);
66+ __asm__ volatile (" xpaci %0" : " +r" (stripped));
67+ pc = static_cast <unw_word_t >(stripped);
68+ }
69+ #endif
5670 unw_get_reg (&cursor, UNW_REG_SP, &sp);
5771 if (skip) {
5872 skip--;
You can’t perform that action at this time.
0 commit comments