diff options
| author | Walter Lee <waltl@google.com> | 2018-05-10 20:09:03 +0000 |
|---|---|---|
| committer | Walter Lee <waltl@google.com> | 2018-05-10 20:09:03 +0000 |
| commit | 3bde9622555f685e8d8d25c71133093c7ab9ce48 (patch) | |
| tree | 0e65501db22c986a6897851250dca82f52d75b8b /compiler-rt/lib | |
| parent | c7bb14301acddcfd10df1489beee1d649a83613b (diff) | |
| download | bcm5719-llvm-3bde9622555f685e8d8d25c71133093c7ab9ce48.tar.gz bcm5719-llvm-3bde9622555f685e8d8d25c71133093c7ab9ce48.zip | |
[asan] Initialize fake stack during thread init
If detect-stack-use-after-return is on, initialize fake stack during
AsanThread::Init(), rather than lazily. This is required on Myriad.
From kcc: "There used to be a reason why this was done lazily, but I
don't remember if we still have that reason." Tested on x86.
Differential Revision: https://reviews.llvm.org/D46626
llvm-svn: 332033
Diffstat (limited to 'compiler-rt/lib')
| -rw-r--r-- | compiler-rt/lib/asan/asan_thread.cc | 4 | ||||
| -rw-r--r-- | compiler-rt/lib/asan/asan_thread.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler-rt/lib/asan/asan_thread.cc b/compiler-rt/lib/asan/asan_thread.cc index 4a8779f0397..b6ca1df8f1b 100644 --- a/compiler-rt/lib/asan/asan_thread.cc +++ b/compiler-rt/lib/asan/asan_thread.cc @@ -221,13 +221,15 @@ FakeStack *AsanThread::AsyncSignalSafeLazyInitFakeStack() { void AsanThread::Init(const InitOptions *options) { next_stack_top_ = next_stack_bottom_ = 0; atomic_store(&stack_switching_, false, memory_order_release); - fake_stack_ = nullptr; // Will be initialized lazily if needed. CHECK_EQ(this->stack_size(), 0U); SetThreadStackAndTls(options); CHECK_GT(this->stack_size(), 0U); CHECK(AddrIsInMem(stack_bottom_)); CHECK(AddrIsInMem(stack_top_ - 1)); ClearShadowForThreadStackAndTLS(); + fake_stack_ = nullptr; + if (__asan_option_detect_stack_use_after_return) + AsyncSignalSafeLazyInitFakeStack(); int local = 0; VReport(1, "T%d: stack [%p,%p) size 0x%zx; local=%p\n", tid(), (void *)stack_bottom_, (void *)stack_top_, stack_top_ - stack_bottom_, diff --git a/compiler-rt/lib/asan/asan_thread.h b/compiler-rt/lib/asan/asan_thread.h index 66091921101..a3052ec8004 100644 --- a/compiler-rt/lib/asan/asan_thread.h +++ b/compiler-rt/lib/asan/asan_thread.h @@ -117,8 +117,6 @@ class AsanThread { return nullptr; if (atomic_load(&stack_switching_, memory_order_relaxed)) return nullptr; - if (!has_fake_stack()) - return AsyncSignalSafeLazyInitFakeStack(); return fake_stack_; } |

