https://bugs.winehq.org/show_bug.cgi?id=54807
Bug ID: 54807 Summary: some apps hangs at exit (regression) Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: ntdll Assignee: wine-bugs@winehq.org Reporter: roxmail@list.ru Distribution: ---
Since wine-6.5 Keil UV4 C51 (demo) hang at exit or close project (not always, but most likely).
d144890c88c69c937b5e3ffa9b85d0d9d475c44d is the first bad commit commit d144890c88c69c937b5e3ffa9b85d0d9d475c44d Author: Zebediah Figura z.figura12@gmail.com Date: Mon Mar 22 23:04:29 2021 -0500
ntdll: Hold fd_cache_section while removing and closing handles.
Otherwise, it's possible for the old handle to be re-added to the cache between removing and closing it.
Signed-off-by: Zebediah Figura z.figura12@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
this change fix it (at least for wine-8.4 and early, i suppose it partially revert this commit):
diff -urN a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c --- a/dlls/ntdll/unix/server.c 2023-03-25 10:41:17.844720197 +0300 +++ b/dlls/ntdll/unix/server.c 2023-03-25 10:41:34.456106724 +0300 @@ -1777,6 +1777,8 @@ * retrieve it again */ fd = remove_fd_from_cache( handle );
+ server_leave_uninterrupted_section( &fd_cache_mutex, &sigset ); + SERVER_START_REQ( close_handle ) { req->handle = wine_server_obj_handle( handle ); @@ -1784,8 +1786,6 @@ } SERVER_END_REQ;
- server_leave_uninterrupted_section( &fd_cache_mutex, &sigset ); - if (fd != -1) close( fd );
if (ret != STATUS_INVALID_HANDLE || !handle) return ret;