[hwasan] Fix data race between ReleaseThread() and VisitAllLiveThreads()
Data race scenario:
```
Thread 1 | Thread 2
ReportTagMismatch() |
Call VisitAllLiveThreads() to scan all |
threads' ring buffers to find |
if it's a heap-use-after-free. |
Lock live_list_mutex_ |
| Thread 2 exit
| ReleaseThread() calls Thread::Destroy() for Thread 2,
| which frees heap alloctions ring buffer
| RemoveThreadFromLiveList() tries to take live_list_mutex_ again
Iterate the heap alloctions ring buffer |
of Thread 2, which is already freed |
```
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D148909
parent
60766678
Please register or sign in to comment