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

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 15:28:08 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))
----------------
vitalybuka wrote:

So as-is this patch introduce interceptor related logic into UBSAN, which would be nice to avoid

```
int internal_sigaction(int signum, const void *act, void *oldact) {
#  if !SANITIZER_GO
  if (&real_sigaction)
    return real_sigaction(signum, act, oldact);
#  endif
  return sigaction(signum, (const struct sigaction *)act,
                   (struct sigaction *)oldact);
}
```
>From this code, it already should throughout to `sigaction`, so it does not match the test in the description: 

> with static linking
(-static/-static-pie), the called REAL(sigaction) is null, leading to
an immediate segfault,



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


More information about the llvm-commits mailing list