From: Eric Wong <e@80x24.org>
To: spew@80x24.org
Subject: [PATCH 01/10] ds: don't block important signals we don't use
Date: Sat, 2 Sep 2023 11:09:51 +0000 [thread overview]
Message-ID: <20230902111000.1747604-1-e@80x24.org> (raw)
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;
next reply other threads:[~2023-09-02 11:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-02 11:09 Eric Wong [this message]
2023-09-02 11:09 ` [PATCH 02/10] t/sigfd: test EVFILT_SIGNAL vs signalfd differences Eric Wong
2023-09-02 11:09 ` [PATCH 03/10] t/sigfd: better checks related to SIGWINCH Eric Wong
2023-09-02 11:09 ` [PATCH 04/10] update devel/syscall-list to devel/sysdefs-list Eric Wong
2023-09-02 11:09 ` [PATCH 05/10] daemon: workaround pre-EVFILT_SIGNAL signals Eric Wong
2023-09-02 11:09 ` [PATCH 06/10] watch: ensure children can use signal handlers Eric Wong
2023-09-02 11:09 ` [PATCH 07/10] test_common: start_script: block signals around fork Eric Wong
2023-09-02 11:09 ` [PATCH 08/10] xap_helper: support SIGTTIN+SIGTTOU worker adjustments Eric Wong
2023-09-02 11:09 ` [PATCH 09/10] ds: merge sigmask Eric Wong
2023-09-02 11:10 ` [PATCH 10/10] special cases for unblocking signals Eric Wong
-- strict thread matches above, loose matches on Subject: below --
2023-09-02 23:11 [PATCH 01/10] ds: don't block important signals we don't use Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230902111000.1747604-1-e@80x24.org \
--to=e@80x24.org \
--cc=spew@80x24.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).