003 File Manager
Current Path:
/usr/src/contrib/llvm-project/compiler-rt/lib/asan
usr
/
src
/
contrib
/
llvm-project
/
compiler-rt
/
lib
/
asan
/
📁
..
📄
README.txt
(924 B)
📄
asan.syms.extra
(39 B)
📄
asan_activation.cpp
(4.55 KB)
📄
asan_activation.h
(736 B)
📄
asan_activation_flags.inc
(1.42 KB)
📄
asan_allocator.cpp
(40.63 KB)
📄
asan_allocator.h
(8.05 KB)
📄
asan_blacklist.txt
(513 B)
📄
asan_debugging.cpp
(4.7 KB)
📄
asan_descriptions.cpp
(16.44 KB)
📄
asan_descriptions.h
(7.59 KB)
📄
asan_errors.cpp
(21.78 KB)
📄
asan_errors.h
(14.75 KB)
📄
asan_fake_stack.cpp
(10.82 KB)
📄
asan_fake_stack.h
(6.89 KB)
📄
asan_flags.cpp
(7.32 KB)
📄
asan_flags.h
(1.45 KB)
📄
asan_flags.inc
(7.92 KB)
📄
asan_fuchsia.cpp
(8.18 KB)
📄
asan_globals.cpp
(16.98 KB)
📄
asan_globals_win.cpp
(2.03 KB)
📄
asan_init_version.h
(1.88 KB)
📄
asan_interceptors.cpp
(23.89 KB)
📄
asan_interceptors.h
(4.86 KB)
📄
asan_interceptors_memintrinsics.cpp
(1.52 KB)
📄
asan_interceptors_memintrinsics.h
(8.12 KB)
📄
asan_interceptors_vfork.S
(526 B)
📄
asan_interface.inc
(7.25 KB)
📄
asan_interface_internal.h
(10.88 KB)
📄
asan_internal.h
(5.95 KB)
📄
asan_linux.cpp
(7.45 KB)
📄
asan_lock.h
(0 B)
📄
asan_mac.cpp
(11.64 KB)
📄
asan_malloc_linux.cpp
(9.8 KB)
📄
asan_malloc_local.h
(1.92 KB)
📄
asan_malloc_mac.cpp
(3.83 KB)
📄
asan_malloc_win.cpp
(19.55 KB)
📄
asan_mapping.h
(14.72 KB)
📄
asan_mapping_myriad.h
(2.11 KB)
📄
asan_mapping_sparc64.h
(2.95 KB)
📄
asan_memory_profile.cpp
(4.12 KB)
📄
asan_new_delete.cpp
(8.16 KB)
📄
asan_poisoning.cpp
(16 KB)
📄
asan_poisoning.h
(3.85 KB)
📄
asan_posix.cpp
(4.12 KB)
📄
asan_preinit.cpp
(1 KB)
📄
asan_premap_shadow.cpp
(2.7 KB)
📄
asan_premap_shadow.h
(913 B)
📄
asan_report.cpp
(20.2 KB)
📄
asan_report.h
(4.59 KB)
📄
asan_rtems.cpp
(8.9 KB)
📄
asan_rtl.cpp
(22.99 KB)
📄
asan_scariness_score.h
(2.25 KB)
📄
asan_shadow_setup.cpp
(6.2 KB)
📄
asan_stack.cpp
(2.28 KB)
📄
asan_stack.h
(3.29 KB)
📄
asan_stats.cpp
(5.62 KB)
📄
asan_stats.h
(2.05 KB)
📄
asan_suppressions.cpp
(3.62 KB)
📄
asan_suppressions.h
(1.01 KB)
📄
asan_thread.cpp
(18.01 KB)
📄
asan_thread.h
(5.56 KB)
📄
asan_win.cpp
(13.74 KB)
📄
asan_win_dll_thunk.cpp
(5.12 KB)
📄
asan_win_dynamic_runtime_thunk.cpp
(5.4 KB)
📄
asan_win_weak_interception.cpp
(1.14 KB)
📄
weak_symbols.txt
(268 B)
Editing: asan_posix.cpp
//===-- asan_posix.cpp ----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file is a part of AddressSanitizer, an address sanity checker. // // Posix-specific details. //===----------------------------------------------------------------------===// #include "sanitizer_common/sanitizer_platform.h" #if SANITIZER_POSIX #include "asan_internal.h" #include "asan_interceptors.h" #include "asan_mapping.h" #include "asan_poisoning.h" #include "asan_report.h" #include "asan_stack.h" #include "sanitizer_common/sanitizer_libc.h" #include "sanitizer_common/sanitizer_posix.h" #include "sanitizer_common/sanitizer_procmaps.h" #include <pthread.h> #include <signal.h> #include <stdlib.h> #include <sys/time.h> #include <sys/resource.h> #include <unistd.h> namespace __asan { void AsanOnDeadlySignal(int signo, void *siginfo, void *context) { StartReportDeadlySignal(); SignalContext sig(siginfo, context); ReportDeadlySignal(sig); } bool PlatformUnpoisonStacks() { stack_t signal_stack; CHECK_EQ(0, sigaltstack(nullptr, &signal_stack)); uptr sigalt_bottom = (uptr)signal_stack.ss_sp; uptr sigalt_top = (uptr)((char *)signal_stack.ss_sp + signal_stack.ss_size); // If we're executing on the signal alternate stack AND the Linux flag // SS_AUTODISARM was used, then we cannot get the signal alternate stack // bounds from sigaltstack -- sigaltstack's output looks just as if no // alternate stack has ever been set up. // We're always unpoisoning the signal alternate stack to support jumping // between the default stack and signal alternate stack. if (signal_stack.ss_flags != SS_DISABLE) UnpoisonStack(sigalt_bottom, sigalt_top, "sigalt"); if (signal_stack.ss_flags != SS_ONSTACK) return false; // Since we're on the signal altnerate stack, we cannot find the DEFAULT // stack bottom using a local variable. uptr default_bottom, tls_addr, tls_size, stack_size; GetThreadStackAndTls(/*main=*/false, &default_bottom, &stack_size, &tls_addr, &tls_size); UnpoisonStack(default_bottom, default_bottom + stack_size, "default"); return true; } // ---------------------- TSD ---------------- {{{1 #if SANITIZER_NETBSD && !ASAN_DYNAMIC // Thread Static Data cannot be used in early static ASan init on NetBSD. // Reuse the Asan TSD API for compatibility with existing code // with an alternative implementation. static void (*tsd_destructor)(void *tsd) = nullptr; struct tsd_key { tsd_key() : key(nullptr) {} ~tsd_key() { CHECK(tsd_destructor); if (key) (*tsd_destructor)(key); } void *key; }; static thread_local struct tsd_key key; void AsanTSDInit(void (*destructor)(void *tsd)) { CHECK(!tsd_destructor); tsd_destructor = destructor; } void *AsanTSDGet() { CHECK(tsd_destructor); return key.key; } void AsanTSDSet(void *tsd) { CHECK(tsd_destructor); CHECK(tsd); CHECK(!key.key); key.key = tsd; } void PlatformTSDDtor(void *tsd) { CHECK(tsd_destructor); CHECK_EQ(key.key, tsd); key.key = nullptr; // Make sure that signal handler can not see a stale current thread pointer. atomic_signal_fence(memory_order_seq_cst); AsanThread::TSDDtor(tsd); } #else static pthread_key_t tsd_key; static bool tsd_key_inited = false; void AsanTSDInit(void (*destructor)(void *tsd)) { CHECK(!tsd_key_inited); tsd_key_inited = true; CHECK_EQ(0, pthread_key_create(&tsd_key, destructor)); } void *AsanTSDGet() { CHECK(tsd_key_inited); return pthread_getspecific(tsd_key); } void AsanTSDSet(void *tsd) { CHECK(tsd_key_inited); pthread_setspecific(tsd_key, tsd); } void PlatformTSDDtor(void *tsd) { AsanThreadContext *context = (AsanThreadContext*)tsd; if (context->destructor_iterations > 1) { context->destructor_iterations--; CHECK_EQ(0, pthread_setspecific(tsd_key, tsd)); return; } AsanThread::TSDDtor(tsd); } #endif } // namespace __asan #endif // SANITIZER_POSIX
Upload File
Create Folder