asan_rtl.cc revision 3f5528b4112a6e63d4535c1804bee4ba310879e7
1//===-- asan_rtl.cc -------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file is a part of AddressSanitizer, an address sanity checker.
11//
12// Main file of the ASan run-time library.
13//===----------------------------------------------------------------------===//
14#include "asan_allocator.h"
15#include "asan_interceptors.h"
16#include "asan_internal.h"
17#include "asan_mapping.h"
18#include "asan_poisoning.h"
19#include "asan_report.h"
20#include "asan_stack.h"
21#include "asan_stats.h"
22#include "asan_thread.h"
23#include "sanitizer_common/sanitizer_atomic.h"
24#include "sanitizer_common/sanitizer_flags.h"
25#include "sanitizer_common/sanitizer_libc.h"
26#include "sanitizer_common/sanitizer_symbolizer.h"
27
28namespace __asan {
29
30uptr AsanMappingProfile[kAsanMappingProfileSize];
31
32static void AsanDie() {
33  static atomic_uint32_t num_calls;
34  if (atomic_fetch_add(&num_calls, 1, memory_order_relaxed) != 0) {
35    // Don't die twice - run a busy loop.
36    while (1) { }
37  }
38  if (flags()->sleep_before_dying) {
39    Report("Sleeping for %d second(s)\n", flags()->sleep_before_dying);
40    SleepForSeconds(flags()->sleep_before_dying);
41  }
42  if (flags()->unmap_shadow_on_exit) {
43    if (kMidMemBeg) {
44      UnmapOrDie((void*)kLowShadowBeg, kMidMemBeg - kLowShadowBeg);
45      UnmapOrDie((void*)kMidMemEnd, kHighShadowEnd - kMidMemEnd);
46    } else {
47      UnmapOrDie((void*)kLowShadowBeg, kHighShadowEnd - kLowShadowBeg);
48    }
49  }
50  if (death_callback)
51    death_callback();
52  if (flags()->abort_on_error)
53    Abort();
54  internal__exit(flags()->exitcode);
55}
56
57static void AsanCheckFailed(const char *file, int line, const char *cond,
58                            u64 v1, u64 v2) {
59  Report("AddressSanitizer CHECK failed: %s:%d \"%s\" (0x%zx, 0x%zx)\n",
60             file, line, cond, (uptr)v1, (uptr)v2);
61  // FIXME: check for infinite recursion without a thread-local counter here.
62  PRINT_CURRENT_STACK();
63  Die();
64}
65
66// -------------------------- Flags ------------------------- {{{1
67static const int kDefaultMallocContextSize = 30;
68
69Flags asan_flags_dont_use_directly;  // use via flags().
70
71static const char *MaybeCallAsanDefaultOptions() {
72  return (&__asan_default_options) ? __asan_default_options() : "";
73}
74
75static const char *MaybeUseAsanDefaultOptionsCompileDefiniton() {
76#ifdef ASAN_DEFAULT_OPTIONS
77// Stringize the macro value.
78# define ASAN_STRINGIZE(x) #x
79# define ASAN_STRINGIZE_OPTIONS(options) ASAN_STRINGIZE(options)
80  return ASAN_STRINGIZE_OPTIONS(ASAN_DEFAULT_OPTIONS);
81#else
82  return "";
83#endif
84}
85
86static void ParseFlagsFromString(Flags *f, const char *str) {
87  ParseFlag(str, &f->quarantine_size, "quarantine_size");
88  ParseFlag(str, &f->symbolize, "symbolize");
89  ParseFlag(str, &f->verbosity, "verbosity");
90  ParseFlag(str, &f->redzone, "redzone");
91  CHECK_GE(f->redzone, 16);
92  CHECK(IsPowerOfTwo(f->redzone));
93
94  ParseFlag(str, &f->debug, "debug");
95  ParseFlag(str, &f->report_globals, "report_globals");
96  ParseFlag(str, &f->check_initialization_order, "check_initialization_order");
97  ParseFlag(str, &f->malloc_context_size, "malloc_context_size");
98  CHECK((uptr)f->malloc_context_size <= kStackTraceMax);
99
100  ParseFlag(str, &f->replace_str, "replace_str");
101  ParseFlag(str, &f->replace_intrin, "replace_intrin");
102  ParseFlag(str, &f->mac_ignore_invalid_free, "mac_ignore_invalid_free");
103  ParseFlag(str, &f->use_fake_stack, "use_fake_stack");
104  ParseFlag(str, &f->max_malloc_fill_size, "max_malloc_fill_size");
105  ParseFlag(str, &f->malloc_fill_byte, "malloc_fill_byte");
106  ParseFlag(str, &f->exitcode, "exitcode");
107  ParseFlag(str, &f->allow_user_poisoning, "allow_user_poisoning");
108  ParseFlag(str, &f->sleep_before_dying, "sleep_before_dying");
109  ParseFlag(str, &f->handle_segv, "handle_segv");
110  ParseFlag(str, &f->use_sigaltstack, "use_sigaltstack");
111  ParseFlag(str, &f->check_malloc_usable_size, "check_malloc_usable_size");
112  ParseFlag(str, &f->unmap_shadow_on_exit, "unmap_shadow_on_exit");
113  ParseFlag(str, &f->abort_on_error, "abort_on_error");
114  ParseFlag(str, &f->print_stats, "print_stats");
115  ParseFlag(str, &f->print_legend, "print_legend");
116  ParseFlag(str, &f->atexit, "atexit");
117  ParseFlag(str, &f->disable_core, "disable_core");
118  ParseFlag(str, &f->strip_path_prefix, "strip_path_prefix");
119  ParseFlag(str, &f->allow_reexec, "allow_reexec");
120  ParseFlag(str, &f->print_full_thread_history, "print_full_thread_history");
121  ParseFlag(str, &f->log_path, "log_path");
122  ParseFlag(str, &f->fast_unwind_on_fatal, "fast_unwind_on_fatal");
123  ParseFlag(str, &f->fast_unwind_on_malloc, "fast_unwind_on_malloc");
124  ParseFlag(str, &f->poison_heap, "poison_heap");
125  ParseFlag(str, &f->alloc_dealloc_mismatch, "alloc_dealloc_mismatch");
126  ParseFlag(str, &f->use_stack_depot, "use_stack_depot");
127  ParseFlag(str, &f->strict_memcmp, "strict_memcmp");
128}
129
130static const char *asan_external_symbolizer;
131
132void InitializeFlags(Flags *f, const char *env) {
133  internal_memset(f, 0, sizeof(*f));
134
135  f->quarantine_size = (ASAN_LOW_MEMORY) ? 1UL << 26 : 1UL << 28;
136  f->symbolize = (asan_external_symbolizer != 0);
137  f->verbosity = 0;
138  f->redzone = 16;
139  f->debug = false;
140  f->report_globals = 1;
141  f->check_initialization_order = false;
142  f->malloc_context_size = kDefaultMallocContextSize;
143  f->replace_str = true;
144  f->replace_intrin = true;
145  f->mac_ignore_invalid_free = false;
146  f->use_fake_stack = true;
147  f->max_malloc_fill_size = 0x1000;  // By default, fill only the first 4K.
148  f->malloc_fill_byte = 0xbe;
149  f->exitcode = ASAN_DEFAULT_FAILURE_EXITCODE;
150  f->allow_user_poisoning = true;
151  f->sleep_before_dying = 0;
152  f->handle_segv = ASAN_NEEDS_SEGV;
153  f->use_sigaltstack = false;
154  f->check_malloc_usable_size = true;
155  f->unmap_shadow_on_exit = false;
156  f->abort_on_error = false;
157  f->print_stats = false;
158  f->print_legend = true;
159  f->atexit = false;
160  f->disable_core = (SANITIZER_WORDSIZE == 64);
161  f->strip_path_prefix = "";
162  f->allow_reexec = true;
163  f->print_full_thread_history = true;
164  f->log_path = 0;
165  f->fast_unwind_on_fatal = false;
166  f->fast_unwind_on_malloc = true;
167  f->poison_heap = true;
168  // Turn off alloc/dealloc mismatch checker on Mac for now.
169  // TODO(glider): Fix known issues and enable this back.
170  f->alloc_dealloc_mismatch = (SANITIZER_MAC == 0);;
171  f->use_stack_depot = true;  // Only affects allocator2.
172  f->strict_memcmp = true;
173
174  // Override from compile definition.
175  ParseFlagsFromString(f, MaybeUseAsanDefaultOptionsCompileDefiniton());
176
177  // Override from user-specified string.
178  ParseFlagsFromString(f, MaybeCallAsanDefaultOptions());
179  if (flags()->verbosity) {
180    Report("Using the defaults from __asan_default_options: %s\n",
181           MaybeCallAsanDefaultOptions());
182  }
183
184  // Override from command line.
185  ParseFlagsFromString(f, env);
186}
187
188// -------------------------- Globals --------------------- {{{1
189int asan_inited;
190bool asan_init_is_running;
191void (*death_callback)(void);
192
193#if !ASAN_FIXED_MAPPING
194uptr kHighMemEnd, kMidMemBeg, kMidMemEnd;
195#endif
196
197// -------------------------- Misc ---------------- {{{1
198void ShowStatsAndAbort() {
199  __asan_print_accumulated_stats();
200  Die();
201}
202
203// ---------------------- mmap -------------------- {{{1
204// Reserve memory range [beg, end].
205static void ReserveShadowMemoryRange(uptr beg, uptr end) {
206  CHECK_EQ((beg % GetPageSizeCached()), 0);
207  CHECK_EQ(((end + 1) % GetPageSizeCached()), 0);
208  uptr size = end - beg + 1;
209  void *res = MmapFixedNoReserve(beg, size);
210  if (res != (void*)beg) {
211    Report("ReserveShadowMemoryRange failed while trying to map 0x%zx bytes. "
212           "Perhaps you're using ulimit -v\n", size);
213    Abort();
214  }
215}
216
217// --------------- LowLevelAllocateCallbac ---------- {{{1
218static void OnLowLevelAllocate(uptr ptr, uptr size) {
219  PoisonShadow(ptr, size, kAsanInternalHeapMagic);
220}
221
222// -------------------------- Run-time entry ------------------- {{{1
223// exported functions
224#define ASAN_REPORT_ERROR(type, is_write, size)                     \
225extern "C" NOINLINE INTERFACE_ATTRIBUTE                        \
226void __asan_report_ ## type ## size(uptr addr);                \
227void __asan_report_ ## type ## size(uptr addr) {               \
228  GET_CALLER_PC_BP_SP;                                              \
229  __asan_report_error(pc, bp, sp, addr, is_write, size);            \
230}
231
232ASAN_REPORT_ERROR(load, false, 1)
233ASAN_REPORT_ERROR(load, false, 2)
234ASAN_REPORT_ERROR(load, false, 4)
235ASAN_REPORT_ERROR(load, false, 8)
236ASAN_REPORT_ERROR(load, false, 16)
237ASAN_REPORT_ERROR(store, true, 1)
238ASAN_REPORT_ERROR(store, true, 2)
239ASAN_REPORT_ERROR(store, true, 4)
240ASAN_REPORT_ERROR(store, true, 8)
241ASAN_REPORT_ERROR(store, true, 16)
242
243#define ASAN_REPORT_ERROR_N(type, is_write)                    \
244extern "C" NOINLINE INTERFACE_ATTRIBUTE                        \
245void __asan_report_ ## type ## _n(uptr addr, uptr size);       \
246void __asan_report_ ## type ## _n(uptr addr, uptr size) {      \
247  GET_CALLER_PC_BP_SP;                                         \
248  __asan_report_error(pc, bp, sp, addr, is_write, size);       \
249}
250
251ASAN_REPORT_ERROR_N(load, false)
252ASAN_REPORT_ERROR_N(store, true)
253
254// Force the linker to keep the symbols for various ASan interface functions.
255// We want to keep those in the executable in order to let the instrumented
256// dynamic libraries access the symbol even if it is not used by the executable
257// itself. This should help if the build system is removing dead code at link
258// time.
259static NOINLINE void force_interface_symbols() {
260  volatile int fake_condition = 0;  // prevent dead condition elimination.
261  // __asan_report_* functions are noreturn, so we need a switch to prevent
262  // the compiler from removing any of them.
263  switch (fake_condition) {
264    case 1: __asan_report_load1(0); break;
265    case 2: __asan_report_load2(0); break;
266    case 3: __asan_report_load4(0); break;
267    case 4: __asan_report_load8(0); break;
268    case 5: __asan_report_load16(0); break;
269    case 6: __asan_report_store1(0); break;
270    case 7: __asan_report_store2(0); break;
271    case 8: __asan_report_store4(0); break;
272    case 9: __asan_report_store8(0); break;
273    case 10: __asan_report_store16(0); break;
274    case 12: __asan_register_globals(0, 0); break;
275    case 13: __asan_unregister_globals(0, 0); break;
276    case 14: __asan_set_death_callback(0); break;
277    case 15: __asan_set_error_report_callback(0); break;
278    case 16: __asan_handle_no_return(); break;
279    case 17: __asan_address_is_poisoned(0); break;
280    case 18: __asan_get_allocated_size(0); break;
281    case 19: __asan_get_current_allocated_bytes(); break;
282    case 20: __asan_get_estimated_allocated_size(0); break;
283    case 21: __asan_get_free_bytes(); break;
284    case 22: __asan_get_heap_size(); break;
285    case 23: __asan_get_ownership(0); break;
286    case 24: __asan_get_unmapped_bytes(); break;
287    case 25: __asan_poison_memory_region(0, 0); break;
288    case 26: __asan_unpoison_memory_region(0, 0); break;
289    case 27: __asan_set_error_exit_code(0); break;
290    case 28: __asan_stack_free(0, 0, 0); break;
291    case 29: __asan_stack_malloc(0, 0); break;
292    case 30: __asan_before_dynamic_init(0); break;
293    case 31: __asan_after_dynamic_init(); break;
294    case 32: __asan_poison_stack_memory(0, 0); break;
295    case 33: __asan_unpoison_stack_memory(0, 0); break;
296    case 34: __asan_region_is_poisoned(0, 0); break;
297    case 35: __asan_describe_address(0); break;
298  }
299}
300
301static void asan_atexit() {
302  Printf("AddressSanitizer exit stats:\n");
303  __asan_print_accumulated_stats();
304  // Print AsanMappingProfile.
305  for (uptr i = 0; i < kAsanMappingProfileSize; i++) {
306    if (AsanMappingProfile[i] == 0) continue;
307    Printf("asan_mapping.h:%zd -- %zd\n", i, AsanMappingProfile[i]);
308  }
309}
310
311static void InitializeHighMemEnd() {
312#if !ASAN_FIXED_MAPPING
313#if SANITIZER_WORDSIZE == 64
314# if defined(__powerpc64__)
315  // FIXME:
316  // On PowerPC64 we have two different address space layouts: 44- and 46-bit.
317  // We somehow need to figure our which one we are using now and choose
318  // one of 0x00000fffffffffffUL and 0x00003fffffffffffUL.
319  // Note that with 'ulimit -s unlimited' the stack is moved away from the top
320  // of the address space, so simply checking the stack address is not enough.
321  kHighMemEnd = (1ULL << 44) - 1;  // 0x00000fffffffffffUL
322# else
323  kHighMemEnd = (1ULL << 47) - 1;  // 0x00007fffffffffffUL;
324# endif
325#else  // SANITIZER_WORDSIZE == 32
326  kHighMemEnd = (1ULL << 32) - 1;  // 0xffffffff;
327#endif  // SANITIZER_WORDSIZE
328#endif  // !ASAN_FIXED_MAPPING
329}
330
331static void ProtectGap(uptr a, uptr size) {
332  CHECK_EQ(a, (uptr)Mprotect(a, size));
333}
334
335static void PrintAddressSpaceLayout() {
336  Printf("|| `[%p, %p]` || HighMem    ||\n",
337         (void*)kHighMemBeg, (void*)kHighMemEnd);
338  Printf("|| `[%p, %p]` || HighShadow ||\n",
339         (void*)kHighShadowBeg, (void*)kHighShadowEnd);
340  if (kMidMemBeg) {
341    Printf("|| `[%p, %p]` || ShadowGap3 ||\n",
342           (void*)kShadowGap3Beg, (void*)kShadowGap3End);
343    Printf("|| `[%p, %p]` || MidMem     ||\n",
344           (void*)kMidMemBeg, (void*)kMidMemEnd);
345    Printf("|| `[%p, %p]` || ShadowGap2 ||\n",
346           (void*)kShadowGap2Beg, (void*)kShadowGap2End);
347    Printf("|| `[%p, %p]` || MidShadow  ||\n",
348           (void*)kMidShadowBeg, (void*)kMidShadowEnd);
349  }
350  Printf("|| `[%p, %p]` || ShadowGap  ||\n",
351         (void*)kShadowGapBeg, (void*)kShadowGapEnd);
352  if (kLowShadowBeg) {
353    Printf("|| `[%p, %p]` || LowShadow  ||\n",
354           (void*)kLowShadowBeg, (void*)kLowShadowEnd);
355    Printf("|| `[%p, %p]` || LowMem     ||\n",
356           (void*)kLowMemBeg, (void*)kLowMemEnd);
357  }
358  Printf("MemToShadow(shadow): %p %p %p %p",
359         (void*)MEM_TO_SHADOW(kLowShadowBeg),
360         (void*)MEM_TO_SHADOW(kLowShadowEnd),
361         (void*)MEM_TO_SHADOW(kHighShadowBeg),
362         (void*)MEM_TO_SHADOW(kHighShadowEnd));
363  if (kMidMemBeg) {
364    Printf(" %p %p",
365           (void*)MEM_TO_SHADOW(kMidShadowBeg),
366           (void*)MEM_TO_SHADOW(kMidShadowEnd));
367  }
368  Printf("\n");
369  Printf("red_zone=%zu\n", (uptr)flags()->redzone);
370  Printf("malloc_context_size=%zu\n", (uptr)flags()->malloc_context_size);
371
372  Printf("SHADOW_SCALE: %zx\n", (uptr)SHADOW_SCALE);
373  Printf("SHADOW_GRANULARITY: %zx\n", (uptr)SHADOW_GRANULARITY);
374  Printf("SHADOW_OFFSET: %zx\n", (uptr)SHADOW_OFFSET);
375  CHECK(SHADOW_SCALE >= 3 && SHADOW_SCALE <= 7);
376  if (kMidMemBeg)
377    CHECK(kMidShadowBeg > kLowShadowEnd &&
378          kMidMemBeg > kMidShadowEnd &&
379          kHighShadowBeg > kMidMemEnd);
380}
381
382}  // namespace __asan
383
384// ---------------------- Interface ---------------- {{{1
385using namespace __asan;  // NOLINT
386
387#if !SANITIZER_SUPPORTS_WEAK_HOOKS
388extern "C" {
389SANITIZER_WEAK_ATTRIBUTE SANITIZER_INTERFACE_ATTRIBUTE
390const char* __asan_default_options() { return ""; }
391}  // extern "C"
392#endif
393
394int NOINLINE __asan_set_error_exit_code(int exit_code) {
395  int old = flags()->exitcode;
396  flags()->exitcode = exit_code;
397  return old;
398}
399
400void NOINLINE __asan_handle_no_return() {
401  int local_stack;
402  AsanThread *curr_thread = GetCurrentThread();
403  CHECK(curr_thread);
404  uptr PageSize = GetPageSizeCached();
405  uptr top = curr_thread->stack_top();
406  uptr bottom = ((uptr)&local_stack - PageSize) & ~(PageSize-1);
407  PoisonShadow(bottom, top - bottom, 0);
408}
409
410void NOINLINE __asan_set_death_callback(void (*callback)(void)) {
411  death_callback = callback;
412}
413
414void __asan_init() {
415  if (asan_inited) return;
416  SanitizerToolName = "AddressSanitizer";
417  CHECK(!asan_init_is_running && "ASan init calls itself!");
418  asan_init_is_running = true;
419  InitializeHighMemEnd();
420
421  // Make sure we are not statically linked.
422  AsanDoesNotSupportStaticLinkage();
423
424  // Install tool-specific callbacks in sanitizer_common.
425  SetDieCallback(AsanDie);
426  SetCheckFailedCallback(AsanCheckFailed);
427  SetPrintfAndReportCallback(AppendToErrorMessageBuffer);
428
429  // Check if external symbolizer is defined before parsing the flags.
430  asan_external_symbolizer = GetEnv("ASAN_SYMBOLIZER_PATH");
431  // Initialize flags. This must be done early, because most of the
432  // initialization steps look at flags().
433  const char *options = GetEnv("ASAN_OPTIONS");
434  InitializeFlags(flags(), options);
435  __sanitizer_set_report_path(flags()->log_path);
436
437  if (flags()->verbosity && options) {
438    Report("Parsed ASAN_OPTIONS: %s\n", options);
439  }
440
441  // Re-exec ourselves if we need to set additional env or command line args.
442  MaybeReexec();
443
444  // Setup internal allocator callback.
445  SetLowLevelAllocateCallback(OnLowLevelAllocate);
446
447  if (flags()->atexit) {
448    Atexit(asan_atexit);
449  }
450
451  // interceptors
452  InitializeAsanInterceptors();
453
454  ReplaceSystemMalloc();
455  ReplaceOperatorsNewAndDelete();
456
457  uptr shadow_start = kLowShadowBeg;
458  if (kLowShadowBeg) shadow_start -= GetMmapGranularity();
459  uptr shadow_end = kHighShadowEnd;
460  bool full_shadow_is_available =
461      MemoryRangeIsAvailable(shadow_start, shadow_end);
462
463#if SANITIZER_LINUX && defined(__x86_64__) && !ASAN_FIXED_MAPPING
464  if (!full_shadow_is_available) {
465    kMidMemBeg = kLowMemEnd < 0x3000000000ULL ? 0x3000000000ULL : 0;
466    kMidMemEnd = kLowMemEnd < 0x3000000000ULL ? 0x4fffffffffULL : 0;
467  }
468#endif
469
470  if (flags()->verbosity)
471    PrintAddressSpaceLayout();
472
473  if (flags()->disable_core) {
474    DisableCoreDumper();
475  }
476
477  if (full_shadow_is_available) {
478    // mmap the low shadow plus at least one page at the left.
479    if (kLowShadowBeg)
480      ReserveShadowMemoryRange(shadow_start, kLowShadowEnd);
481    // mmap the high shadow.
482    ReserveShadowMemoryRange(kHighShadowBeg, kHighShadowEnd);
483    // protect the gap.
484    ProtectGap(kShadowGapBeg, kShadowGapEnd - kShadowGapBeg + 1);
485  } else if (kMidMemBeg &&
486      MemoryRangeIsAvailable(shadow_start, kMidMemBeg - 1) &&
487      MemoryRangeIsAvailable(kMidMemEnd + 1, shadow_end)) {
488    CHECK(kLowShadowBeg != kLowShadowEnd);
489    // mmap the low shadow plus at least one page at the left.
490    ReserveShadowMemoryRange(shadow_start, kLowShadowEnd);
491    // mmap the mid shadow.
492    ReserveShadowMemoryRange(kMidShadowBeg, kMidShadowEnd);
493    // mmap the high shadow.
494    ReserveShadowMemoryRange(kHighShadowBeg, kHighShadowEnd);
495    // protect the gaps.
496    ProtectGap(kShadowGapBeg, kShadowGapEnd - kShadowGapBeg + 1);
497    ProtectGap(kShadowGap2Beg, kShadowGap2End - kShadowGap2Beg + 1);
498    ProtectGap(kShadowGap3Beg, kShadowGap3End - kShadowGap3Beg + 1);
499  } else {
500    Report("Shadow memory range interleaves with an existing memory mapping. "
501           "ASan cannot proceed correctly. ABORTING.\n");
502    DumpProcessMap();
503    Die();
504  }
505
506  InstallSignalHandlers();
507  // Start symbolizer process if necessary.
508  if (flags()->symbolize && asan_external_symbolizer &&
509      asan_external_symbolizer[0]) {
510    InitializeExternalSymbolizer(asan_external_symbolizer);
511  }
512
513  // On Linux AsanThread::ThreadStart() calls malloc() that's why asan_inited
514  // should be set to 1 prior to initializing the threads.
515  asan_inited = 1;
516  asan_init_is_running = false;
517
518  // Create main thread.
519  AsanTSDInit(AsanThread::TSDDtor);
520  AsanThread *main_thread = AsanThread::Create(0, 0);
521  CreateThreadContextArgs create_main_args = { main_thread, 0 };
522  u32 main_tid = asanThreadRegistry().CreateThread(
523      0, true, 0, &create_main_args);
524  CHECK_EQ(0, main_tid);
525  SetCurrentThread(main_thread);
526  main_thread->ThreadStart(GetPid());
527  force_interface_symbols();  // no-op.
528
529  InitializeAllocator();
530
531  if (flags()->verbosity) {
532    Report("AddressSanitizer Init done\n");
533  }
534}
535