Page MenuHome GnuPG

npth_init called too late in gpg-agent?
Closed, ResolvedPublic

Description

Hi,

I've found myself plagued by a failed assertion when starting gpg-agent in
npth.c line 123.

Tracing this error led me to see that enter_npth() was called by gpg-agent
before npth_init() (somewhere in init_common_subsystems()).

Moving the npth_init call before solved the issue for me, but maybe this would
require more investigation? Here my diff:

  • agent/gpg-agent.c.orig 2016-11-17 11:40:15.168119000 +0100

+++ agent/gpg-agent.c 2016-11-17 11:40:27.521105000 +0100
@@ -760,9 +760,8 @@

/* Make sure that our subsystems are ready.  */
i18n_init ();
  • init_common_subsystems (&argc, &argv);
  • npth_init ();

+ init_common_subsystems (&argc, &argv);

   malloc_hooks.malloc = gcry_malloc;
   malloc_hooks.realloc = gcry_realloc;

A few more information on the system:
FreeBSD 11, using system-provided clang 3.8.0, on a 4 cores host.

Thanks for your work,

  • Matthieu Volat

Details

Version
2.1.15

Event Timeline

mazhe set Version to 2.1.15.
mazhe added a subscriber: mazhe.

We had to change some init things to better support some non-Linux OSes. This
2.1.16 will be a bit different and may solve your problem.

It has been confirmed that 2.1.16 solves the problem.

The reason for the crash is that 2.1.15 is calling gpgrt_set_syscall_clamp
before nPth is initialized. The nPth initialization was changed in 2.1.15 so to
solve problems on some other platforms.

werner claimed this task.

Indeed, I confirm that the newly updated version 2.1.16 fix this issue, thanks a
lot for doing this portability work!