[compiler-rt] [ubsan] Support static linking with standalone runtime (PR #80943)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 21:23:56 PST 2024


================
@@ -66,6 +66,11 @@ void InitializeDeadlySignals() {
     return;
   is_initialized = true;
   InitializeSignalInterceptors();
+#if SANITIZER_INTERCEPT_SIGNAL_AND_SIGACTION
+  // REAL(sigaction_symname) is nullptr in a static link. Bail out.
+  if (!REAL(sigaction_symname))
----------------
MaskRay wrote:

`internal_sigaction` cannot call `sigaction` (interceptor), as there will be a dead lock. In asan, `AsanInitInternal` (which holds `asan_inited_mutex`) calls `InitializeSignalInterceptors`. If the `sigaction` interceptor is called, `asan_inited_mutex` will be held again -> dead lock.

It seems that testing `REAL(sigaction_symname)` in `ubsan` (and future sanitizers that can be used with static linking) is better?

https://github.com/llvm/llvm-project/pull/80943


More information about the llvm-commits mailing list