================ @@ -1845,8 +1884,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 auth(_registers.__pc, getAuthSalt()); } + void setIP(uint64_t value) { + // First authenticate the current value of the IP to ensure the context + // is still valid. This also ensure the setIP can't be used for signing + // arbitrary values. + auth(_registers.__pc, getAuthSalt()); ---------------- DanielKristofKiss wrote:
I have created a version that supports pauth_intrinsics too and made the NOP variant similar to it as possible. In some configs we can't use the armv8.3 instruction set so for those scenarios I left the NOP space instructions version. I had to split the signed PC into 2 parts as there is no guarantee for the passes LR doesn't contains significant bits in the location of the PAC bits. Now any value could be in LR as libunwind will preserve it. https://github.com/llvm/llvm-project/pull/113368 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits