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

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Fri Jun 24 10:54:07 CEST 2022




Bjørn Christensen commented on a discussion: https://gitlab.com/gnutls/gnutls/-/issues/1380#note_1004078015

Good point Daiki,



And if I change the __declspec(thread) to __thread my sample program works.



When I examined the crash I looked at the disassembly and I could not see that the access to rnd_initialized was guarded.





              00000000773B165A  mov         qword ptr [rbp-8],0 

              00000000773B1662  mov         rax,qword ptr [rbp-10h] 

              00000000773B1666  mov         qword ptr [rbp-8],rax 

L3:           00000000773B166A  cmp         qword ptr [rbp-8],0                                 // 131

              00000000773B166F  jne         _gnutls_rnd_deinit+25h (0773B1624h) L2              // 131

              00000000773B1671  mov         qword ptr [head (077618568h)],0 

L1:           00000000773B167C  lea         rcx,[gnutls_mutex_unlock+8h (077551380h)] 

              00000000773B1683  call        _fpreset+190h (07754A420h)    

              00000000773B1688  mov         dword ptr [rax],0 

              00000000773B168E  call        _rnd_system_entropy_deinit (07748BCB2h) 

              00000000773B1693  nop 

              00000000773B1694  add         rsp,30h 

              00000000773B1698  pop         rbp 





Maybe the call to _fpreset+0x190 is the setup of TLS memory.



Thanks for the help I will investigate a bit further.



/bhc

<details><summary>...</summary>

From: gitlab at mg.gitlab.com <gitlab at mg.gitlab.com> 
Sent: Friday, 24 June 2022 10.29
To: bhc at insight.dk
Subject: Re: GnuTLS | Crash (0xC0000005) when closing application. (#1380)

 

Daiki Ueno <https://gitlab.com/dueno>  commented on a discussion <https://gitlab.com/gnutls/gnutls/-/issues/1380#note_1004040111> : 

GnuTLS usage of __declspec(thread) is guarded <https://gitlab.com/gnutls/gnutls/-/blob/master/lib/gthreads.h>  with #ifdef _MSC_VER. If you see the macro expanded, that means_MSC_VER is defined somewhere, while it shouldn't be if you are using g++: https://sourceforge.net/p/mingw-w64/bugs/282/#3996

— 
Reply to this email directly or view it on GitLab <https://gitlab.com/gnutls/gnutls/-/issues/1380#note_1004040111> . 
You're receiving this email because of your account on gitlab.com. If you'd like to receive fewer emails, you can unsubscribe <https://gitlab.com/-/sent_notifications/REDACTED/unsubscribe>  from this thread or adjust your notification settings.

</details>

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/issues/1380#note_1004078015
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/20220624/ce69d8c0/attachment.html>


More information about the Gnutls-devel mailing list