summaryrefslogtreecommitdiff
path: root/lib/frrcu.c
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2025-02-11 20:53:07 -0600
committerGitHub <noreply@github.com>2025-02-11 20:53:07 -0600
commitd15d7097d0bfdb6f987e3b5ce9ede8b352267071 (patch)
tree1162a6e7159987ac7fccecf3c83514366f0f83a3 /lib/frrcu.c
parent11a65e1e00e5e80eb39a40c567b1440c07bcf554 (diff)
parentfd04241d7ea13ca9a009d398c83cf4177871def7 (diff)
Merge pull request #18104 from FRRouting/mergify/bp/stable/10.0/pr-18060
lib: crash handlers must be allowed on threads (backport #18060)
Diffstat (limited to 'lib/frrcu.c')
-rw-r--r--lib/frrcu.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/frrcu.c b/lib/frrcu.c
index b85c525c58..1e7ed99eff 100644
--- a/lib/frrcu.c
+++ b/lib/frrcu.c
@@ -42,6 +42,7 @@
#include "frrcu.h"
#include "seqlock.h"
#include "atomlist.h"
+#include "sigevent.h"
DEFINE_MTYPE_STATIC(LIB, RCU_THREAD, "RCU thread");
DEFINE_MTYPE_STATIC(LIB, RCU_NEXT, "RCU sequence barrier");
@@ -346,7 +347,19 @@ static void rcu_start(void)
*/
sigset_t oldsigs, blocksigs;
- sigfillset(&blocksigs);
+ /* technically, the RCU thread is very poorly suited to run even just a
+ * crashlog handler, since zlog_sigsafe() could deadlock on transiently
+ * invalid (due to RCU) logging data structures
+ *
+ * but given that when we try to write a crashlog, we're already in
+ * b0rked territory anyway - give the crashlog handler a chance.
+ *
+ * (also cf. the SIGALRM usage in writing crashlogs to avoid hung
+ * processes on any kind of deadlock in crash handlers)
+ */
+ sigemptyset(&blocksigs);
+ frr_sigset_add_mainonly(&blocksigs);
+ /* new thread inherits mask */
pthread_sigmask(SIG_BLOCK, &blocksigs, &oldsigs);
rcu_active = true;