[PATCH 0/3] MR9821: Avoid crash in gnutls logging when crypt libraries got unloaded.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59163 When using one of the debug channels +bcrypt, +crypt or +secur32 alone, and that dll gets unloaded, and one of the other dlls gets loaded, there happens a "silent" crash at the unix-side, which makes this other dll loading fail. The crash consists of gnutls still holding the pointer to the logging function of the unloaded dll. One workaround would be to always use all three debug channels together. An improvement may be this patches, which set the logging function pointer to zero. But this may silence some expected logging from gnutls, when multiple of the crypt dlls are loaded at the same time. Best solution may be to access gnutls through a single unix library, currently there are three, one for each dll. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9821
From: Bernhard Übelacker <bernhardu@mailbox.org> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59163 --- dlls/bcrypt/gnutls.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c index 3e9efb677df..b80e7f85718 100644 --- a/dlls/bcrypt/gnutls.c +++ b/dlls/bcrypt/gnutls.c @@ -484,6 +484,8 @@ static NTSTATUS gnutls_process_detach( void *args ) { if (libgnutls_handle) { + if (TRACE_ON( bcrypt )) + pgnutls_global_set_log_function( NULL ); pgnutls_global_deinit(); dlclose( libgnutls_handle ); libgnutls_handle = NULL; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9821
From: Bernhard Übelacker <bernhardu@mailbox.org> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59163 --- dlls/crypt32/unixlib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/crypt32/unixlib.c b/dlls/crypt32/unixlib.c index 82064b29a76..345051cc6c7 100644 --- a/dlls/crypt32/unixlib.c +++ b/dlls/crypt32/unixlib.c @@ -148,6 +148,8 @@ static NTSTATUS process_detach( void *args ) { if (libgnutls_handle) { + if (TRACE_ON( crypt )) + pgnutls_global_set_log_function( NULL ); pgnutls_global_deinit(); dlclose( libgnutls_handle ); libgnutls_handle = NULL; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9821
From: Bernhard Übelacker <bernhardu@mailbox.org> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59163 --- dlls/secur32/schannel_gnutls.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/secur32/schannel_gnutls.c b/dlls/secur32/schannel_gnutls.c index cfe580ee4fe..947c591051d 100644 --- a/dlls/secur32/schannel_gnutls.c +++ b/dlls/secur32/schannel_gnutls.c @@ -1602,6 +1602,8 @@ static NTSTATUS process_detach( void *args ) { if (libgnutls_handle) { + if (TRACE_ON(secur32)) + pgnutls_global_set_log_function(NULL); pgnutls_global_deinit(); dlclose(libgnutls_handle); libgnutls_handle = NULL; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9821
I think this is fine for now. Current situation is not ideal also because enabling one of these channels gets you gnutls traces from the other two as well. Instead of sharing the Unix lib between dlls this may ultimately be solved by replacing at least 2 of those gnutls dependencies with something else. There are plans to do that for bcrypt, for independent reasons. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9821#note_126057
This merge request was approved by Hans Leidekker. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9821
participants (3)
-
Bernhard Übelacker -
Bernhard Übelacker (@bernhardu) -
Hans Leidekker (@hans)