[asan] fix one more async-signal-safety issue with use-after-return

llvm-svn: 191004
This commit is contained in:
Kostya Serebryany 2013-09-19 14:59:52 +00:00
parent ed6e97d2c3
commit f8bbdfaf95
2 changed files with 7 additions and 4 deletions

View File

@ -174,10 +174,10 @@ thread_return_t AsanThread::ThreadStart(uptr os_id) {
}
void AsanThread::SetThreadStackAndTls() {
uptr stack_size = 0, tls_size = 0;
GetThreadStackAndTls(tid() == 0, &stack_bottom_, &stack_size, &tls_begin_,
uptr tls_size = 0;
GetThreadStackAndTls(tid() == 0, &stack_bottom_, &stack_size_, &tls_begin_,
&tls_size);
stack_top_ = stack_bottom_ + stack_size;
stack_top_ = stack_bottom_ + stack_size_;
tls_end_ = tls_begin_ + tls_size;
int local;

View File

@ -62,7 +62,7 @@ class AsanThread {
uptr stack_top() { return stack_top_; }
uptr stack_bottom() { return stack_bottom_; }
uptr stack_size() { return stack_top_ - stack_bottom_; }
uptr stack_size() { return stack_size_; }
uptr tls_begin() { return tls_begin_; }
uptr tls_end() { return tls_end_; }
u32 tid() { return context_->tid; }
@ -116,6 +116,9 @@ class AsanThread {
void *arg_;
uptr stack_top_;
uptr stack_bottom_;
// stack_size_ == stack_top_ - stack_bottom_;
// It needs to be set in a async-signal-safe manner.
uptr stack_size_;
uptr tls_begin_;
uptr tls_end_;