[compiler-rt] b3980b5 - [Sanitizer] Strip PAC from PC in StackTrace::GetNextInstructionPc()

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 14:48:20 PDT 2021


Author: Julian Lettner
Date: 2021-10-25T14:48:09-07:00
New Revision: b3980b5b6817b1d24d96cd00c2a7389a718d2ade

URL: https://github.com/llvm/llvm-project/commit/b3980b5b6817b1d24d96cd00c2a7389a718d2ade
DIFF: https://github.com/llvm/llvm-project/commit/b3980b5b6817b1d24d96cd00c2a7389a718d2ade.diff

LOG: [Sanitizer] Strip PAC from PC in StackTrace::GetNextInstructionPc()

In TSan, we use the a function reference (`__tsan_stack_initialization`)
in a call to `StackTrace::GetNextInstructionPc(uptr pc)`.  We sign
function pointers, so we need to strip the signature from this function
pointer.

Caused by: https://reviews.llvm.org/D111147

Radar-Id: rdar://problem/83940546

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp
index 4707c6c5d00b3..37e9e6dd08d7b 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace.cpp
@@ -24,7 +24,7 @@ uptr StackTrace::GetNextInstructionPc(uptr pc) {
   return pc + 8;
 #elif defined(__powerpc__) || defined(__arm__) || defined(__aarch64__) || \
     defined(__hexagon__)
-  return pc + 4;
+  return STRIP_PAC_PC((void *)pc) + 4;
 #elif SANITIZER_RISCV64
   // Current check order is 4 -> 2 -> 6 -> 8
   u8 InsnByte = *(u8 *)(pc);


        


More information about the llvm-commits mailing list