From a01cfacd423af28af6b7c13ba51e2395f3a52ee7 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 7 Jun 2024 11:39:40 -0400 Subject: sighook: Ignore sigaction() errors in atsigexit() This fixes bfs under Valgrind, which reserves SIGRTMAX for its own use. --- src/sighook.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/sighook.c b/src/sighook.c index 3a7fb43..1146ea7 100644 --- a/src/sighook.c +++ b/src/sighook.c @@ -565,24 +565,20 @@ done: struct sighook *atsigexit(sighook_fn *fn, void *arg) { mutex_lock(&sigmutex); - struct sighook *ret = NULL; - for (size_t i = 0; i < countof(FATAL_SIGNALS); ++i) { - if (siginit(FATAL_SIGNALS[i]) != 0) { - goto done; - } + // Ignore errors; atsigexit() is best-effort anyway and things + // like sanitizer runtimes or valgrind may reserve signals for + // their own use + siginit(FATAL_SIGNALS[i]); } #ifdef SIGRTMIN for (int i = SIGRTMIN; i <= SIGRTMAX; ++i) { - if (siginit(i) != 0) { - goto done; - } + siginit(i); } #endif - ret = sighook_impl(&rcu_exithooks, 0, fn, arg, 0); -done: + struct sighook *ret = sighook_impl(&rcu_exithooks, 0, fn, arg, 0); mutex_unlock(&sigmutex); return ret; } -- cgit v1.2.3