[libunwind] [libunwind][arm64e] Mach-O Support unwinding PAuth_LR frames (PR #202772)

Daniil Kovalev via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 26 06:41:57 PDT 2026


================
@@ -1908,21 +1909,36 @@ bool UnwindCursor<A, R>::getInfoFromCompactEncodingSection(
       }
     }
     encoding = pageIndex.encoding(low);
-    funcStart = pageIndex.functionOffset(low) + sects.dso_base;
+    rangeStart = pageIndex.functionOffset(low) + sects.dso_base;
+
+    // If UNWIND_IS_NOT_FUNCTION_START is set, walk backwards to find the actual
+    // function start.
+    funcStart = rangeStart;
+    if (encoding & UNWIND_IS_NOT_FUNCTION_START) {
+      uint32_t backIndex = low;
+      do {
+        --backIndex;
+      } while (backIndex > 0 &&
----------------
kovdan01 wrote:

Do we have a guarantee that `low` is greater than 0?

If no, we might potentially end up with `backIndex` equal to `UINT32_MAX` (after first decrement) which does not look as intended behavior.

If yes, it's probably worth adding a corresponding assertion

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


More information about the cfe-commits mailing list