File xinetd-2.3.14-nodeadlock-revisited.patch of Package xinetd.5694
From: Leonardo Chiquitto <lchiquitto@suse.com>
Subject: Prevent dead locks in the signal handler
References: bnc#726737
A signal can interrupt xinetd when it's printing / logging.
Currently, the generic signal handler tries to print something as
well (the "Unexpected signal" message), but to do that it needs a
lock that xinetd already holds, deadlocking.
We really can't print anything in the signal handler if the process
is supposed to continue running.
This patch is not perfect but it avoids the most common cases by
no longer catching SIGCONT and no longer printing the "Unexpected
signal" message in the generic signal handler.
---
xinetd/signals.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
Index: xinetd-2.3.14/xinetd/signals.c
===================================================================
--- xinetd-2.3.14.orig/xinetd/signals.c
+++ xinetd-2.3.14/xinetd/signals.c
@@ -186,6 +186,8 @@ static status_e handle_signal( int sig )
return( OK ) ;
/* FALL THROUGH */
+ case SIGCONT:
+ /* FALL THROUGH */
/*
* We may receive a SIGPIPE when handling an internal stream
* service and the other end closes the connection.
@@ -395,7 +397,11 @@ static void general_handler( int sig )
break ;
default:
- msg( LOG_NOTICE, func, "Unexpected signal %s", sig_name( sig ) ) ;
+ /* This will cause a dead lock if the signal happens when the
+ * daemon is writing / logging something. The message is not
+ * important, so comment it out.
+ */
+ // msg( LOG_NOTICE, func, "Unexpected signal %s", sig_name( sig ) ) ;
if ( debug.on && sig == SIGINT )
exit( 1 ) ;
}