File: hwasan_thread_list.cpp

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-19
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,999,616 kB
  • sloc: cpp: 6,951,724; ansic: 1,486,157; asm: 913,598; python: 232,059; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,079; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,430; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (29 lines) | stat: -rw-r--r-- 907 bytes parent folder | download | duplicates (17)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "hwasan_thread_list.h"

#include "sanitizer_common/sanitizer_placement_new.h"
#include "sanitizer_common/sanitizer_thread_arg_retval.h"

namespace __hwasan {

static HwasanThreadList *hwasan_thread_list;
static ThreadArgRetval *thread_data;

HwasanThreadList &hwasanThreadList() { return *hwasan_thread_list; }
ThreadArgRetval &hwasanThreadArgRetval() { return *thread_data; }

void InitThreadList(uptr storage, uptr size) {
  CHECK_EQ(hwasan_thread_list, nullptr);

  alignas(alignof(HwasanThreadList)) static char
      thread_list_placeholder[sizeof(HwasanThreadList)];
  hwasan_thread_list =
      new (thread_list_placeholder) HwasanThreadList(storage, size);

  CHECK_EQ(thread_data, nullptr);

  alignas(alignof(ThreadArgRetval)) static char
      thread_data_placeholder[sizeof(ThreadArgRetval)];
  thread_data = new (thread_data_placeholder) ThreadArgRetval();
}

}  // namespace __hwasan