[libunwind] [libunwind][AArch64] Protect PC within libunwind's context. (PR #113368)

Anton Korobeynikov via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 6 13:21:43 PDT 2025


================
@@ -1845,8 +1986,14 @@ class _LIBUNWIND_HIDDEN Registers_arm64 {
 
   uint64_t  getSP() const         { return _registers.__sp; }
   void      setSP(uint64_t value) { _registers.__sp = value; }
-  uint64_t  getIP() const         { return _registers.__pc; }
-  void      setIP(uint64_t value) { _registers.__pc = value; }
+  uint64_t getIP() const { return authPC(&_registers, getDiscriminator()); }
+  void setIP(uint64_t value) {
+    // First authenticate the current value of the IP to ensure the context
----------------
asl wrote:

Will you please expand how this would work? As far as I can see, the `value` above comes from outside (e.g. from `setRegister` call). Is this just saved unsigned PC that is located somewhere on the stack? So it could be substituted and then organized in ROP-like chain during unwinding process?

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


More information about the cfe-commits mailing list