Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions compiler-rt/lib/asan/asan_fake_stack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,12 @@ void FakeStack::ForEachFakeFrame(RangeIteratorCallback callback, void* arg) {
static THREADLOCAL FakeStack* fake_stack_tls;

static FakeStack* GetTLSFakeStack() { return fake_stack_tls; }
void SetTLSFakeStack(FakeStack* fs) { fake_stack_tls = fs; }
static void SetTLSFakeStack(FakeStack* fs) { fake_stack_tls = fs; }
void ResetTLSFakeStack() { fake_stack_tls = nullptr; }
#else
static FakeStack* GetTLSFakeStack() { return nullptr; }
void SetTLSFakeStack(FakeStack* fs) {}
static void SetTLSFakeStack(FakeStack*) {}
void ResetTLSFakeStack() {}
#endif // (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_FUCHSIA

static FakeStack* GetFakeStack() {
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/asan/asan_fake_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class FakeStack {
void *true_start;
};

void SetTLSFakeStack(FakeStack* fs);
void ResetTLSFakeStack();

} // namespace __asan

Expand Down
6 changes: 3 additions & 3 deletions compiler-rt/lib/asan/asan_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void AsanThread::StartSwitchFiber(FakeStack **fake_stack_save, uptr bottom,
if (fake_stack_save)
*fake_stack_save = fake_stack_;
fake_stack_ = nullptr;
SetTLSFakeStack(nullptr);
ResetTLSFakeStack();
// if fake_stack_save is null, the fiber will die, delete the fakestack
if (!fake_stack_save && current_fake_stack)
current_fake_stack->Destroy(this->tid());
Expand All @@ -177,8 +177,8 @@ void AsanThread::FinishSwitchFiber(FakeStack *fake_stack_save, uptr *bottom_old,
}

if (fake_stack_save) {
SetTLSFakeStack(fake_stack_save);
fake_stack_ = fake_stack_save;
ResetTLSFakeStack();
}

if (bottom_old)
Expand Down Expand Up @@ -242,7 +242,7 @@ FakeStack *AsanThread::AsyncSignalSafeLazyInitFakeStack() {
Max(stack_size_log, static_cast<uptr>(flags()->min_uar_stack_size_log));
fake_stack_ = FakeStack::Create(stack_size_log);
DCHECK_EQ(GetCurrentThread(), this);
SetTLSFakeStack(fake_stack_);
ResetTLSFakeStack();
return fake_stack_;
}
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/asan/asan_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class AsanThread {
if (!fake_stack_) return;
FakeStack *t = fake_stack_;
fake_stack_ = nullptr;
SetTLSFakeStack(nullptr);
ResetTLSFakeStack();
t->Destroy(tid);
}

Expand Down