[PATCH] D63942: [TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.2
Julian Lettner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 1 10:40:44 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL364818: [TSan] Improve handling of stack pointer mangling in {set,long}jmp, pt.2 (authored by yln, committed by ).
Herald added a subscriber: delcypher.
Changed prior to commit:
https://reviews.llvm.org/D63942?vs=207094&id=207372#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63942/new/
https://reviews.llvm.org/D63942
Files:
compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
Index: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
===================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
@@ -486,7 +486,7 @@
}
}
-static void SetJmp(ThreadState *thr, uptr sp, uptr mangled_sp) {
+static void SetJmp(ThreadState *thr, uptr sp) {
if (!thr->is_inited) // called from libc guts during bootstrap
return;
// Cleanup old bufs.
@@ -494,7 +494,6 @@
// Remember the buf.
JmpBuf *buf = thr->jmp_bufs.PushBack();
buf->sp = sp;
- buf->mangled_sp = mangled_sp;
buf->shadow_stack_pos = thr->shadow_stack_pos;
ThreadSignalContext *sctx = SigCtx(thr);
buf->int_signal_send = sctx ? sctx->int_signal_send : 0;
@@ -529,12 +528,10 @@
# endif
#endif
uptr sp = UnmangleLongJmpSp(mangled_sp);
- // Find the saved buf by mangled_sp.
+ // Find the saved buf with matching sp.
for (uptr i = 0; i < thr->jmp_bufs.Size(); i++) {
JmpBuf *buf = &thr->jmp_bufs[i];
- if (buf->mangled_sp == mangled_sp) {
- CHECK_EQ(buf->sp, sp);
- // TODO(yln): Lookup via sp, remove mangled_sp from struct.
+ if (buf->sp == sp) {
CHECK_GE(thr->shadow_stack_pos, buf->shadow_stack_pos);
// Unwind the stack.
while (thr->shadow_stack_pos > buf->shadow_stack_pos)
@@ -558,7 +555,7 @@
// FIXME: put everything below into a common extern "C" block?
extern "C" void __tsan_setjmp(uptr sp, uptr mangled_sp) {
cur_thread_init();
- SetJmp(cur_thread(), sp, mangled_sp);
+ SetJmp(cur_thread(), sp);
}
#if SANITIZER_MAC
Index: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
===================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
@@ -325,7 +325,6 @@
struct JmpBuf {
uptr sp;
- uptr mangled_sp;
int int_signal_send;
bool in_blocking_func;
uptr in_signal_handler;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63942.207372.patch
Type: text/x-patch
Size: 1969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190701/80482ad2/attachment.bin>
More information about the llvm-commits
mailing list