[gnutls-devel] GnuTLS | Crash (0xC0000005) when closing application. (#1380)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Thu Jun 23 13:56:54 CEST 2022



Bjørn Christensen created an issue: https://gitlab.com/gnutls/gnutls/-/issues/1380



## Description of problem:
When our customer exits his application it generate an exception 0xc0000005 during the unload of the gnutls library. 

The call stack indicates that it is failing in _gnutls_rnd_deinit. while trying to line 140 which looks simple

rnd_initialized = 0;

but it turns out that  rnd_initialized is declared as

static _Thread_local unsigned rnd_initialized = 0;

where _Thread_local is defined as __declspec(thread) 

and it turns out the Ubuntu 18.04 mingw 7.3 we are using does not support the __declspec(thread)

Is this a known problem? 
Is it because I am using a too old version of mingw?
Which version of mingw are you  using when cross compiling to windows?


Call stack at the exception: 
 	_fpreset ()	C++
>	_gnutls_rnd_deinit() Line 140	C++
 	_gnutls_global_deinit() Line 415	C++
 	lib_deinit() Line 530	C++
 	__do_global_dtors() Line 27	C++
 	_CRT_INIT() Line 142	C++
 	__DllMainCRTStartup() Line 211	C++
 	LdrpCallInitRoutine()	Unknown
 	LdrpProcessDetachNode()	Unknown
 	LdrpUnloadNode()	Unknown
 	LdrpDecrementModuleLoadCountEx ()	Unknown
 	LdrUnloadDll ()	Unknown
 	FreeLibrary()	Unknown

The fpreset seems to be a red herring when inspection the disassembly. (it is _fpreset+0x190, symbols must be incomplete ) 

## Version of gnutls used:
3.6.15

## Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)
Cross-compiled Compiled and linked by me on Ubuntu 18.04 with mingw version 7.4 for windows.

## How reproducible:
Difficult but reproducable
Steps to Reproduce:

 * one
 * two
 * three

## Actual results:
Exception during exit

## Expected results:
no exception during exit

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/issues/1380
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20220623/5163a641/attachment.html>


More information about the Gnutls-devel mailing list