diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2014-06-06 15:56:08 +0000 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2014-06-06 15:56:08 +0000 |
| commit | 75f5cf657eb8036bcd2d49df9933568e6fa3df43 (patch) | |
| tree | 40c5c54619e39f6ff119dde19be472855999c329 /compiler-rt | |
| parent | 32336152afebf2eef782576b931fd1ed09c83066 (diff) | |
| download | bcm5719-llvm-75f5cf657eb8036bcd2d49df9933568e6fa3df43.tar.gz bcm5719-llvm-75f5cf657eb8036bcd2d49df9933568e6fa3df43.zip | |
tsan: fix out-of-bounds access in Go runtime
FuncEntry can resize the shadow stack, while "thr->shadow_stack_pos[0] = pc" writes out-of-bounds.
llvm-svn: 210349
Diffstat (limited to 'compiler-rt')
| -rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_rtl.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl.cc index fe959715f1c..add6bd76947 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.cc @@ -423,13 +423,11 @@ void ForkChildAfter(ThreadState *thr, uptr pc) { u32 CurrentStackId(ThreadState *thr, uptr pc) { if (thr->shadow_stack_pos == 0) // May happen during bootstrap. return 0; - if (pc) { - thr->shadow_stack_pos[0] = pc; - thr->shadow_stack_pos++; - } + if (pc != 0) + FuncEntry(thr, pc); // can resize the shadow stack u32 id = StackDepotPut(thr->shadow_stack, thr->shadow_stack_pos - thr->shadow_stack); - if (pc) + if (pc != 0) thr->shadow_stack_pos--; return id; } |

