[libunwind] [PAC][libunwind] Protect dso_base argument of getInfoFromFdeCie (PR #189737)

Louis Dionne via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 21 16:49:59 PDT 2026


https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/189737

>From a9b57d9263353690fc5a0cc9ce7a442a35922e29 Mon Sep 17 00:00:00 2001
From: Anatoly Trosinenko <atrosinenko at accesssoftek.com>
Date: Tue, 31 Mar 2026 22:53:26 +0300
Subject: [PATCH] [PAC][libunwind] Protect dso_base argument of
 getInfoFromFdeCie

Pass the `dso_base` argument of `UnwindCursor::getInfoFromFdeCie`
as a constant reference to a `__ptrauth`-qualified type. This resolves
the signing oracle in getInfoFromFdeCie when assigning dso_base to the
`__ptrauth`-qualified `_info.extra` field. This commit applies the
changes similar to those done in #173765 to one more function argument.

In the current libunwind source, getInfoFromFdeCie is called three
times, with only one invocation not passing literal 0 as the dso_base
argument. In that only non-trivial case, the value to be passed as
dso_base is read from the `dso_base` field of `UnwindInfoSections`,
which is itself `__ptrauth`-qualified.
---
 libunwind/src/UnwindCursor.hpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp
index ff92c9e0a844a..6cd25ba4ec420 100644
--- a/libunwind/src/UnwindCursor.hpp
+++ b/libunwind/src/UnwindCursor.hpp
@@ -1064,7 +1064,7 @@ class UnwindCursor : public AbstractUnwindCursor {
   bool getInfoFromFdeCie(const typename CFI_Parser<A>::FDE_Info &fdeInfo,
                          const typename CFI_Parser<A>::CIE_Info &cieInfo,
                          typename R::link_hardened_reg_arg_t pc,
-                         uintptr_t dso_base);
+                         typename R::link_hardened_reg_arg_t dso_base);
   bool getInfoFromDwarfSection(typename R::link_hardened_reg_arg_t pc,
                                const UnwindInfoSections &sects,
                                uint32_t fdeSectionOffsetHint = 0);
@@ -1735,7 +1735,8 @@ template <typename A, typename R>
 bool UnwindCursor<A, R>::getInfoFromFdeCie(
     const typename CFI_Parser<A>::FDE_Info &fdeInfo,
     const typename CFI_Parser<A>::CIE_Info &cieInfo,
-    typename R::link_hardened_reg_arg_t pc, uintptr_t dso_base) {
+    typename R::link_hardened_reg_arg_t pc,
+    typename R::link_hardened_reg_arg_t dso_base) {
   typename CFI_Parser<A>::PrologInfo prolog;
   if (CFI_Parser<A>::template parseFDEInstructions<R>(
           _addressSpace, fdeInfo, cieInfo, pc, R::getArch(), &prolog)) {



More information about the cfe-commits mailing list