003 File Manager
Current Path:
/usr/src/contrib/llvm-project/compiler-rt/lib/ubsan
usr
/
src
/
contrib
/
llvm-project
/
compiler-rt
/
lib
/
ubsan
/
📁
..
📄
ubsan.syms.extra
(10 B)
📄
ubsan_checks.inc
(3.71 KB)
📄
ubsan_diag.cpp
(14.53 KB)
📄
ubsan_diag.h
(7.57 KB)
📄
ubsan_diag_standalone.cpp
(1.24 KB)
📄
ubsan_flags.cpp
(2.26 KB)
📄
ubsan_flags.h
(1.28 KB)
📄
ubsan_flags.inc
(1.25 KB)
📄
ubsan_handlers.cpp
(32.22 KB)
📄
ubsan_handlers.h
(7.12 KB)
📄
ubsan_handlers_cxx.cpp
(7.2 KB)
📄
ubsan_handlers_cxx.h
(2.1 KB)
📄
ubsan_init.cpp
(1.79 KB)
📄
ubsan_init.h
(1.06 KB)
📄
ubsan_init_standalone.cpp
(977 B)
📄
ubsan_init_standalone_preinit.cpp
(1.04 KB)
📄
ubsan_interface.inc
(3.25 KB)
📄
ubsan_monitor.cpp
(2.67 KB)
📄
ubsan_monitor.h
(1.72 KB)
📄
ubsan_platform.h
(952 B)
📄
ubsan_signals_standalone.cpp
(2.46 KB)
📄
ubsan_signals_standalone.h
(775 B)
📄
ubsan_type_hash.cpp
(1.25 KB)
📄
ubsan_type_hash.h
(2.73 KB)
📄
ubsan_type_hash_itanium.cpp
(9.47 KB)
📄
ubsan_type_hash_win.cpp
(2.82 KB)
📄
ubsan_value.cpp
(5.21 KB)
📄
ubsan_value.h
(6.04 KB)
📄
ubsan_win_dll_thunk.cpp
(1.02 KB)
📄
ubsan_win_dynamic_runtime_thunk.cpp
(952 B)
📄
ubsan_win_weak_interception.cpp
(1.15 KB)
📄
weak_symbols.txt
(25 B)
Editing: ubsan_signals_standalone.cpp
//=-- ubsan_signals_standalone.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 // //===----------------------------------------------------------------------===// // // Installs signal handlers and related interceptors for UBSan standalone. // //===----------------------------------------------------------------------===// #include "ubsan_platform.h" #include "sanitizer_common/sanitizer_platform.h" #if CAN_SANITIZE_UB #include "interception/interception.h" #include "sanitizer_common/sanitizer_stacktrace.h" #include "ubsan_diag.h" #include "ubsan_init.h" // Interception of signals breaks too many things on Android. // * It requires that ubsan is the first dependency of the main executable for // the interceptors to work correctly. This complicates deployment, as it // prevents us from enabling ubsan on random platform modules independently. // * For this to work with ART VM, ubsan signal handler has to be set after the // debuggerd handler, but before the ART handler. // * Interceptors don't work at all when ubsan runtime is loaded late, ex. when // it is part of an APK that does not use wrap.sh method. #if SANITIZER_FUCHSIA || SANITIZER_ANDROID namespace __ubsan { void InitializeDeadlySignals() {} } #else #define COMMON_INTERCEPT_FUNCTION(name) INTERCEPT_FUNCTION(name) #include "sanitizer_common/sanitizer_signal_interceptors.inc" // TODO(yln): Temporary workaround. Will be removed. void ubsan_GetStackTrace(BufferedStackTrace *stack, uptr max_depth, uptr pc, uptr bp, void *context, bool fast); namespace __ubsan { static void OnStackUnwind(const SignalContext &sig, const void *, BufferedStackTrace *stack) { ubsan_GetStackTrace(stack, kStackTraceMax, StackTrace::GetNextInstructionPc(sig.pc), sig.bp, sig.context, common_flags()->fast_unwind_on_fatal); } static void UBsanOnDeadlySignal(int signo, void *siginfo, void *context) { HandleDeadlySignal(siginfo, context, GetTid(), &OnStackUnwind, nullptr); } static bool is_initialized = false; void InitializeDeadlySignals() { if (is_initialized) return; is_initialized = true; InitializeSignalInterceptors(); InstallDeadlySignalHandlers(&UBsanOnDeadlySignal); } } // namespace __ubsan #endif #endif // CAN_SANITIZE_UB
Upload File
Create Folder