[PATCH] D64022: [TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.5

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 10:44:30 PDT 2019


yln created this revision.
yln added a reviewer: dvyukov.
Herald added subscribers: llvm-commits, Sanitizers, kristof.beyls, javed.absar, kubamracek.
Herald added projects: Sanitizers, LLVM.

Remove unnecessary computation of mangled SP for ARM64 architecture.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64022

Files:
  compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S


Index: compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S
===================================================================
--- compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S
+++ compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S
@@ -113,18 +113,8 @@
   CFI_OFFSET (19, -16)
   mov     x19, x0
 
-#if !defined(__APPLE__)
-  // SP pointer mangling (see glibc setjmp)
-  adrp    x2, __tsan_pointer_chk_guard
-  ldr     x2, [x2, #:lo12:__tsan_pointer_chk_guard]
-  add     x0, x29, 32
-  eor     x1, x2, x0
-#else
-  adrp    x2, ___tsan_darwin_setjmp_xor_key at page
-  ldr     x2, [x2, ___tsan_darwin_setjmp_xor_key at pageoff]
+  // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
   add     x0, x29, 32
-  eor     x1, x2, x0
-#endif
 
   // call tsan interceptor
   bl      ASM_SYMBOL(__tsan_setjmp)
@@ -173,18 +163,8 @@
   CFI_OFFSET (19, -16)
   mov     x19, x0
 
-#if !defined(__APPLE__)
-  // SP pointer mangling (see glibc setjmp)
-  adrp    x2, __tsan_pointer_chk_guard
-  ldr     x2, [x2, #:lo12:__tsan_pointer_chk_guard]
-  add     x0, x29, 32
-  eor     x1, x2, x0
-#else
-  adrp    x2, ___tsan_darwin_setjmp_xor_key at page
-  ldr     x2, [x2, ___tsan_darwin_setjmp_xor_key at pageoff]
+  // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
   add     x0, x29, 32
-  eor     x1, x2, x0
-#endif
 
   // call tsan interceptor
   bl      ASM_SYMBOL(__tsan_setjmp)
@@ -235,18 +215,8 @@
   mov     w20, w1
   mov     x19, x0
 
-#if !defined(__APPLE__)
-  // SP pointer mangling (see glibc setjmp)
-  adrp    x2, __tsan_pointer_chk_guard
-  ldr     x2, [x2, #:lo12:__tsan_pointer_chk_guard]
-  add     x0, x29, 32
-  eor     x1, x2, x0
-#else
-  adrp    x2, ___tsan_darwin_setjmp_xor_key at page
-  ldr     x2, [x2, ___tsan_darwin_setjmp_xor_key at pageoff]
+  // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
   add     x0, x29, 32
-  eor     x1, x2, x0
-#endif
 
   // call tsan interceptor
   bl      ASM_SYMBOL(__tsan_setjmp)
@@ -300,13 +270,8 @@
   mov     w20, w1
   mov     x19, x0
 
-#if !defined(__APPLE__)
-  // SP pointer mangling (see glibc setjmp)
-  adrp    x2, __tsan_pointer_chk_guard
-  ldr     x2, [x2, #:lo12:__tsan_pointer_chk_guard]
+  // Obtain SP, first argument to `void __tsan_setjmp(uptr sp)`
   add     x0, x29, 32
-  eor     x1, x2, x0
-#endif
 
   // call tsan interceptor
   bl      ASM_SYMBOL(__tsan_setjmp)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64022.207375.patch
Type: text/x-patch
Size: 2344 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190701/8969dfce/attachment.bin>


More information about the llvm-commits mailing list