* [PATCH 01/10] ds: don't block important signals we don't use
2023-09-04 10:35 4% [PATCH 00/10] signal-handling and *BSD fixes Eric Wong
@ 2023-09-04 10:35 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-09-04 10:35 UTC (permalink / raw)
To: meta
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;
^ permalink raw reply related [relevance 7%]
* [PATCH 00/10] signal-handling and *BSD fixes
@ 2023-09-04 10:35 4% Eric Wong
2023-09-04 10:35 7% ` [PATCH 01/10] ds: don't block important signals we don't use Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-09-04 10:35 UTC (permalink / raw)
To: meta
kevent EVFILT_SIGNAL behaves differently than Linux signalfd
in that we can't rely on it to handle signals that were sent
before the existence of the kevent filter. Thus, [5/10] opens
a window before entering the event.
This difference between OSes was noticed due to lei tests
quickly starting read-only daemons and terminating them before
signal handlers were setup properly from the lack of
SCM_RIGHTS support on *BSDs lacking Inline::C.
Nevertheless [9/10] improves test dependency management to
ensure read-only daemons don't start all when SCM_RIGHTS
support is unavailable.
Patch [10/10] was originally far more aggressive in that it
kept all signals blocked across execve, but that's probably
unrealistic for real-world scenarios
7/10 to add TTOU/TTIN support to xap_helper was actually
the first developed in this series.
Lots more brewing in the portability department...
Eric Wong (10):
ds: don't block important signals we don't use
t/sigfd: test EVFILT_SIGNAL vs signalfd differences
t/sigfd: better checks related to SIGWINCH
update devel/syscall-list to devel/sysdefs-list
daemon: workaround pre-EVFILT_SIGNAL signals
watch: ensure children can use signal handlers
xap_helper: support SIGTTIN+SIGTTOU worker adjustments
xap_helper.h: include signal.h for sig* functions
tests: add `+SCM_RIGHTS' as a require_mods target
test_common: start_script: set default signals
MANIFEST | 2 +-
devel/{syscall-list => sysdefs-list} | 47 ++---
lib/PublicInbox/DS.pm | 38 +++-
lib/PublicInbox/IPC.pm | 2 +-
lib/PublicInbox/Sigfd.pm | 3 +-
lib/PublicInbox/Syscall.pm | 7 +-
lib/PublicInbox/TestCommon.pm | 26 ++-
lib/PublicInbox/Watch.pm | 7 +-
lib/PublicInbox/XapHelper.pm | 103 +++++++---
lib/PublicInbox/xap_helper.h | 283 +++++++++++++++++++++++----
script/public-inbox-watch | 4 +-
t/lei-import-nntp.t | 4 +-
t/lei.t | 3 +-
t/sigfd.t | 28 ++-
t/xap_helper.t | 59 ++++--
15 files changed, 489 insertions(+), 127 deletions(-)
rename devel/{syscall-list => sysdefs-list} (60%)
^ permalink raw reply [relevance 4%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-09-04 10:35 4% [PATCH 00/10] signal-handling and *BSD fixes Eric Wong
2023-09-04 10:35 7% ` [PATCH 01/10] ds: don't block important signals we don't use Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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).