[PATCH] D63946: [TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.4
Julian Lettner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 28 11:30:17 PDT 2019
yln created this revision.
yln added a reviewer: dvyukov.
Herald added subscribers: llvm-commits, Sanitizers, kubamracek.
Herald added projects: Sanitizers, LLVM.
Since we don't clobber %rsi (2nd argument) anymore, we don't have to
save/restore it.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D63946
Files:
compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S
Index: compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S
===================================================================
--- compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S
+++ compiler-rt/lib/tsan/rtl/tsan_rtl_amd64.S
@@ -271,30 +271,16 @@
push %rdi
CFI_ADJUST_CFA_OFFSET(8)
CFI_REL_OFFSET(%rdi, 0)
- // save savesigs parameter
- push %rsi
- CFI_ADJUST_CFA_OFFSET(8)
- CFI_REL_OFFSET(%rsi, 0)
- // align stack frame
- sub $8, %rsp
- CFI_ADJUST_CFA_OFFSET(8)
// obtain SP, store in %rdi, first argument to `void __tsan_setjmp(uptr sp)`
#if defined(__FreeBSD__) || defined(__NetBSD__)
- lea 24(%rsp), %rdi
+ lea 8(%rsp), %rdi
#elif defined(__linux__) || defined(__APPLE__)
- lea 32(%rsp), %rdi
+ lea 16(%rsp), %rdi
#else
# error "Unknown platform"
#endif
// call tsan interceptor
call ASM_SYMBOL(__tsan_setjmp)
- // unalign stack frame
- add $8, %rsp
- CFI_ADJUST_CFA_OFFSET(-8)
- // restore savesigs parameter
- pop %rsi
- CFI_ADJUST_CFA_OFFSET(-8)
- CFI_RESTORE(%rsi)
// restore env parameter
pop %rdi
CFI_ADJUST_CFA_OFFSET(-8)
@@ -327,28 +313,14 @@
push %rdi
CFI_ADJUST_CFA_OFFSET(8)
CFI_REL_OFFSET(%rdi, 0)
- // save savesigs parameter
- push %rsi
- CFI_ADJUST_CFA_OFFSET(8)
- CFI_REL_OFFSET(%rsi, 0)
- // align stack frame
- sub $8, %rsp
- CFI_ADJUST_CFA_OFFSET(8)
// obtain SP, store in %rdi, first argument to `void __tsan_setjmp(uptr sp)`
#if defined(__FreeBSD__)
- lea 24(%rsp), %rdi
+ lea 8(%rsp), %rdi
#else
- lea 32(%rsp), %rdi
+ lea 16(%rsp), %rdi
#endif
// call tsan interceptor
call ASM_SYMBOL(__tsan_setjmp)
- // unalign stack frame
- add $8, %rsp
- CFI_ADJUST_CFA_OFFSET(-8)
- // restore savesigs parameter
- pop %rsi
- CFI_ADJUST_CFA_OFFSET(-8)
- CFI_RESTORE(%rsi)
// restore env parameter
pop %rdi
CFI_ADJUST_CFA_OFFSET(-8)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63946.207112.patch
Type: text/x-patch
Size: 1830 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190628/d65fc3cf/attachment.bin>
More information about the llvm-commits
mailing list