Do not call gnutls_global_set_mutex()
authorRyan Tandy <ryan@nardis.ca>
Tue, 17 Nov 2020 01:23:45 +0000 (01:23 +0000)
committerRyan Tandy <ryan@nardis.ca>
Tue, 17 Nov 2020 01:23:45 +0000 (01:23 +0000)
commit4e0f6c9c9fe73600440a812a5374a5d700d9ee67
tree8442a5f731d0bb93ae28e0481a7754c429a3c127
parent53bfbe96de2f4a3e218e8a3afd8e0328b97a65b3
Do not call gnutls_global_set_mutex()

Bug-Debian: https://bugs.debian.org/803197
Forwarded: no

Since GnuTLS moved to implicit initialization on library load, calling
this function deinitializes GnuTLS and then re-initializes it.

When GnuTLS uses /dev/urandom as an entropy source (getrandom() not
available, or older versions of GnuTLS), and the application closed all
file descriptors at startup, this could result in GnuTLS opening
/dev/urandom over one of the application's file descriptors when
re-initialized.

Additionally, the custom mutex functions are never reset, so if libldap
is unloaded (for example via dlclose()) after calling this, its code
may be unmapped and the application could crash when GnuTLS calls the
mutex functions.

The default behaviour of GnuTLS, using pthreads, should be suitable on
all Debian systems, and is probably the same as what libldap uses
anyway.

Gbp-Pq: Name no-gnutls_global_set_mutex
libraries/libldap/tls_g.c