Page MenuHome GnuPG

gnupg 2.3.5 hangs on key import
Closed, ResolvedPublic


hello. I tried to update gnupg in Arch Linux from 2.2.3x to latest 2.3.5 version. but at least one of our keys cannot be imported using the new version of gpg, it just hangs when importing the key.

steps to reproduce:

~ gpg --keyserver hkps:// --recv-keys 5134EF9EAF65F95B6BB1608E50FB9B273A9D0BB5

what happens

gpg 2.3.5 just freezes.

gpg 2.2.32 works fine.



Related Objects

Event Timeline

alex19EP created this object in space S1 Public.
gniibe renamed this task from gnupg 1.3.5 hangs on key import to gnupg 2.3.5 hangs on key import.Apr 25 2022, 2:20 AM
gniibe added a subscriber: gniibe.

Thank you for the bug report.

The change for I/O speed is the cause of the bug.

The semantics of iobuf by iobuf_temp (with IOBUF_OUTPUT_TEMP) is special, so, our changes should have handled this case correctly. Here is a patch to point out the issue (it should exclude the case).

diff --git a/common/iobuf.c b/common/iobuf.c
index 8ec4c86c0..b7b1ba943 100644
--- a/common/iobuf.c
+++ b/common/iobuf.c
@@ -2328,11 +2328,13 @@ iobuf_write (iobuf_t a, const void *buffer, unsigned int buflen)
   a->e_d.len = 0;
   /* Hint for how full to fill iobuf internal drain buffer. */
-  a->e_d.preferred = (buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE);
+  a->e_d.preferred = (a->use != IOBUF_OUTPUT_TEMP)
-      if (a->d.len == 0 && buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE)
+      if (a->use != IOBUF_OUTPUT_TEMP
+          && a->d.len == 0 && buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE)
 	  /* Setup external drain buffer for faster moving of data
 	    * (avoid memcpy). */

I pushed the change above. I also pushed another change with IOBUF_INPUT_TEMP.

werner claimed this task.