[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#9069) Stop setting custom GnuTLS mutex functions



ryan@openldap.org wrote:
> Full_Name: Ryan Tandy
> Version: master
> OS: Debian
> URL: https://github.com/rtandy/openldap/compare/openldap:master...rtandy:remove-gnutls_global_set_mutex.patch
> Submission from: (NULL) (70.66.128.207)
> Submitted by: ryan
> 
> 
> The GnuTLS documentation
> <https://gnutls.org/manual/html_node/Core-TLS-API.html#gnutls_005fglobal_005fset_005fmutex>
> states:
> 
>> Do not call this function from a library, or preferably from any application
> unless really needed to.

> 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.
> 
> On typical systems, GnuTLS system mutexes are probably the same as what libldap
> uses anyway.

This is not a safe assumption on Windows, unfortunately. While libldap uses native
Windows mutexes on Windows, a lot of code built using gcc/g++ uses a posixthreads
emulation library for thread and mutex support, and the user-visible structures are
not compatible with native mutexes. (I've found this to be a significant problem
for g++ std::mutex, std::thread, etc.)
> 
> IPR:
> 
> The attached patch file is derived from OpenLDAP Software. All of the
> modifications to OpenLDAP Software represented in the following patch were
> developed by Ryan Tandy <ryan@nardis.ca>. I have not assigned rights and/or
> interest in this work to any party.
> 
> I, Ryan Tandy, hereby place the following modifications to OpenLDAP Software
> (and only these modifications) into the public domain. Hence, these
> modifications may be freely used and/or redistributed for any purpose with or
> without attribution and/or other notice.
> 
> 


-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/