diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2013-10-16 15:35:12 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2013-10-16 15:35:12 +0000 |
commit | 01a7ce809bf7cc627d73c045c70bcca9891f632c (patch) | |
tree | a1842a84d98e9864554665ffb352bf9c198b3d03 /lib/tsan/tests | |
parent | cca8e781e5353cba810a0ec3a814ddde2c4934e7 (diff) | |
download | compiler-rt-01a7ce809bf7cc627d73c045c70bcca9891f632c.tar.gz compiler-rt-01a7ce809bf7cc627d73c045c70bcca9891f632c.tar.bz2 compiler-rt-01a7ce809bf7cc627d73c045c70bcca9891f632c.tar.xz |
tsan: move shadow stack from thread descriptors to fixed addresses
This allows to increase max shadow stack size to 64K,
and reliably catch shadow stack overflows instead of silently
corrupting memory.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192797 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/tests')
-rw-r--r-- | lib/tsan/tests/unit/tsan_stack_test.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/tsan/tests/unit/tsan_stack_test.cc b/lib/tsan/tests/unit/tsan_stack_test.cc index d5392959..9aa29676 100644 --- a/lib/tsan/tests/unit/tsan_stack_test.cc +++ b/lib/tsan/tests/unit/tsan_stack_test.cc @@ -19,6 +19,10 @@ namespace __tsan { static void TestStackTrace(StackTrace *trace) { ThreadState thr(0, 0, 0, 0, 0, 0, 0, 0); + uptr stack[128]; + thr.shadow_stack = &stack[0]; + thr.shadow_stack_pos = &stack[0]; + thr.shadow_stack_end = &stack[128]; trace->ObtainCurrent(&thr, 0); EXPECT_EQ(trace->Size(), (uptr)0); @@ -60,7 +64,12 @@ TEST(StackTrace, StaticTrim) { ScopedInRtl in_rtl; uptr buf[2]; StackTrace trace(buf, 2); + ThreadState thr(0, 0, 0, 0, 0, 0, 0, 0); + uptr stack[128]; + thr.shadow_stack = &stack[0]; + thr.shadow_stack_pos = &stack[0]; + thr.shadow_stack_end = &stack[128]; *thr.shadow_stack_pos++ = 100; *thr.shadow_stack_pos++ = 101; |