| 1 |
#include "hwasan_thread_list.h" |
| 2 |
|
| 3 |
#include "sanitizer_common/sanitizer_placement_new.h" |
| 4 |
#include "sanitizer_common/sanitizer_thread_arg_retval.h" |
| 5 |
|
| 6 |
namespace __hwasan { |
| 7 |
|
| 8 |
static HwasanThreadList *hwasan_thread_list; |
| 9 |
static ThreadArgRetval *thread_data; |
| 10 |
|
| 11 |
HwasanThreadList &hwasanThreadList() { return *hwasan_thread_list; } |
| 12 |
ThreadArgRetval &hwasanThreadArgRetval() { return *thread_data; } |
| 13 |
|
| 14 |
void InitThreadList(uptr storage, uptr size) { |
| 15 |
CHECK_EQ(hwasan_thread_list, nullptr); |
| 16 |
|
| 17 |
alignas(alignof(HwasanThreadList)) static char |
| 18 |
thread_list_placeholder[sizeof(HwasanThreadList)]; |
| 19 |
hwasan_thread_list = |
| 20 |
new (thread_list_placeholder) HwasanThreadList(storage, size); |
| 21 |
|
| 22 |
CHECK_EQ(thread_data, nullptr); |
| 23 |
|
| 24 |
alignas(alignof(ThreadArgRetval)) static char |
| 25 |
thread_data_placeholder[sizeof(ThreadArgRetval)]; |
| 26 |
thread_data = new (thread_data_placeholder) ThreadArgRetval(); |
| 27 |
} |
| 28 |
|
| 29 |
} // namespace __hwasan |