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