This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.22-673-ga3e5b4f


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  a3e5b4feeb54cb92657ec2bc6d9be1fcef9e8575 (commit)
      from  692de4b3960dc90bdcfb871513ee4d81d314cf69 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a3e5b4feeb54cb92657ec2bc6d9be1fcef9e8575

commit a3e5b4feeb54cb92657ec2bc6d9be1fcef9e8575
Author: Paul E. Murphy <murphyp@linux.vnet.ibm.com>
Date:   Mon Jan 11 17:24:04 2016 -0500

    Fix race in tst-mqueue5
    
    The check is done on line 117 by a thread spawned
    from do_child(), forked from do_test().  This test
    generates a signal in the forked process.
    
    Either thread may handle the signal, and on ppc,
    it happens to be done on do_child, on the thread
    which is not doing the check on line 117.
    
    This exposes a race condition whereby the test
    incorrectly fails as the signal is caught during
    or after the check.
    
    This is mitigated by ensuring the signal is blocked
    in the child thread while thread is running.

diff --git a/ChangeLog b/ChangeLog
index 7f2a19d..fb5cd0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-01-15  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
+
+	* rt/tst-mqueue5.c (thr): Cleanup misleading comment.
+	(do_child): Mask SIGRTMIN while thr is running.
+
 2016-01-15  Martin Sebor  <msebor@redhat.com>
 
 	[BZ #19432]
diff --git a/rt/tst-mqueue5.c b/rt/tst-mqueue5.c
index aa74fa3..25042bc 100644
--- a/rt/tst-mqueue5.c
+++ b/rt/tst-mqueue5.c
@@ -116,7 +116,7 @@ thr (void *arg)
 
   if (rtmin_cnt != 2)
     {
-      puts ("SIGRTMIN signal in child did not arrive");
+      puts ("SIGRTMIN signal in thread did not arrive");
       result = 1;
     }
   else if (rtmin_pid != getppid ()
@@ -403,6 +403,16 @@ do_child (const char *name, pthread_barrier_t *b2, pthread_barrier_t *b3,
       result = 1;
     }
 
+  /* Ensure the thr thread gets the signal, not us.  */
+  sigset_t set;
+  sigemptyset (&set);
+  sigaddset (&set, SIGRTMIN);
+  if (pthread_sigmask (SIG_BLOCK, &set, NULL))
+    {
+      printf ("Failed to block SIGRTMIN in child: %m\n");
+      result = 1;
+    }
+
   (void) pthread_barrier_wait (b2);
 
   /* Parent calls mqsend (q), which should wake up mqrecv (q)
@@ -514,7 +524,14 @@ do_child (const char *name, pthread_barrier_t *b2, pthread_barrier_t *b3,
       result = 1;
     }
 
- void *thr_ret;
+  /* Reenable test signals before cleaning up the thread.  */
+  if (pthread_sigmask (SIG_UNBLOCK, &set, NULL))
+    {
+      printf ("Failed to unblock SIGRTMIN in child: %m\n");
+      result = 1;
+    }
+
+  void *thr_ret;
   ret = pthread_join (th, &thr_ret);
   if (ret)
     {

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog        |    5 +++++
 rt/tst-mqueue5.c |   21 +++++++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]