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.23-325-ge2cd73a


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  e2cd73a2ccabe8acae28719a0c3c1c03f2b5f9fb (commit)
      from  fdbdbc83a53cfee6edff9f737e188a56925f1db1 (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=e2cd73a2ccabe8acae28719a0c3c1c03f2b5f9fb

commit e2cd73a2ccabe8acae28719a0c3c1c03f2b5f9fb
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri May 13 16:55:01 2016 +0200

    tst-mallocfork2: Fix race condition, use fewer resources
    
    The first SIGUSR1 signal could arrive when sigusr1_sender_pid
    was still 0.  As a result, kill would send SIGSTOP to the
    entire process group.  This would cause the test to hang before
    printing any output.
    
    This commit also adds a sched_yield to the signal source, so that
    it does not flood the parent process with signals it has never a
    chance to handle.
    
    Even with these changes, tst-mallocfork2 still fails reliably
    after the fix in commit commit 56290d6e762c1194547e73ff0b948cd79d3a1e03
    (Increase fork signal safety for single-threaded processes) is
    backed out.

diff --git a/ChangeLog b/ChangeLog
index 5329849..a191caf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-05-13  Florian Weimer  <fweimer@redhat.com>
+
+	Fix race condition in tst-mallocfork2, use fewer resources.
+	* malloc/tst-mallocfork2.c (sigusr1_handler): Do not send SIGSTOP
+	to current process group.
+	(signal_sender): Yield in the non-sleeping case.
+
 2016-05-13  Joseph Myers  <joseph@codesourcery.com>
 
 	* conform/data/stdlib.h-data (a64l): Do not expect for [XPG3].
diff --git a/malloc/tst-mallocfork2.c b/malloc/tst-mallocfork2.c
index a9e3e94..4939938 100644
--- a/malloc/tst-mallocfork2.c
+++ b/malloc/tst-mallocfork2.c
@@ -25,6 +25,7 @@
    still make fork unsafe, even in single-threaded processes.  */
 
 #include <errno.h>
+#include <sched.h>
 #include <signal.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -70,7 +71,9 @@ sigusr1_handler (int signo)
      signals from the subprocess.  */
   if (sigusr1_received)
     return;
-  if (kill (sigusr1_sender_pid, SIGSTOP) != 0)
+  /* sigusr1_sender_pid might not be initialized in the parent when
+     the first SIGUSR1 signal arrives.  */
+  if (sigusr1_sender_pid > 0 && kill (sigusr1_sender_pid, SIGSTOP) != 0)
     {
       write_message ("error: kill (SIGSTOP)\n");
       abort ();
@@ -123,6 +126,9 @@ signal_sender (int signo, bool sleep)
         }
       if (sleep)
         usleep (1 * 1000 * 1000);
+      else
+        /* Reduce the rate at which we send signals.  */
+        sched_yield ();
     }
 }
 

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

Summary of changes:
 ChangeLog                |    7 +++++++
 malloc/tst-mallocfork2.c |    8 +++++++-
 2 files changed, 14 insertions(+), 1 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]