Skip to content
Commit f9dd3ea4 authored by Enna1's avatar Enna1
Browse files

[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
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment