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