Skip to content

Commit a01cfac

Browse files
committed
sighook: Ignore sigaction() errors in atsigexit()
This fixes bfs under Valgrind, which reserves SIGRTMAX for its own use.
1 parent e93a1dc commit a01cfac

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

src/sighook.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -565,24 +565,20 @@ struct sighook *sighook(int sig, sighook_fn *fn, void *arg, enum sigflags flags)
565565
struct sighook *atsigexit(sighook_fn *fn, void *arg) {
566566
mutex_lock(&sigmutex);
567567

568-
struct sighook *ret = NULL;
569-
570568
for (size_t i = 0; i < countof(FATAL_SIGNALS); ++i) {
571-
if (siginit(FATAL_SIGNALS[i]) != 0) {
572-
goto done;
573-
}
569+
// Ignore errors; atsigexit() is best-effort anyway and things
570+
// like sanitizer runtimes or valgrind may reserve signals for
571+
// their own use
572+
siginit(FATAL_SIGNALS[i]);
574573
}
575574

576575
#ifdef SIGRTMIN
577576
for (int i = SIGRTMIN; i <= SIGRTMAX; ++i) {
578-
if (siginit(i) != 0) {
579-
goto done;
580-
}
577+
siginit(i);
581578
}
582579
#endif
583580

584-
ret = sighook_impl(&rcu_exithooks, 0, fn, arg, 0);
585-
done:
581+
struct sighook *ret = sighook_impl(&rcu_exithooks, 0, fn, arg, 0);
586582
mutex_unlock(&sigmutex);
587583
return ret;
588584
}

0 commit comments

Comments
 (0)