Fuchsia doesn't support signals, so don't use interceptors for signal or sigaction.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
What effect does this have?
Nothing built for Fuchsia ought to be using sanitizer_signal_interceptors.inc or HandleDeadlySignal in the first place.
This is used from ubsan_signals_standalone.cc. Alternative would be to exclude it from UBSan's CMakeLists.txt when compiling for Fuchsia and avoid the invocation of InitializeDeadlySignals() on Fuchsia in ubsan_init_standalone.cc.
The effect this will have is none, because InstallDeadlySignalHandlers which is supposed to install signal handles doesn't do anything on Fuchsia, see sanitizer_fuchsia.cc. Without the empty definition of HandleDeadlySignal, the build is broken because there's an undefined reference to it in UBsanOnDeadlySignal in ubsan_signals_standalone.cc.
I wonder why my builds have never had an undefined symbol HandleDeadlySignal.
The norm in the sanitizer code for the most part is to #if out whole files rather than conditionalizing it in cmake.
Since we don't have or need a ubsan_fuchsia.cc, I'd just selectively #if out most of uban_signals_standalone.cc so that InitializeDeadSignals is a no-op for SANITIZER_FUCHSIA.
lib/ubsan/ubsan_signals_standalone.cc | ||
---|---|---|
27 ↗ | (On Diff #118178) | Could you please either create _fuchsia.cc file or e.g.: #if SANITIZER_FUCHSIA void InitializeDeadlySignals() {} #else static void OnStackUnwind(const SignalContext &sig, const void *, BufferedStackTrace *stack) { ... } static void UBsanOnDeadlySignal(int signo, void *siginfo, void *context) { ... } static bool is_initialized = false; void InitializeDeadlySignals() { if (is_initialized) return; is_initialized = true; InitializeSignalInterceptors(); InstallDeadlySignalHandlers(&UBsanOnDeadlySignal); } #endif |