diff options
author | Eric Wong <e@80x24.org> | 2023-09-04 10:35:58 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-09-05 03:01:35 +0000 |
commit | 6ddfa3d33d9ec7508637d9282557e6fe7cfb160d (patch) | |
tree | 9069fe71cd7def999538ec659c4bf92e908f65e9 /lib/PublicInbox/DS.pm | |
parent | 18c6c4e81dca1d81f6ff2bb284554b5fca2ef163 (diff) | |
download | public-inbox-6ddfa3d33d9ec7508637d9282557e6fe7cfb160d.tar.gz |
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.
Diffstat (limited to 'lib/PublicInbox/DS.pm')
-rw-r--r-- | lib/PublicInbox/DS.pm | 8 |
1 files changed, 7 insertions, 1 deletions
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; |