From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id CF2051F560 for ; Mon, 4 Sep 2023 10:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1693823767; bh=HS13cebbM8m+BQO7HBxaBl+z/TV/IBWBFJwcvtS6XXA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=5yv38Y4qJacAokWm7rT5snqOWb+XmHopmYZei4qZUWDaBo5whZG3ZM2Z/plrGF0SG Vllx3bwpzXuIGPnt0A/yShzja5crHjy69eFh82/MZ135qpg91bzdta5xXWVvqK3fCR OKDPlZIOFXrTPxGIvEwV1UssH4kAd0zV09GG8VHY= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 01/10] ds: don't block important signals we don't use Date: Mon, 4 Sep 2023 10:35:58 +0000 Message-ID: <20230904103607.1940839-2-e@80x24.org> In-Reply-To: <20230904103607.1940839-1-e@80x24.org> References: <20230904103607.1940839-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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;