[PATCH 1/2] ntdll: Set the process detaching flag before calling FLS callbacks.

Zebediah Figura z.figura12 at gmail.com
Thu Jan 7 09:51:02 CST 2021


So that we will not deadlock trying to acquire fls_section.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---

This fixes a hang that can be triggered by running dotnet45, which prevents some
processes from exiting (i.e. bug 49897). Unfortunately it's not enough to fix
the bug alone. I was unable to debug the remaining hang.

 dlls/ntdll/loader.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 45ad496fd64..5e9a76b8be1 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -3182,12 +3182,14 @@ fail:
  */
 void WINAPI LdrShutdownProcess(void)
 {
+    BOOL detaching = process_detaching;
+
     TRACE("()\n");
 
-    if (!process_detaching)
+    process_detaching = TRUE;
+    if (!detaching)
         RtlProcessFlsData( NtCurrentTeb()->FlsSlots, 1 );
 
-    process_detaching = TRUE;
     process_detach();
 }
 
-- 
2.29.2




More information about the wine-devel mailing list