asan_rtl.cc revision 1.7
1//===-- asan_rtl.cc -------------------------------------------------------===//
2//
3// This file is distributed under the University of Illinois Open Source
4// License. See LICENSE.TXT for details.
5//
6//===----------------------------------------------------------------------===//
7//
8// This file is a part of AddressSanitizer, an address sanity checker.
9//
10// Main file of the ASan run-time library.
11//===----------------------------------------------------------------------===//
12
13#include "asan_activation.h"
14#include "asan_allocator.h"
15#include "asan_interceptors.h"
16#include "asan_interface_internal.h"
17#include "asan_internal.h"
18#include "asan_mapping.h"
19#include "asan_poisoning.h"
20#include "asan_report.h"
21#include "asan_stack.h"
22#include "asan_stats.h"
23#include "asan_suppressions.h"
24#include "asan_thread.h"
25#include "sanitizer_common/sanitizer_atomic.h"
26#include "sanitizer_common/sanitizer_flags.h"
27#include "sanitizer_common/sanitizer_libc.h"
28#include "sanitizer_common/sanitizer_symbolizer.h"
29#include "lsan/lsan_common.h"
30#include "ubsan/ubsan_init.h"
31#include "ubsan/ubsan_platform.h"
32
33uptr __asan_shadow_memory_dynamic_address;  // Global interface symbol.
34int __asan_option_detect_stack_use_after_return;  // Global interface symbol.
35uptr *__asan_test_only_reported_buggy_pointer;  // Used only for testing asan.
36
37namespace __asan {
38
39uptr AsanMappingProfile[kAsanMappingProfileSize];
40
41static void AsanDie() {
42  static atomic_uint32_t num_calls;
43  if (atomic_fetch_add(&num_calls, 1, memory_order_relaxed) != 0) {
44    // Don't die twice - run a busy loop.
45    while (1) { }
46  }
47  if (common_flags()->print_module_map >= 1) PrintModuleMap();
48  if (flags()->sleep_before_dying) {
49    Report("Sleeping for %d second(s)\n", flags()->sleep_before_dying);
50    SleepForSeconds(flags()->sleep_before_dying);
51  }
52  if (flags()->unmap_shadow_on_exit) {
53    if (kMidMemBeg) {
54      UnmapOrDie((void*)kLowShadowBeg, kMidMemBeg - kLowShadowBeg);
55      UnmapOrDie((void*)kMidMemEnd, kHighShadowEnd - kMidMemEnd);
56    } else {
57      UnmapOrDie((void*)kLowShadowBeg, kHighShadowEnd - kLowShadowBeg);
58    }
59  }
60}
61
62static void AsanCheckFailed(const char *file, int line, const char *cond,
63                            u64 v1, u64 v2) {
64  Report("AddressSanitizer CHECK failed: %s:%d \"%s\" (0x%zx, 0x%zx)\n", file,
65         line, cond, (uptr)v1, (uptr)v2);
66  // FIXME: check for infinite recursion without a thread-local counter here.
67  PRINT_CURRENT_STACK_CHECK();
68  Die();
69}
70
71// -------------------------- Globals --------------------- {{{1
72int asan_inited;
73bool asan_init_is_running;
74
75#if !ASAN_FIXED_MAPPING
76uptr kHighMemEnd, kMidMemBeg, kMidMemEnd;
77#endif
78
79// -------------------------- Misc ---------------- {{{1
80void ShowStatsAndAbort() {
81  __asan_print_accumulated_stats();
82  Die();
83}
84
85// --------------- LowLevelAllocateCallbac ---------- {{{1
86static void OnLowLevelAllocate(uptr ptr, uptr size) {
87  PoisonShadow(ptr, size, kAsanInternalHeapMagic);
88}
89
90// -------------------------- Run-time entry ------------------- {{{1
91// exported functions
92#define ASAN_REPORT_ERROR(type, is_write, size)                     \
93extern "C" NOINLINE INTERFACE_ATTRIBUTE                             \
94void __asan_report_ ## type ## size(uptr addr) {                    \
95  GET_CALLER_PC_BP_SP;                                              \
96  ReportGenericError(pc, bp, sp, addr, is_write, size, 0, true);    \
97}                                                                   \
98extern "C" NOINLINE INTERFACE_ATTRIBUTE                             \
99void __asan_report_exp_ ## type ## size(uptr addr, u32 exp) {       \
100  GET_CALLER_PC_BP_SP;                                              \
101  ReportGenericError(pc, bp, sp, addr, is_write, size, exp, true);  \
102}                                                                   \
103extern "C" NOINLINE INTERFACE_ATTRIBUTE                             \
104void __asan_report_ ## type ## size ## _noabort(uptr addr) {        \
105  GET_CALLER_PC_BP_SP;                                              \
106  ReportGenericError(pc, bp, sp, addr, is_write, size, 0, false);   \
107}                                                                   \
108
109ASAN_REPORT_ERROR(load, false, 1)
110ASAN_REPORT_ERROR(load, false, 2)
111ASAN_REPORT_ERROR(load, false, 4)
112ASAN_REPORT_ERROR(load, false, 8)
113ASAN_REPORT_ERROR(load, false, 16)
114ASAN_REPORT_ERROR(store, true, 1)
115ASAN_REPORT_ERROR(store, true, 2)
116ASAN_REPORT_ERROR(store, true, 4)
117ASAN_REPORT_ERROR(store, true, 8)
118ASAN_REPORT_ERROR(store, true, 16)
119
120#define ASAN_REPORT_ERROR_N(type, is_write)                                 \
121extern "C" NOINLINE INTERFACE_ATTRIBUTE                                     \
122void __asan_report_ ## type ## _n(uptr addr, uptr size) {                   \
123  GET_CALLER_PC_BP_SP;                                                      \
124  ReportGenericError(pc, bp, sp, addr, is_write, size, 0, true);            \
125}                                                                           \
126extern "C" NOINLINE INTERFACE_ATTRIBUTE                                     \
127void __asan_report_exp_ ## type ## _n(uptr addr, uptr size, u32 exp) {      \
128  GET_CALLER_PC_BP_SP;                                                      \
129  ReportGenericError(pc, bp, sp, addr, is_write, size, exp, true);          \
130}                                                                           \
131extern "C" NOINLINE INTERFACE_ATTRIBUTE                                     \
132void __asan_report_ ## type ## _n_noabort(uptr addr, uptr size) {           \
133  GET_CALLER_PC_BP_SP;                                                      \
134  ReportGenericError(pc, bp, sp, addr, is_write, size, 0, false);           \
135}                                                                           \
136
137ASAN_REPORT_ERROR_N(load, false)
138ASAN_REPORT_ERROR_N(store, true)
139
140#define ASAN_MEMORY_ACCESS_CALLBACK_BODY(type, is_write, size, exp_arg, fatal) \
141    uptr sp = MEM_TO_SHADOW(addr);                                             \
142    uptr s = size <= SHADOW_GRANULARITY ? *reinterpret_cast<u8 *>(sp)          \
143                                        : *reinterpret_cast<u16 *>(sp);        \
144    if (UNLIKELY(s)) {                                                         \
145      if (UNLIKELY(size >= SHADOW_GRANULARITY ||                               \
146                   ((s8)((addr & (SHADOW_GRANULARITY - 1)) + size - 1)) >=     \
147                       (s8)s)) {                                               \
148        if (__asan_test_only_reported_buggy_pointer) {                         \
149          *__asan_test_only_reported_buggy_pointer = addr;                     \
150        } else {                                                               \
151          GET_CALLER_PC_BP_SP;                                                 \
152          ReportGenericError(pc, bp, sp, addr, is_write, size, exp_arg,        \
153                              fatal);                                          \
154        }                                                                      \
155      }                                                                        \
156    }
157
158#define ASAN_MEMORY_ACCESS_CALLBACK(type, is_write, size)                      \
159  extern "C" NOINLINE INTERFACE_ATTRIBUTE                                      \
160  void __asan_##type##size(uptr addr) {                                        \
161    ASAN_MEMORY_ACCESS_CALLBACK_BODY(type, is_write, size, 0, true)            \
162  }                                                                            \
163  extern "C" NOINLINE INTERFACE_ATTRIBUTE                                      \
164  void __asan_exp_##type##size(uptr addr, u32 exp) {                           \
165    ASAN_MEMORY_ACCESS_CALLBACK_BODY(type, is_write, size, exp, true)          \
166  }                                                                            \
167  extern "C" NOINLINE INTERFACE_ATTRIBUTE                                      \
168  void __asan_##type##size ## _noabort(uptr addr) {                            \
169    ASAN_MEMORY_ACCESS_CALLBACK_BODY(type, is_write, size, 0, false)           \
170  }                                                                            \
171
172ASAN_MEMORY_ACCESS_CALLBACK(load, false, 1)
173ASAN_MEMORY_ACCESS_CALLBACK(load, false, 2)
174ASAN_MEMORY_ACCESS_CALLBACK(load, false, 4)
175ASAN_MEMORY_ACCESS_CALLBACK(load, false, 8)
176ASAN_MEMORY_ACCESS_CALLBACK(load, false, 16)
177ASAN_MEMORY_ACCESS_CALLBACK(store, true, 1)
178ASAN_MEMORY_ACCESS_CALLBACK(store, true, 2)
179ASAN_MEMORY_ACCESS_CALLBACK(store, true, 4)
180ASAN_MEMORY_ACCESS_CALLBACK(store, true, 8)
181ASAN_MEMORY_ACCESS_CALLBACK(store, true, 16)
182
183extern "C"
184NOINLINE INTERFACE_ATTRIBUTE
185void __asan_loadN(uptr addr, uptr size) {
186  if (__asan_region_is_poisoned(addr, size)) {
187    GET_CALLER_PC_BP_SP;
188    ReportGenericError(pc, bp, sp, addr, false, size, 0, true);
189  }
190}
191
192extern "C"
193NOINLINE INTERFACE_ATTRIBUTE
194void __asan_exp_loadN(uptr addr, uptr size, u32 exp) {
195  if (__asan_region_is_poisoned(addr, size)) {
196    GET_CALLER_PC_BP_SP;
197    ReportGenericError(pc, bp, sp, addr, false, size, exp, true);
198  }
199}
200
201extern "C"
202NOINLINE INTERFACE_ATTRIBUTE
203void __asan_loadN_noabort(uptr addr, uptr size) {
204  if (__asan_region_is_poisoned(addr, size)) {
205    GET_CALLER_PC_BP_SP;
206    ReportGenericError(pc, bp, sp, addr, false, size, 0, false);
207  }
208}
209
210extern "C"
211NOINLINE INTERFACE_ATTRIBUTE
212void __asan_storeN(uptr addr, uptr size) {
213  if (__asan_region_is_poisoned(addr, size)) {
214    GET_CALLER_PC_BP_SP;
215    ReportGenericError(pc, bp, sp, addr, true, size, 0, true);
216  }
217}
218
219extern "C"
220NOINLINE INTERFACE_ATTRIBUTE
221void __asan_exp_storeN(uptr addr, uptr size, u32 exp) {
222  if (__asan_region_is_poisoned(addr, size)) {
223    GET_CALLER_PC_BP_SP;
224    ReportGenericError(pc, bp, sp, addr, true, size, exp, true);
225  }
226}
227
228extern "C"
229NOINLINE INTERFACE_ATTRIBUTE
230void __asan_storeN_noabort(uptr addr, uptr size) {
231  if (__asan_region_is_poisoned(addr, size)) {
232    GET_CALLER_PC_BP_SP;
233    ReportGenericError(pc, bp, sp, addr, true, size, 0, false);
234  }
235}
236
237// Force the linker to keep the symbols for various ASan interface functions.
238// We want to keep those in the executable in order to let the instrumented
239// dynamic libraries access the symbol even if it is not used by the executable
240// itself. This should help if the build system is removing dead code at link
241// time.
242static NOINLINE void force_interface_symbols() {
243  volatile int fake_condition = 0;  // prevent dead condition elimination.
244  // __asan_report_* functions are noreturn, so we need a switch to prevent
245  // the compiler from removing any of them.
246  // clang-format off
247  switch (fake_condition) {
248    case 1: __asan_report_load1(0); break;
249    case 2: __asan_report_load2(0); break;
250    case 3: __asan_report_load4(0); break;
251    case 4: __asan_report_load8(0); break;
252    case 5: __asan_report_load16(0); break;
253    case 6: __asan_report_load_n(0, 0); break;
254    case 7: __asan_report_store1(0); break;
255    case 8: __asan_report_store2(0); break;
256    case 9: __asan_report_store4(0); break;
257    case 10: __asan_report_store8(0); break;
258    case 11: __asan_report_store16(0); break;
259    case 12: __asan_report_store_n(0, 0); break;
260    case 13: __asan_report_exp_load1(0, 0); break;
261    case 14: __asan_report_exp_load2(0, 0); break;
262    case 15: __asan_report_exp_load4(0, 0); break;
263    case 16: __asan_report_exp_load8(0, 0); break;
264    case 17: __asan_report_exp_load16(0, 0); break;
265    case 18: __asan_report_exp_load_n(0, 0, 0); break;
266    case 19: __asan_report_exp_store1(0, 0); break;
267    case 20: __asan_report_exp_store2(0, 0); break;
268    case 21: __asan_report_exp_store4(0, 0); break;
269    case 22: __asan_report_exp_store8(0, 0); break;
270    case 23: __asan_report_exp_store16(0, 0); break;
271    case 24: __asan_report_exp_store_n(0, 0, 0); break;
272    case 25: __asan_register_globals(nullptr, 0); break;
273    case 26: __asan_unregister_globals(nullptr, 0); break;
274    case 27: __asan_set_death_callback(nullptr); break;
275    case 28: __asan_set_error_report_callback(nullptr); break;
276    case 29: __asan_handle_no_return(); break;
277    case 30: __asan_address_is_poisoned(nullptr); break;
278    case 31: __asan_poison_memory_region(nullptr, 0); break;
279    case 32: __asan_unpoison_memory_region(nullptr, 0); break;
280    case 34: __asan_before_dynamic_init(nullptr); break;
281    case 35: __asan_after_dynamic_init(); break;
282    case 36: __asan_poison_stack_memory(0, 0); break;
283    case 37: __asan_unpoison_stack_memory(0, 0); break;
284    case 38: __asan_region_is_poisoned(0, 0); break;
285    case 39: __asan_describe_address(0); break;
286    case 40: __asan_set_shadow_00(0, 0); break;
287    case 41: __asan_set_shadow_f1(0, 0); break;
288    case 42: __asan_set_shadow_f2(0, 0); break;
289    case 43: __asan_set_shadow_f3(0, 0); break;
290    case 44: __asan_set_shadow_f5(0, 0); break;
291    case 45: __asan_set_shadow_f8(0, 0); break;
292  }
293  // clang-format on
294}
295
296static void asan_atexit() {
297  Printf("AddressSanitizer exit stats:\n");
298  __asan_print_accumulated_stats();
299  // Print AsanMappingProfile.
300  for (uptr i = 0; i < kAsanMappingProfileSize; i++) {
301    if (AsanMappingProfile[i] == 0) continue;
302    Printf("asan_mapping.h:%zd -- %zd\n", i, AsanMappingProfile[i]);
303  }
304}
305
306static void InitializeHighMemEnd() {
307#if !ASAN_FIXED_MAPPING
308  kHighMemEnd = GetMaxVirtualAddress();
309  // Increase kHighMemEnd to make sure it's properly
310  // aligned together with kHighMemBeg:
311  kHighMemEnd |= SHADOW_GRANULARITY * GetMmapGranularity() - 1;
312#endif  // !ASAN_FIXED_MAPPING
313  CHECK_EQ((kHighMemBeg % GetMmapGranularity()), 0);
314}
315
316void PrintAddressSpaceLayout() {
317  Printf("|| `[%p, %p]` || HighMem    ||\n",
318         (void*)kHighMemBeg, (void*)kHighMemEnd);
319  Printf("|| `[%p, %p]` || HighShadow ||\n",
320         (void*)kHighShadowBeg, (void*)kHighShadowEnd);
321  if (kMidMemBeg) {
322    Printf("|| `[%p, %p]` || ShadowGap3 ||\n",
323           (void*)kShadowGap3Beg, (void*)kShadowGap3End);
324    Printf("|| `[%p, %p]` || MidMem     ||\n",
325           (void*)kMidMemBeg, (void*)kMidMemEnd);
326    Printf("|| `[%p, %p]` || ShadowGap2 ||\n",
327           (void*)kShadowGap2Beg, (void*)kShadowGap2End);
328    Printf("|| `[%p, %p]` || MidShadow  ||\n",
329           (void*)kMidShadowBeg, (void*)kMidShadowEnd);
330  }
331  Printf("|| `[%p, %p]` || ShadowGap  ||\n",
332         (void*)kShadowGapBeg, (void*)kShadowGapEnd);
333  if (kLowShadowBeg) {
334    Printf("|| `[%p, %p]` || LowShadow  ||\n",
335           (void*)kLowShadowBeg, (void*)kLowShadowEnd);
336    Printf("|| `[%p, %p]` || LowMem     ||\n",
337           (void*)kLowMemBeg, (void*)kLowMemEnd);
338  }
339  Printf("MemToShadow(shadow): %p %p %p %p",
340         (void*)MEM_TO_SHADOW(kLowShadowBeg),
341         (void*)MEM_TO_SHADOW(kLowShadowEnd),
342         (void*)MEM_TO_SHADOW(kHighShadowBeg),
343         (void*)MEM_TO_SHADOW(kHighShadowEnd));
344  if (kMidMemBeg) {
345    Printf(" %p %p",
346           (void*)MEM_TO_SHADOW(kMidShadowBeg),
347           (void*)MEM_TO_SHADOW(kMidShadowEnd));
348  }
349  Printf("\n");
350  Printf("redzone=%zu\n", (uptr)flags()->redzone);
351  Printf("max_redzone=%zu\n", (uptr)flags()->max_redzone);
352  Printf("quarantine_size_mb=%zuM\n", (uptr)flags()->quarantine_size_mb);
353  Printf("thread_local_quarantine_size_kb=%zuK\n",
354         (uptr)flags()->thread_local_quarantine_size_kb);
355  Printf("malloc_context_size=%zu\n",
356         (uptr)common_flags()->malloc_context_size);
357
358  Printf("SHADOW_SCALE: %d\n", (int)SHADOW_SCALE);
359  Printf("SHADOW_GRANULARITY: %d\n", (int)SHADOW_GRANULARITY);
360  Printf("SHADOW_OFFSET: 0x%zx\n", (uptr)SHADOW_OFFSET);
361  CHECK(SHADOW_SCALE >= 3 && SHADOW_SCALE <= 7);
362  if (kMidMemBeg)
363    CHECK(kMidShadowBeg > kLowShadowEnd &&
364          kMidMemBeg > kMidShadowEnd &&
365          kHighShadowBeg > kMidMemEnd);
366}
367
368static void AsanInitInternal() {
369  if (LIKELY(asan_inited)) return;
370  SanitizerToolName = "AddressSanitizer";
371  CHECK(!asan_init_is_running && "ASan init calls itself!");
372  asan_init_is_running = true;
373
374  CacheBinaryName();
375
376  // Initialize flags. This must be done early, because most of the
377  // initialization steps look at flags().
378  InitializeFlags();
379
380  AsanCheckIncompatibleRT();
381  AsanCheckDynamicRTPrereqs();
382  AvoidCVE_2016_2143();
383
384  SetCanPoisonMemory(flags()->poison_heap);
385  SetMallocContextSize(common_flags()->malloc_context_size);
386
387  InitializePlatformExceptionHandlers();
388
389  InitializeHighMemEnd();
390
391  // Make sure we are not statically linked.
392  AsanDoesNotSupportStaticLinkage();
393
394  // Install tool-specific callbacks in sanitizer_common.
395  AddDieCallback(AsanDie);
396  SetCheckFailedCallback(AsanCheckFailed);
397  SetPrintfAndReportCallback(AppendToErrorMessageBuffer);
398
399  __sanitizer_set_report_path(common_flags()->log_path);
400
401  __asan_option_detect_stack_use_after_return =
402      flags()->detect_stack_use_after_return;
403
404  // Re-exec ourselves if we need to set additional env or command line args.
405  MaybeReexec();
406
407  // Setup internal allocator callback.
408  SetLowLevelAllocateCallback(OnLowLevelAllocate);
409
410  InitializeAsanInterceptors();
411
412  // Enable system log ("adb logcat") on Android.
413  // Doing this before interceptors are initialized crashes in:
414  // AsanInitInternal -> android_log_write -> __interceptor_strcmp
415  AndroidLogInit();
416
417  ReplaceSystemMalloc();
418
419  DisableCoreDumperIfNecessary();
420
421  InitializeShadowMemory();
422
423  AsanTSDInit(PlatformTSDDtor);
424  InstallDeadlySignalHandlers(AsanOnDeadlySignal);
425
426  AllocatorOptions allocator_options;
427  allocator_options.SetFrom(flags(), common_flags());
428  InitializeAllocator(allocator_options);
429
430  MaybeStartBackgroudThread();
431  SetSoftRssLimitExceededCallback(AsanSoftRssLimitExceededCallback);
432
433  // On Linux AsanThread::ThreadStart() calls malloc() that's why asan_inited
434  // should be set to 1 prior to initializing the threads.
435  asan_inited = 1;
436  asan_init_is_running = false;
437
438  if (flags()->atexit)
439    Atexit(asan_atexit);
440
441  InitializeCoverage(common_flags()->coverage, common_flags()->coverage_dir);
442
443  // Now that ASan runtime is (mostly) initialized, deactivate it if
444  // necessary, so that it can be re-activated when requested.
445  if (flags()->start_deactivated)
446    AsanDeactivate();
447
448  // interceptors
449  InitTlsSize();
450
451  // Create main thread.
452  AsanThread *main_thread = CreateMainThread();
453  CHECK_EQ(0, main_thread->tid());
454  force_interface_symbols();  // no-op.
455  SanitizerInitializeUnwinder();
456
457  if (CAN_SANITIZE_LEAKS) {
458    __lsan::InitCommonLsan();
459    if (common_flags()->detect_leaks && common_flags()->leak_check_at_exit) {
460      if (flags()->halt_on_error)
461        Atexit(__lsan::DoLeakCheck);
462      else
463        Atexit(__lsan::DoRecoverableLeakCheckVoid);
464    }
465  }
466
467#if CAN_SANITIZE_UB
468  __ubsan::InitAsPlugin();
469#endif
470
471  InitializeSuppressions();
472
473  if (CAN_SANITIZE_LEAKS) {
474    // LateInitialize() calls dlsym, which can allocate an error string buffer
475    // in the TLS.  Let's ignore the allocation to avoid reporting a leak.
476    __lsan::ScopedInterceptorDisabler disabler;
477    Symbolizer::LateInitialize();
478  } else {
479    Symbolizer::LateInitialize();
480  }
481
482  VReport(1, "AddressSanitizer Init done\n");
483
484  if (flags()->sleep_after_init) {
485    Report("Sleeping for %d second(s)\n", flags()->sleep_after_init);
486    SleepForSeconds(flags()->sleep_after_init);
487  }
488}
489
490// Initialize as requested from some part of ASan runtime library (interceptors,
491// allocator, etc).
492void AsanInitFromRtl() {
493  AsanInitInternal();
494}
495
496#if ASAN_DYNAMIC
497// Initialize runtime in case it's LD_PRELOAD-ed into unsanitized executable
498// (and thus normal initializers from .preinit_array or modules haven't run).
499
500class AsanInitializer {
501public:  // NOLINT
502  AsanInitializer() {
503    AsanInitFromRtl();
504  }
505};
506
507static AsanInitializer asan_initializer;
508#endif  // ASAN_DYNAMIC
509
510} // namespace __asan
511
512// ---------------------- Interface ---------------- {{{1
513using namespace __asan;  // NOLINT
514
515void NOINLINE __asan_handle_no_return() {
516  if (asan_init_is_running)
517    return;
518
519  int local_stack;
520  AsanThread *curr_thread = GetCurrentThread();
521  uptr PageSize = GetPageSizeCached();
522  uptr top, bottom;
523  if (curr_thread) {
524    top = curr_thread->stack_top();
525    bottom = ((uptr)&local_stack - PageSize) & ~(PageSize - 1);
526  } else {
527    CHECK(!SANITIZER_FUCHSIA);
528    // If we haven't seen this thread, try asking the OS for stack bounds.
529    uptr tls_addr, tls_size, stack_size;
530    GetThreadStackAndTls(/*main=*/false, &bottom, &stack_size, &tls_addr,
531                         &tls_size);
532    top = bottom + stack_size;
533  }
534  static const uptr kMaxExpectedCleanupSize = 64 << 20;  // 64M
535  if (top - bottom > kMaxExpectedCleanupSize) {
536    static bool reported_warning = false;
537    if (reported_warning)
538      return;
539    reported_warning = true;
540    Report("WARNING: ASan is ignoring requested __asan_handle_no_return: "
541           "stack top: %p; bottom %p; size: %p (%zd)\n"
542           "False positive error reports may follow\n"
543           "For details see "
544           "https://github.com/google/sanitizers/issues/189\n",
545           top, bottom, top - bottom, top - bottom);
546    return;
547  }
548  PoisonShadow(bottom, top - bottom, 0);
549  if (curr_thread && curr_thread->has_fake_stack())
550    curr_thread->fake_stack()->HandleNoReturn();
551}
552
553void NOINLINE __asan_set_death_callback(void (*callback)(void)) {
554  SetUserDieCallback(callback);
555}
556
557// Initialize as requested from instrumented application code.
558// We use this call as a trigger to wake up ASan from deactivated state.
559void __asan_init() {
560  AsanActivate();
561  AsanInitInternal();
562}
563
564void __asan_version_mismatch_check() {
565  // Do nothing.
566}
567