[lttng-dev] [PATCH userspace-rcu] use a filled signal mask to disable all signals

Pelton, Dave dpelton at ciena.com
Fri May 10 01:32:52 EDT 2013


While using lttng-ust with an application that was calling fork()
with pending signals, I found that all signals were getting unmasked
shortly before the underlying call to fork().  After some
investigation, I found that the rcu_bp_before_fork() function was
unmasking all signals.  Based on the comments for this function, it
should be masking all signals.  Inspection of the rest of the code
in urcu-bp.c revealed the same pattern in two other functions.

This patch changes the code to use a filled signal mask to disable
all signals.  The change to rcu_bp_before_fork() addressed the
problem I was seeing while using lttng-ust.  The changes to the
other two functions appear to fix other instances of the same
problem.

Signed-off-by: David Pelton <dpelton at ciena.com>
---
 urcu-bp.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/urcu-bp.c b/urcu-bp.c
index ef1e687..416a1b9 100644
--- a/urcu-bp.c
+++ b/urcu-bp.c
@@ -213,7 +213,7 @@ void synchronize_rcu(void)
 	sigset_t newmask, oldmask;
 	int ret;
 
-	ret = sigemptyset(&newmask);
+	ret = sigfillset(&newmask);
 	assert(!ret);
 	ret = pthread_sigmask(SIG_SETMASK, &newmask, &oldmask);
 	assert(!ret);
@@ -385,7 +385,7 @@ void rcu_bp_register(void)
 	sigset_t newmask, oldmask;
 	int ret;
 
-	ret = sigemptyset(&newmask);
+	ret = sigfillset(&newmask);
 	assert(!ret);
 	ret = pthread_sigmask(SIG_SETMASK, &newmask, &oldmask);
 	assert(!ret);
@@ -420,7 +420,7 @@ void rcu_bp_before_fork(void)
 	sigset_t newmask, oldmask;
 	int ret;
 
-	ret = sigemptyset(&newmask);
+	ret = sigfillset(&newmask);
 	assert(!ret);
 	ret = pthread_sigmask(SIG_SETMASK, &newmask, &oldmask);
 	assert(!ret);
-- 
1.6.2.5




More information about the lttng-dev mailing list