[git] GnuPG - branch, master, updated. gnupg-2.1.5-10-g685b782

by Werner Koch cvs at cvs.gnupg.org
Tue Jun 16 18:13:31 CEST 2015


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 "The GNU Privacy Guard".

The branch, master has been updated
       via  685b782a18adb90bbf78956682e4e7f89fed678c (commit)
       via  eb4d33cba9cd0f6929cbb556b7fa2deca0a3a87e (commit)
       via  82c72e2db7bc5b633768d59822f2e2a353fa6e32 (commit)
       via  43211f553dd2741f855db4023fc4920da1c3789c (commit)
      from  eac081ba1278855fa223b031b527498fec558bc7 (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 -----------------------------------------------------------------
commit 685b782a18adb90bbf78956682e4e7f89fed678c
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Jun 16 18:08:32 2015 +0200

    dirmngr: Cleanup zombies and fix hang on shutdown.
    
    * dirmngr/ldap-wrapper.c (ldap_wrapper_thread): Move nfds computation
    into the loop.  Check the queue also on timeout.  Close log_fd and
    reader context on EOF or error.
    --
    
    The major bug here was that on an EOF of the log fd the log fd was not
    closed and thus the final queue item removal could not work.  Checking
    the queue on a timeout is not really necessary but it help in case
    there is a race condition lingering.
    
    GnuPG-bug-id: 1838, 1978
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/dirmngr/ldap-wrapper.c b/dirmngr/ldap-wrapper.c
index 30bbda3..0dcc7ba 100644
--- a/dirmngr/ldap-wrapper.c
+++ b/dirmngr/ldap-wrapper.c
@@ -259,26 +259,12 @@ ldap_wrapper_thread (void *dummy)
   struct timespec abstime;
   struct timespec curtime;
   struct timespec timeout;
-  int saved_errno;
-  fd_set fdset, read_fdset;
+  fd_set fdset;
   int ret;
   time_t exptime;
 
   (void)dummy;
 
-  FD_ZERO (&fdset);
-  nfds = -1;
-  for (ctx = wrapper_list; ctx; ctx = ctx->next)
-    {
-      if (ctx->log_fd != -1)
-	{
-	  FD_SET (ctx->log_fd, &fdset);
-	  if (ctx->log_fd > nfds)
-	    nfds = ctx->log_fd;
-	}
-    }
-  nfds++;
-
   npth_clock_gettime (&abstime);
   abstime.tv_sec += TIMERTICK_INTERVAL;
 
@@ -286,38 +272,42 @@ ldap_wrapper_thread (void *dummy)
     {
       int any_action = 0;
 
-      /* POSIX says that fd_set should be implemented as a structure,
-         thus a simple assignment is fine to copy the entire set.  */
-      read_fdset = fdset;
-
       npth_clock_gettime (&curtime);
       if (!(npth_timercmp (&curtime, &abstime, <)))
 	{
 	  /* Inactivity is checked below.  Nothing else to do.  */
-	  // handle_tick ();
 	  npth_clock_gettime (&abstime);
 	  abstime.tv_sec += TIMERTICK_INTERVAL;
 	}
       npth_timersub (&abstime, &curtime, &timeout);
 
+      FD_ZERO (&fdset);
+      nfds = -1;
+      for (ctx = wrapper_list; ctx; ctx = ctx->next)
+        {
+          if (ctx->log_fd != -1)
+            {
+              FD_SET (ctx->log_fd, &fdset);
+              if (ctx->log_fd > nfds)
+                nfds = ctx->log_fd;
+            }
+        }
+      nfds++;
+
       /* FIXME: For Windows, we have to use a reader thread on the
 	 pipe that signals an event (and a npth_select_ev variant).  */
-      ret = npth_pselect (nfds + 1, &read_fdset, NULL, NULL, &timeout, NULL);
-      saved_errno = errno;
-
-      if (ret == -1 && saved_errno != EINTR)
+      ret = npth_pselect (nfds + 1, &fdset, NULL, NULL, &timeout, NULL);
+      if (ret == -1)
 	{
-          log_error (_("npth_select failed: %s - waiting 1s\n"),
-                     strerror (saved_errno));
-          npth_sleep (1);
+          if (errno != EINTR)
+            {
+              log_error (_("npth_select failed: %s - waiting 1s\n"),
+                         strerror (errno));
+              npth_sleep (1);
+            }
           continue;
 	}
 
-      if (ret <= 0)
-	/* Interrupt or timeout.  Will be handled when calculating the
-	   next timeout.  */
-	continue;
-
       /* All timestamps before exptime should be considered expired.  */
       exptime = time (NULL);
       if (exptime > INACTIVITY_TIMEOUT)
@@ -331,10 +321,15 @@ ldap_wrapper_thread (void *dummy)
       for (ctx = wrapper_list; ctx; ctx = ctx->next)
         {
           /* Check whether there is any logging to be done. */
-          if (nfds && ctx->log_fd != -1 && FD_ISSET (ctx->log_fd, &read_fdset))
+          if (nfds && ctx->log_fd != -1 && FD_ISSET (ctx->log_fd, &fdset))
             {
               if (read_log_data (ctx))
-                any_action = 1;
+                {
+                  ksba_reader_release (ctx->reader);
+                  ctx->reader = NULL;
+                  SAFE_CLOSE (ctx->log_fd);
+                  any_action = 1;
+                }
             }
 
           /* Check whether the process is still running.  */

commit eb4d33cba9cd0f6929cbb556b7fa2deca0a3a87e
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Jun 16 11:47:07 2015 +0200

    dirmngr: Add missing cast for use of pid_t in printf.
    
    --

diff --git a/dirmngr/ldap-wrapper.c b/dirmngr/ldap-wrapper.c
index 5588468..30bbda3 100644
--- a/dirmngr/ldap-wrapper.c
+++ b/dirmngr/ldap-wrapper.c
@@ -234,7 +234,7 @@ read_log_data (struct wrapper_context_s *ctx)
     {
       if (n < 0)
         log_error (_("error reading log from ldap wrapper %d: %s\n"),
-                   ctx->pid, strerror (errno));
+                   (int)ctx->pid, strerror (errno));
       print_log_line (ctx, NULL);
       SAFE_CLOSE (ctx->log_fd);
       return 1;

commit 82c72e2db7bc5b633768d59822f2e2a353fa6e32
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Jun 16 12:12:03 2015 +0200

    dirmngr: Avoid accessing uninitialized memory in log callback.
    
    * dirmngr/dirmngr.c (pid_suffix_callback): Clear int_and_ptr_u before
    use.
    (start_connection_thread): Ditto.
    (handle_connections): Ditto.
    --
    
    Example valgrind output:
    
    ==2921== Conditional jump or move depends on uninitialised value(s)
    ==2921==    at 0x5BBDEF4: pthread_getspecific (pthread_getspecific.c:57)
    ==2921==    by 0x40AAEE: pid_suffix_callback (dirmngr.c:614)
    ==2921==    by 0x433F5A: do_logv (logging.c:684)
    
    This is because on 64 bit systems "sizeof aptr > sizeof aint" and thus
    Valgrind complains about this.  It is no a real problem because we
    don't use the unitialized bits.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 3375a4a..a9efba9 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -297,7 +297,7 @@ union int_and_ptr_u
 
 /* The key used to store the current file descriptor in the thread
    local storage.  We use this in conjunction with the
-   log_set_pid_suffix_cb feature..  */
+   log_set_pid_suffix_cb feature.  */
 #ifndef HAVE_W32_SYSTEM
 static int my_tlskey_current_fd;
 #endif
@@ -611,6 +611,7 @@ pid_suffix_callback (unsigned long *r_suffix)
 {
   union int_and_ptr_u value;
 
+  memset (&value, 0, sizeof value);
   value.aptr = npth_getspecific (my_tlskey_current_fd);
   *r_suffix = value.aint;
   return (*r_suffix != -1);  /* Use decimal representation.  */
@@ -1915,6 +1916,7 @@ start_connection_thread (void *arg)
   union int_and_ptr_u argval;
   gnupg_fd_t fd;
 
+  memset (&argval, 0, sizeof argval);
   argval.aptr = arg;
   fd = argval.afd;
 
@@ -2054,12 +2056,14 @@ handle_connections (assuan_fd_t listen_fd)
               union int_and_ptr_u argval;
 	      npth_t thread;
 
+              memset (&argval, 0, sizeof argval);
               argval.afd = fd;
               snprintf (threadname, sizeof threadname-1,
                         "conn fd=%d", FD2INT(fd));
               threadname[sizeof threadname -1] = 0;
 
-              ret = npth_create (&thread, &tattr, start_connection_thread, argval.aptr);
+              ret = npth_create (&thread, &tattr,
+                                 start_connection_thread, argval.aptr);
 	      if (ret)
                 {
                   log_error ("error spawning connection handler: %s\n",

commit 43211f553dd2741f855db4023fc4920da1c3789c
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Jun 16 11:41:55 2015 +0200

    build: Distribute swdb.lst with the w32-source target.
    
    --

diff --git a/build-aux/speedo.mk b/build-aux/speedo.mk
index 0dd5e2e..dc949ba 100644
--- a/build-aux/speedo.mk
+++ b/build-aux/speedo.mk
@@ -91,7 +91,8 @@ git-w32-installer: check-tools
 	$(SPEEDOMAKE) TARGETOS=w32    WHAT=git     WITH_GUI=0 installer
 
 this-w32-installer: check-tools
-	$(SPEEDOMAKE) TARGETOS=w32    WHAT=this    WITH_GUI=0 installer
+	$(SPEEDOMAKE) TARGETOS=w32    WHAT=this    WITH_GUI=0 \
+	                                           CUSTOM_SWDB=1 installer
 
 w32-source: check-tools
 	$(SPEEDOMAKE) TARGETOS=w32    WHAT=release WITH_GUI=0 dist-source
@@ -100,7 +101,8 @@ git-w32-source: check-tools
 	$(SPEEDOMAKE) TARGETOS=w32    WHAT=git     WITH_GUI=0 dist-source
 
 this-w32-source: check-tools
-	$(SPEEDOMAKE) TARGETOS=w32    WHAT=git     WITH_GUI=0 dist-source
+	$(SPEEDOMAKE) TARGETOS=w32    WHAT=this    WITH_GUI=0 \
+	                                           CUSTOM_SWDB=1 dist-source
 
 
 # Set this to "git" to build from git,
@@ -1058,7 +1060,7 @@ dist-source: all
              --anchored --exclude './PLAY' . ;\
 	 tar --totals -rf "$$tarname" --exclude-backups --exclude-vc \
               --transform='s,^,$(INST_NAME)-$(INST_VERSION)/,' \
-	     PLAY/stamps/stamp-*-00-unpack PLAY/src ;\
+	     PLAY/stamps/stamp-*-00-unpack PLAY/src swdb.lst swdb.lst.sig ;\
          xz "$$tarname" ;\
 	)
 

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

Summary of changes:
 build-aux/speedo.mk    |  8 ++++---
 dirmngr/dirmngr.c      |  8 +++++--
 dirmngr/ldap-wrapper.c | 65 +++++++++++++++++++++++---------------------------
 3 files changed, 41 insertions(+), 40 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list