Don't block SIGABRT, SIGBUS, SIGFPE, SIGILL nor SIGSEGV since
blocking them can hide real bugs in our code or 3rd-party
libraries and executables.
We'll also leave SIGXCPU and SIGXFSZ unblocked since users
may've setup RLIMIT_CPU and RLIMIT_FSIZE, respectively.
---
lib/PublicInbox/DS.pm | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index e89dc430..97546016 100644
--- a/lib/PublicInbox/DS.pm
+++ b/lib/PublicInbox/DS.pm
@@ -193,10 +193,16 @@ sub RunTimers {
sub sig_setmask { sigprocmask(SIG_SETMASK, @_) or die "sigprocmask: $!" }
+our @UNBLOCKABLE = map { # ensure we detect bugs, HW problems and user rlimits
+ my $cb = POSIX->can("SIG$_");
+ my $num = $cb ? $cb->() : undef;
+ $num ? ($num) : ();
+} qw(ABRT BUS FPE ILL SEGV XCPU XFSZ);
+
sub block_signals { # anything in @_ stays unblocked
my $newset = POSIX::SigSet->new;
$newset->fillset or die "fillset: $!";
- $newset->delset($_) for @_;
+ for (@_, @UNBLOCKABLE) { $newset->delset($_) or die "delset($_): $!" }
my $oldset = POSIX::SigSet->new;
sig_setmask($newset, $oldset);
$oldset;