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

Daniil Kovalev via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 22 09:59:15 PDT 2025


================
@@ -680,11 +682,19 @@ int CompactUnwinder_arm64<A>::stepWithCompactEncodingFrame(
     savedRegisterLoc -= 8;
   }
 
-  uint64_t fp = registers.getFP();
+  Registers_arm64::reg_t fp = registers.getFP();
   // fp points to old fp
   registers.setFP(addressSpace.get64(fp));
-  // old sp is fp less saved fp and lr
+
+  // old sp is fp less saved fp and lr. Set this before FP & LR because in
+  // arm64e it's the discriminator used for those registers.
   registers.setSP(fp + 16);
+
+  Registers_arm64::reg_t oldfp = addressSpace.get64(fp);
+
+  // fp points to old fp
+  registers.setFP(oldfp);
----------------
kovdan01 wrote:

It's unclear whether FP is signed or not. `setFP` and `getFP` functions just trivially return or assign desired values without any auth or sign logic (while `setIP` and `getIP` contain such logic).

If FP is signed, I suppose `setFP` and `getFP` should have similar logic as well. Otherwise, if FP is not signed, this piece of code seems redundant, just as mentioned by @atrosinenko 

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


More information about the libcxx-commits mailing list