================ @@ -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()); ---------------- asl wrote:
Since we're already having support for pointer authentication in frontend, I think it would make sense to use pauth builtins (e.g. `__builtin_ptrauth_auth_and_resign`). Then backend will do necessary things depending on the target features (e.g. if FPAC is enabled) 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